comparison SimoleonUITests/SimoleonUITests.swift @ 96:fa994172c050

Breaked in parts UI Tests
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 03 Aug 2021 15:40:47 +0100
parents 529feb1fc8d5
children 1d661f15adab
comparison
equal deleted inserted replaced
95:04feeb708833 96:fa994172c050
22 override func tearDownWithError() throws { 22 override func tearDownWithError() throws {
23 // Put teardown code here. This method is called after the invocation of each test method in the class. 23 // Put teardown code here. This method is called after the invocation of each test method in the class.
24 } 24 }
25 25
26 // MARK: - Automate screenshots 26 // MARK: - Automate screenshots
27 func testScreenshots() throws { 27 func testLaunchScreenshots() {
28 let app = XCUIApplication() 28 let app = XCUIApplication()
29 setupSnapshot(app) 29 setupSnapshot(app)
30
31 // MARK: - Launch
32 app.launch() 30 app.launch()
33 snapshot("0-Launch") 31 snapshot("0-Launch")
34 32
35 // MARK: - Remove 100 from conversion textfield and type custom amount 33 // Remove 100 from conversion textfield and type custom amount
36 let conversionTextfield = app.textFields["ConversionTextfield"] 34 let conversionTextfield = app.textFields["ConversionTextfield"]
37 conversionTextfield.tap() 35 conversionTextfield.tap()
38 for _ in (0..<4) { 36 for _ in (0..<4) {
39 conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue) 37 conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue)
40 } 38 }
44 // Remove custom amount and type again 1000 42 // Remove custom amount and type again 1000
45 for _ in (0..<7) { 43 for _ in (0..<7) {
46 conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue) 44 conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue)
47 } 45 }
48 conversionTextfield.typeText("1000\n") 46 conversionTextfield.typeText("1000\n")
47 }
48
49 func testCurrencySelectorScreenshots() throws {
50 let app = XCUIApplication()
51 setupSnapshot(app)
52 app.launch()
49 53
50 // MARK: - Open currency selector, search BTC, and select first row 54 // Open currency selector, search BTC, and select first row
51 app.buttons["CurrencySelector"].tap() 55 app.buttons["CurrencySelector"].tap()
52 snapshot("2-CurrencySelector") 56 snapshot("2-CurrencySelector")
53 57
54 let searchBar = app.textFields["SearchBar"] 58 let searchBar = app.textFields["SearchBar"]
55 searchBar.tap() 59 searchBar.tap()
56 searchBar.typeText("BTC") 60 searchBar.typeText("BTC")
57 app.buttons["CurrencyRow"].firstMatch.tap() 61 app.buttons["CurrencyRow"].firstMatch.tap()
58 snapshot("3-Bitcoin") 62 snapshot("3-Bitcoin")
59 63 }
60 // MARK: - Go to favorites 64
61 conversionTextfield.typeText("\n") // Dismiss keyboard 65 func testFavorites() throws {
66 let app = XCUIApplication()
67 setupSnapshot(app)
68 app.launch()
69
70 // Go to favorites
62 app.tabBars.buttons.element(boundBy: 1).tap() 71 app.tabBars.buttons.element(boundBy: 1).tap()
63 snapshot("4-Favorites") 72 snapshot("4-Favorites")
64 } 73 }
65 74
66 func testLaunchPerformance() throws { 75 func testLaunchPerformance() throws {