comparison SimoleonScreenshots/SimoleonScreenshots.swift @ 109:587924519d3b

Reestructured schemes and targets
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Thu, 05 Aug 2021 09:39:19 +0100
parents SimoleonUITests/SimoleonUITests.swift@599fe95307f6
children f54d3dabb2d3
comparison
equal deleted inserted replaced
108:9f9fa45c9ef6 109:587924519d3b
1 //
2 // SimoleonScreenshots.swift
3 // SimoleonScreenshots
4 //
5 // Created by Dennis Concepción Martín on 5/8/21.
6 //
7
8 import XCTest
9
10 class SimoleonScreenshots: XCTestCase {
11 var screnshotEndingName = ""
12
13 override func setUpWithError() throws {
14 // Put setup code here. This method is called before the invocation of each test method in the class.
15 if UIDevice.current.userInterfaceIdiom == .pad {
16 XCUIDevice.shared.orientation = .landscapeLeft
17 screnshotEndingName = "-force_landscapeleft"
18 }
19
20 let app = XCUIApplication()
21 setupSnapshot(app)
22 app.launch()
23
24 // In UI tests it is usually best to stop immediately when a failure occurs.
25 continueAfterFailure = false
26
27 // 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.
28 }
29
30 override func tearDownWithError() throws {
31 // Put teardown code here. This method is called after the invocation of each test method in the class.
32 }
33
34 // MARK: - Automate screenshots
35 func testLaunch() {
36 if UIDevice.current.userInterfaceIdiom == .pad {
37 XCUIApplication().tables.buttons.firstMatch.tap()
38 }
39
40 snapshot("1Launch\(screnshotEndingName)")
41 }
42
43 func testCurrencySelector() {
44 if UIDevice.current.userInterfaceIdiom == .pad {
45 XCUIApplication().tables.buttons.firstMatch.tap()
46 }
47
48 XCUIApplication().scrollViews.buttons.firstMatch.tap()
49 snapshot("2CurrencySelector\(screnshotEndingName)")
50
51 XCUIApplication().tables.buttons.element(boundBy: 6).tap()
52 let conversionTextfield = XCUIApplication().textFields.firstMatch
53 conversionTextfield.tap()
54 for _ in (0..<4) {
55 conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue)
56 }
57
58 conversionTextfield.typeText("\n")
59
60 snapshot("3Amount\(screnshotEndingName)")
61 }
62
63 func testFavorites() throws {
64 // Go to favorites
65 if UIDevice.current.userInterfaceIdiom == .pad {
66 XCUIApplication().tables.buttons.element(boundBy: 1).tap()
67 } else {
68 XCUIApplication().tabBars.buttons.element(boundBy: 1).tap()
69 }
70
71 snapshot("4Favorites\(screnshotEndingName)")
72 }
73 }