Mercurial > public > simoleon
comparison SimoleonScreenshots/SimoleonScreenshots.swift @ 139:a4aeca1ad34a
Fix random test crashes with Fastlane
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 16 Aug 2021 20:59:21 +0100 |
parents | f54d3dabb2d3 |
children | 4271fb5f69e2 |
comparison
equal
deleted
inserted
replaced
138:081f0857af51 | 139:a4aeca1ad34a |
---|---|
7 | 7 |
8 import XCTest | 8 import XCTest |
9 import CoreData | 9 import CoreData |
10 // Automate screenshots with Fastlane | 10 // Automate screenshots with Fastlane |
11 class SimoleonScreenshots: XCTestCase { | 11 class SimoleonScreenshots: XCTestCase { |
12 var screnshotEndingName = "" | 12 var screenshotEndingName = "" |
13 | 13 |
14 override func setUpWithError() throws { | 14 override func setUpWithError() throws { |
15 // This method is called before the invocation of each test method in the class. | 15 // This method is called before the invocation of each test method in the class. |
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 screnshotEndingName = "-force_landscapeleft" | 19 screenshotEndingName = "-force_landscapeleft" |
20 } | 20 } |
21 | 21 |
22 let app = XCUIApplication() | 22 let app = XCUIApplication() |
23 setupSnapshot(app) | 23 setupSnapshot(app) |
24 app.launch() | 24 app.launch() |
35 if UIDevice.current.userInterfaceIdiom == .pad { | 35 if UIDevice.current.userInterfaceIdiom == .pad { |
36 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() | 36 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() |
37 } | 37 } |
38 | 38 |
39 sleep(2) | 39 sleep(2) |
40 snapshot("1Launch\(screnshotEndingName)") | 40 snapshot("1Launch\(screenshotEndingName)") |
41 } | 41 } |
42 | 42 |
43 func testConvertAmountScreenshot() throws { | 43 func testConvertAmountScreenshot() throws { |
44 if UIDevice.current.userInterfaceIdiom == .pad { | 44 if UIDevice.current.userInterfaceIdiom == .pad { |
45 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() | 45 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() |
46 } | 46 } |
47 | 47 |
48 let conversionTextField = XCUIApplication().textFields["ConversionTextField"] | 48 let conversionTextField = XCUIApplication().textFields["ConversionTextField"] |
49 conversionTextField.tap() | 49 conversionTextField.tap() |
50 conversionTextField.typeText("1030.15\n") | 50 conversionTextField.typeText("1030.15\n") |
51 snapshot("2Conversion\(screnshotEndingName)") | 51 snapshot("2Conversion\(screenshotEndingName)") |
52 } | 52 } |
53 | 53 |
54 func testCurrencySelectorScreenshot() throws { | 54 func testCurrencySelectorScreenshot() throws { |
55 if UIDevice.current.userInterfaceIdiom == .pad { | 55 if UIDevice.current.userInterfaceIdiom == .pad { |
56 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() | 56 XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() |
57 } | 57 } |
58 | 58 |
59 XCUIApplication().scrollViews.buttons["OpenCurrencySelector"].tap() | 59 XCUIApplication().scrollViews.buttons["OpenCurrencySelector"].tap() |
60 snapshot("3CurrencySelector\(screnshotEndingName)") | 60 snapshot("3CurrencySelector\(screenshotEndingName)") |
61 } | 61 } |
62 | 62 |
63 func testFavoriteScreenshot() throws { | 63 func testFavoriteScreenshot() throws { |
64 if UIDevice.current.userInterfaceIdiom == .pad { | 64 if UIDevice.current.userInterfaceIdiom == .pad { |
65 XCUIApplication().tables["Sidebar"].buttons["NavigateToFavorites"].tap() | 65 XCUIApplication().tables["Sidebar"].buttons["NavigateToFavorites"].tap() |
67 XCUIApplication().tabBars.buttons.element(boundBy: 1).tap() | 67 XCUIApplication().tabBars.buttons.element(boundBy: 1).tap() |
68 } | 68 } |
69 | 69 |
70 sleep(1) | 70 sleep(1) |
71 | 71 |
72 snapshot("4Favorites\(screnshotEndingName)") | 72 snapshot("4Favorites\(screenshotEndingName)") |
73 } | 73 } |
74 } | 74 } |