diff SimoleonUITests/SimoleonUITests.swift @ 99:1d661f15adab

Fixes UI Testing bugs on iPad
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 03 Aug 2021 18:48:32 +0100
parents fa994172c050
children e3e6dfd7fdbf
line wrap: on
line diff
--- a/SimoleonUITests/SimoleonUITests.swift	Tue Aug 03 18:48:16 2021 +0100
+++ b/SimoleonUITests/SimoleonUITests.swift	Tue Aug 03 18:48:32 2021 +0100
@@ -11,7 +11,10 @@
 
     override func setUpWithError() throws {
         // Put setup code here. This method is called before the invocation of each test method in the class.
-        
+//        if UIDevice.current.userInterfaceIdiom == .pad {
+//            XCUIDevice.shared.orientation = .landscapeRight
+//            sleep(2)
+//        }
 
         // In UI tests it is usually best to stop immediately when a failure occurs.
         continueAfterFailure = false
@@ -68,7 +71,13 @@
         app.launch()
         
         // Go to favorites
-        app.tabBars.buttons.element(boundBy: 1).tap()
+        if UIDevice.current.userInterfaceIdiom == .pad {
+            app.navigationBars.buttons.element(boundBy: 0).tap()
+            app.buttons["Favorites"].tap()
+        } else {
+            app.tabBars.buttons.element(boundBy: 1).tap()
+        }
+
         snapshot("4-Favorites")
     }