Mercurial > public > simoleon
comparison SimoleonUITests/SimoleonUITests.swift @ 173:ad8c6567539d
restart project
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Tue, 26 Oct 2021 13:09:17 +0200 |
parents | 4271fb5f69e2 |
children | 5a9430fd6b4d |
comparison
equal
deleted
inserted
replaced
172:9b0486301fbf | 173:ad8c6567539d |
---|---|
1 // | 1 // |
2 // SimoleonUITests.swift | 2 // SimoleonUITests.swift |
3 // SimoleonUITests | 3 // SimoleonUITests |
4 // | 4 // |
5 // Created by Dennis Concepción Martín on 08/07/2021. | 5 // Created by Dennis Concepción Martín on 26/10/21. |
6 // | 6 // |
7 | 7 |
8 import XCTest | 8 import XCTest |
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 | 14 |
18 // In UI tests it is usually best to stop immediately when a failure occurs. | 15 // In UI tests it is usually best to stop immediately when a failure occurs. |
19 continueAfterFailure = false | 16 continueAfterFailure = false |
20 | 17 |
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. | 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. |
22 } | 19 } |
23 | 20 |
24 override func tearDownWithError() throws { | 21 override func tearDownWithError() throws { |
25 // Put teardown code here. This method is called after the invocation of each test method in the class. | 22 // Put teardown code here. This method is called after the invocation of each test method in the class. |
26 } | 23 } |
27 | 24 |
28 func testTabBar() throws { | 25 func testExample() throws { |
26 // UI tests must launch the application that they test. | |
29 let app = XCUIApplication() | 27 let app = XCUIApplication() |
30 app.launch() | 28 app.launch() |
31 | 29 |
32 if UIDevice.current.userInterfaceIdiom == .pad { | 30 // Use recording to get started writing UI tests. |
33 app.tables["Sidebar"].buttons["NavigateToConversion"].tap() | 31 // Use XCTAssert and related functions to verify your tests produce the correct results. |
34 XCTAssertTrue(app.staticTexts["Convert"].exists) | |
35 | |
36 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() | |
37 XCTAssertTrue(app.staticTexts["Favorites"].exists) | |
38 | |
39 app.tables["Sidebar"].buttons["NavigateToSettings"].tap() | |
40 XCTAssertTrue(app.staticTexts["Settings"].exists) | |
41 } else { | |
42 app.tabBars.buttons.element(boundBy: 0).tap() | |
43 XCTAssertTrue(app.staticTexts["Convert"].exists) | |
44 | |
45 app.tabBars.buttons.element(boundBy: 1).tap() | |
46 XCTAssertTrue(app.staticTexts["Favorites"].exists) | |
47 | |
48 app.tabBars.buttons.element(boundBy: 2).tap() | |
49 XCTAssertTrue(app.staticTexts["Settings"].exists) | |
50 | |
51 } | |
52 } | |
53 | |
54 func testCurrencySelector() throws { | |
55 let app = XCUIApplication() | |
56 app.launch() | |
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.launch() | |
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 } | 32 } |
82 | 33 |
83 func testLaunchPerformance() throws { | 34 func testLaunchPerformance() throws { |
84 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { | 35 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { |
85 // This measures how long it takes to launch your application. | 36 // This measures how long it takes to launch your application. |