Skip to content

Commit

Permalink
Ensure light mode snapshots are ordered before dark
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Oct 31, 2021
1 parent a61e3fc commit 216fe7b
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions UITests/Sources/AppStoreSnapshotUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -18,29 +18,25 @@ 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()
}

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 {
Expand Down Expand Up @@ -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")
Expand All @@ -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 {
Expand Down

0 comments on commit 216fe7b

Please sign in to comment.