From 216fe7b97dcd83ec5aae81c84ede7b26386dfa44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Sun, 31 Oct 2021 14:52:39 +0100 Subject: [PATCH] Ensure light mode snapshots are ordered before dark --- UITests/Sources/AppStoreSnapshotUITests.swift | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/UITests/Sources/AppStoreSnapshotUITests.swift b/UITests/Sources/AppStoreSnapshotUITests.swift index cffff7c..aa4c9e4 100644 --- a/UITests/Sources/AppStoreSnapshotUITests.swift +++ b/UITests/Sources/AppStoreSnapshotUITests.swift @@ -7,7 +7,7 @@ import XCTest class AppStoreSnapshotUITests: XCTestCase { let app = XCUIApplication() - var uiMode: String = "light" + var uiMode: String = "1-light" override func setUp() { super.setUp() @@ -18,12 +18,11 @@ class AppStoreSnapshotUITests: XCTestCase { app.launchArguments += ["UI_TESTS"] app.launch() - uiMode = app.launchArguments.contains("DARK_MODE") ? "dark" : "light" + uiMode = app.launchArguments.contains("DARK_MODE") ? "2-dark" : "1-light" XCUIDevice.shared.orientation = UIDevice.current.userInterfaceIdiom == .pad ? .landscapeLeft : .portrait } func testTakeAppStoreScreenshots() { - var snapshotNum = 1 let faqText = localizedString(key: "SETTINGS.FAQ_BUTTON.TITLE") if let faqDoneButton = app.navigationBars[faqText].buttons.allElementsBoundByIndex.first { faqDoneButton.tap() @@ -31,16 +30,13 @@ class AppStoreSnapshotUITests: XCTestCase { if UIDevice.current.userInterfaceIdiom == .pad { app.swipeUp() - snapshot("\(snapshotNum)-Settings-\(uiMode)") - snapshotNum += 1 + snapshot("\(uiMode)-1-Settings") } else { - snapshot("\(snapshotNum)-Settings-Top-\(uiMode)") - snapshotNum += 1 + snapshot("\(uiMode)-1a-Settings-Top") app.swipeUp() - snapshot("\(snapshotNum)-Settings-Bottom-\(uiMode)") - snapshotNum += 1 + snapshot("\(uiMode)-1b-Settings-Bottom") } if UIDevice.current.userInterfaceIdiom == .phone { @@ -74,9 +70,8 @@ class AppStoreSnapshotUITests: XCTestCase { openingPrayerExpectation.fulfill() } - waitForExpectations(timeout: 30, handler: nil) - snapshot("\(snapshotNum)-Opening-Prayer-\(uiMode)") - snapshotNum += 1 + waitForExpectations(timeout: 60, handler: nil) + snapshot("\(uiMode)-2-Opening-Prayer") // Wait until going to Ruku let rukuExpectation = expectation(description: "Going to Ruku Screenshot") @@ -89,9 +84,8 @@ class AppStoreSnapshotUITests: XCTestCase { rukuExpectation.fulfill() } - waitForExpectations(timeout: 30, handler: nil) - snapshot("\(snapshotNum)-Ruku-\(uiMode)") - snapshotNum += 1 + waitForExpectations(timeout: 60, handler: nil) + snapshot("\(uiMode)-3-Ruku") } private func localizedString(key: String) -> String {