Mercurial > public > simoleon
comparison SimoleonUITests/SimoleonUITests.swift @ 146:f10b0e188905 v1.3.1
Merge pull request #16 from DennisTechnologies/development
Release v1.3.1
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Tue, 17 Aug 2021 22:14:58 +0100 |
parents | 081f0857af51 |
children | 4271fb5f69e2 |
comparison
equal
deleted
inserted
replaced
117:a6df002a0a5c | 146:f10b0e188905 |
---|---|
9 | 9 |
10 class SimoleonUITests: XCTestCase { | 10 class SimoleonUITests: XCTestCase { |
11 | 11 |
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 { | |
15 XCUIDevice.shared.orientation = .landscapeLeft | |
16 } | |
17 | |
18 let app = XCUIApplication() | |
19 app.launch() | |
14 | 20 |
15 // In UI tests it is usually best to stop immediately when a failure occurs. | 21 // In UI tests it is usually best to stop immediately when a failure occurs. |
16 continueAfterFailure = false | 22 continueAfterFailure = false |
17 | 23 |
18 // 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. | 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. |
19 } | 25 } |
20 | 26 |
21 override func tearDownWithError() throws { | 27 override func tearDownWithError() throws { |
22 // Put teardown code here. This method is called after the invocation of each test method in the class. | 28 // Put teardown code here. This method is called after the invocation of each test method in the class. |
23 } | 29 } |
24 | 30 |
31 func testTabBar() throws { | |
32 let app = XCUIApplication() | |
33 if UIDevice.current.userInterfaceIdiom == .pad { | |
34 app.tables["Sidebar"].buttons["NavigateToConversion"].tap() | |
35 XCTAssertTrue(app.staticTexts["Convert"].exists) | |
36 | |
37 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() | |
38 XCTAssertTrue(app.staticTexts["Favorites"].exists) | |
39 | |
40 app.tables["Sidebar"].buttons["NavigateToSettings"].tap() | |
41 XCTAssertTrue(app.staticTexts["Settings"].exists) | |
42 } else { | |
43 app.tabBars.buttons.element(boundBy: 0).tap() | |
44 XCTAssertTrue(app.staticTexts["Convert"].exists) | |
45 | |
46 app.tabBars.buttons.element(boundBy: 1).tap() | |
47 XCTAssertTrue(app.staticTexts["Favorites"].exists) | |
48 | |
49 app.tabBars.buttons.element(boundBy: 2).tap() | |
50 XCTAssertTrue(app.staticTexts["Settings"].exists) | |
51 | |
52 } | |
53 } | |
54 | |
55 func testCurrencySelector() throws { | |
56 let app = XCUIApplication() | |
57 app.scrollViews.buttons["OpenCurrencySelector"].tap() | |
58 | |
59 let currencySearchBar = app.textFields["CurrencySearchBar"] | |
60 currencySearchBar.tap() | |
61 currencySearchBar.typeText("USD/BTC") | |
62 app.tables.buttons["From USD to BTC"].tap() | |
63 } | |
64 | |
65 func testCoreData() throws { | |
66 let app = XCUIApplication() | |
67 app.scrollViews.buttons["AddToFavorites"].tap() | |
68 | |
69 if UIDevice.current.userInterfaceIdiom == .pad { | |
70 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() | |
71 } else { | |
72 app.tabBars.buttons.element(boundBy: 1).tap() | |
73 } | |
74 | |
75 XCTAssertTrue(app.tables.buttons["From USD to GBP"].exists) | |
76 | |
77 let favoriteList = app.tables | |
78 favoriteList.buttons["From USD to GBP"].swipeLeft() | |
79 favoriteList.buttons["Delete"].tap() | |
80 XCTAssertFalse(app.tables.buttons["From USD to GBP"].exists) | |
81 } | |
25 | 82 |
26 func testLaunchPerformance() throws { | 83 func testLaunchPerformance() throws { |
27 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { | 84 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { |
28 // This measures how long it takes to launch your application. | 85 // This measures how long it takes to launch your application. |
29 measure(metrics: [XCTApplicationLaunchMetric()]) { | 86 measure(metrics: [XCTApplicationLaunchMetric()]) { |