comparison SimoleonUITests/SimoleonUITests.swift @ 144:4271fb5f69e2

Add Scheme for automating App Preview
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Tue, 17 Aug 2021 22:15:48 +0100
parents 081f0857af51
children ad8c6567539d
comparison
equal deleted inserted replaced
143:407611b9df91 144:4271fb5f69e2
12 override func setUpWithError() throws { 12 override func setUpWithError() throws {
13 // Put setup code here. This method is called before the invocation of each test method in the class. 13 // Put setup code here. This method is called before the invocation of each test method in the class.
14 if UIDevice.current.userInterfaceIdiom == .pad { 14 if UIDevice.current.userInterfaceIdiom == .pad {
15 XCUIDevice.shared.orientation = .landscapeLeft 15 XCUIDevice.shared.orientation = .landscapeLeft
16 } 16 }
17
18 let app = XCUIApplication()
19 app.launch()
20 17
21 // In UI tests it is usually best to stop immediately when a failure occurs. 18 // In UI tests it is usually best to stop immediately when a failure occurs.
22 continueAfterFailure = false 19 continueAfterFailure = false
23 20
24 // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 21 // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 // Put teardown code here. This method is called after the invocation of each test method in the class. 25 // Put teardown code here. This method is called after the invocation of each test method in the class.
29 } 26 }
30 27
31 func testTabBar() throws { 28 func testTabBar() throws {
32 let app = XCUIApplication() 29 let app = XCUIApplication()
30 app.launch()
31
33 if UIDevice.current.userInterfaceIdiom == .pad { 32 if UIDevice.current.userInterfaceIdiom == .pad {
34 app.tables["Sidebar"].buttons["NavigateToConversion"].tap() 33 app.tables["Sidebar"].buttons["NavigateToConversion"].tap()
35 XCTAssertTrue(app.staticTexts["Convert"].exists) 34 XCTAssertTrue(app.staticTexts["Convert"].exists)
36 35
37 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() 36 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap()
52 } 51 }
53 } 52 }
54 53
55 func testCurrencySelector() throws { 54 func testCurrencySelector() throws {
56 let app = XCUIApplication() 55 let app = XCUIApplication()
56 app.launch()
57 app.scrollViews.buttons["OpenCurrencySelector"].tap() 57 app.scrollViews.buttons["OpenCurrencySelector"].tap()
58 58
59 let currencySearchBar = app.textFields["CurrencySearchBar"] 59 let currencySearchBar = app.textFields["CurrencySearchBar"]
60 currencySearchBar.tap() 60 currencySearchBar.tap()
61 currencySearchBar.typeText("USD/BTC") 61 currencySearchBar.typeText("USD/BTC")
62 app.tables.buttons["From USD to BTC"].tap() 62 app.tables.buttons["From USD to BTC"].tap()
63 } 63 }
64 64
65 func testCoreData() throws { 65 func testCoreData() throws {
66 let app = XCUIApplication() 66 let app = XCUIApplication()
67 app.scrollViews.buttons["AddToFavorites"].tap() 67 app.launch()
68 68
69 if UIDevice.current.userInterfaceIdiom == .pad { 69 if UIDevice.current.userInterfaceIdiom == .pad {
70 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() 70 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap()
71 } else { 71 } else {
72 app.tabBars.buttons.element(boundBy: 1).tap() 72 app.tabBars.buttons.element(boundBy: 1).tap()