comparison SimoleonUITests/SimoleonUITests.swift @ 44:415d51d6923f

Adding tests
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 26 Jul 2021 17:36:09 +0100
parents e0c2bda6c51f
children 1c7687d30373
comparison
equal deleted inserted replaced
43:2eb05f396fcd 44:415d51d6923f
19 } 19 }
20 20
21 override func tearDownWithError() throws { 21 override func tearDownWithError() throws {
22 // 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.
23 } 23 }
24 24
25 func testExample() throws { 25 // MARK: - Tab View
26 // UI tests must launch the application that they test. 26 func testTabBarButtons() {
27 let app = XCUIApplication() 27 let app = XCUIApplication()
28 app.launch() 28 app.launch()
29 29
30 // Use recording to get started writing UI tests. 30 app.tabBars.buttons["Favourites"].tap()
31 // Use XCTAssert and related functions to verify your tests produce the correct results. 31 XCTAssertTrue(app.navigationBars["Favourites"].exists)
32
33 app.tabBars.buttons["Settings"].tap()
34 XCTAssertTrue(app.navigationBars["Settings"].exists)
35
36 app.tabBars.buttons["Convert"].tap()
37 XCTAssertTrue(app.navigationBars["Convert"].exists)
38 }
39
40 // MARK: - Conversion View
41 func testCurrencySelector() {
42 let app = XCUIApplication()
43 app.launch()
44
45 let currencySelectorButton = app.buttons["CurrencySelector"]
46 currencySelectorButton.tap()
47
48 let searchBar = app.textFields["SearchBar"]
49 searchBar.typeText("BTC/USD")
50
51 let currencyRowButton = app.buttons["CurrencyRowButton"].firstMatch
52 let currencyRowButtonLabel = currencyRowButton.label
53 currencyRowButton.tap()
54
55 XCTAssertTrue(currencyRowButtonLabel == currencySelectorButton.label)
32 } 56 }
33 57
34 func testLaunchPerformance() throws { 58 func testLaunchPerformance() throws {
35 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { 59 if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
36 // This measures how long it takes to launch your application. 60 // This measures how long it takes to launch your application.