comparison SimoleonScreenshots/SimoleonScreenshots.swift @ 147:cbf8a128462e

Merge branch 'automate-app-preview' into development
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Tue, 17 Aug 2021 22:18:16 +0100
parents 4271fb5f69e2
children
comparison
equal deleted inserted replaced
146:f10b0e188905 147:cbf8a128462e
16 16
17 if UIDevice.current.userInterfaceIdiom == .pad { 17 if UIDevice.current.userInterfaceIdiom == .pad {
18 XCUIDevice.shared.orientation = .landscapeLeft 18 XCUIDevice.shared.orientation = .landscapeLeft
19 screenshotEndingName = "-force_landscapeleft" 19 screenshotEndingName = "-force_landscapeleft"
20 } 20 }
21
22 let app = XCUIApplication()
23 setupSnapshot(app)
24 app.launch()
25 21
26 // In UI tests it is usually best to stop immediately when a failure occurs. 22 // In UI tests it is usually best to stop immediately when a failure occurs.
27 continueAfterFailure = false 23 continueAfterFailure = false
28 } 24 }
29 25
30 override func tearDownWithError() throws { 26 override func tearDownWithError() throws {
31 // Put teardown code here. This method is called after the invocation of each test method in the class. 27 // Put teardown code here. This method is called after the invocation of each test method in the class.
32 } 28 }
33 29
34 func testLaunchScreenshot() throws { 30 func testLaunchScreenshot() throws {
31 let app = XCUIApplication()
32 setupSnapshot(app)
33 app.launch()
34
35 if UIDevice.current.userInterfaceIdiom == .pad { 35 if UIDevice.current.userInterfaceIdiom == .pad {
36 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() 36 app.tables["Sidebar"].buttons["NavigateToConversion"].tap()
37 } 37 }
38 38
39 sleep(2) 39 sleep(2)
40 snapshot("1Launch\(screenshotEndingName)") 40 snapshot("1Launch\(screenshotEndingName)")
41 } 41 }
42 42
43 func testConvertAmountScreenshot() throws { 43 func testConvertAmountScreenshot() throws {
44 let app = XCUIApplication()
45 setupSnapshot(app)
46 app.launch()
47
44 if UIDevice.current.userInterfaceIdiom == .pad { 48 if UIDevice.current.userInterfaceIdiom == .pad {
45 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() 49 app.tables["Sidebar"].buttons["NavigateToConversion"].tap()
46 } 50 }
47 51
48 let conversionTextField = XCUIApplication().textFields["ConversionTextField"] 52 let conversionTextField = app.textFields["ConversionTextField"]
49 conversionTextField.tap() 53 conversionTextField.tap()
50 conversionTextField.typeText("1030.15\n") 54 conversionTextField.typeText("1030.15\n")
51 snapshot("2Conversion\(screenshotEndingName)") 55 snapshot("2Conversion\(screenshotEndingName)")
52 } 56 }
53 57
54 func testCurrencySelectorScreenshot() throws { 58 func testCurrencySelectorScreenshot() throws {
59 let app = XCUIApplication()
60 setupSnapshot(app)
61 app.launch()
62
55 if UIDevice.current.userInterfaceIdiom == .pad { 63 if UIDevice.current.userInterfaceIdiom == .pad {
56 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() 64 app.tables["Sidebar"].buttons["NavigateToConversion"].tap()
57 } 65 }
58 66
59 XCUIApplication().scrollViews.buttons["OpenCurrencySelector"].tap() 67 app.scrollViews.buttons["OpenCurrencySelector"].tap()
60 snapshot("3CurrencySelector\(screenshotEndingName)") 68 snapshot("3CurrencySelector\(screenshotEndingName)")
61 } 69 }
62 70
63 func testFavoriteScreenshot() throws { 71 func testFavoriteScreenshot() throws {
72 let app = XCUIApplication()
73 setupSnapshot(app)
74 app.launch()
75
64 if UIDevice.current.userInterfaceIdiom == .pad { 76 if UIDevice.current.userInterfaceIdiom == .pad {
65 XCUIApplication().tables["Sidebar"].buttons["NavigateToFavorites"].tap() 77 app.tables["Sidebar"].buttons["NavigateToFavorites"].tap()
66 } else { 78 } else {
67 XCUIApplication().tabBars.buttons.element(boundBy: 1).tap() 79 app.tabBars.buttons.element(boundBy: 1).tap()
68 } 80 }
69 81
70 sleep(1) 82 sleep(1)
71 83
72 snapshot("4Favorites\(screenshotEndingName)") 84 snapshot("4Favorites\(screenshotEndingName)")