changeset 44:415d51d6923f

Adding tests
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 26 Jul 2021 17:36:09 +0100
parents 2eb05f396fcd
children 1c7687d30373
files SimoleonUITests/SimoleonUITests.swift
diffstat 1 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/SimoleonUITests/SimoleonUITests.swift	Mon Jul 26 17:35:57 2021 +0100
+++ b/SimoleonUITests/SimoleonUITests.swift	Mon Jul 26 17:36:09 2021 +0100
@@ -21,14 +21,38 @@
     override func tearDownWithError() throws {
         // Put teardown code here. This method is called after the invocation of each test method in the class.
     }
-
-    func testExample() throws {
-        // UI tests must launch the application that they test.
+    
+    // MARK: - Tab View
+    func testTabBarButtons() {
         let app = XCUIApplication()
         app.launch()
-
-        // Use recording to get started writing UI tests.
-        // Use XCTAssert and related functions to verify your tests produce the correct results.
+        
+        app.tabBars.buttons["Favourites"].tap()
+        XCTAssertTrue(app.navigationBars["Favourites"].exists)
+        
+        app.tabBars.buttons["Settings"].tap()
+        XCTAssertTrue(app.navigationBars["Settings"].exists)
+        
+        app.tabBars.buttons["Convert"].tap()
+        XCTAssertTrue(app.navigationBars["Convert"].exists)
+    }
+    
+    // MARK: - Conversion View
+    func testCurrencySelector() {
+        let app = XCUIApplication()
+        app.launch()
+        
+        let currencySelectorButton = app.buttons["CurrencySelector"]
+        currencySelectorButton.tap()
+        
+        let searchBar = app.textFields["SearchBar"]
+        searchBar.typeText("BTC/USD")
+        
+        let currencyRowButton = app.buttons["CurrencyRowButton"].firstMatch
+        let currencyRowButtonLabel = currencyRowButton.label
+        currencyRowButton.tap()
+        
+        XCTAssertTrue(currencyRowButtonLabel == currencySelectorButton.label)
     }
 
     func testLaunchPerformance() throws {