forked from zelo72/mastodon-ios
chore: add domain and update guide for the snapshot UITest
This commit is contained in:
parent
633d1ae62a
commit
9c92f290a5
|
@ -39,6 +39,8 @@ TEST_RUNNER_email='<Email>' \
|
|||
-scheme 'Mastodon - Snapshot' \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max' \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 8 Plus' \
|
||||
-destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (5th generation)' \
|
||||
-testPlan 'AppStoreSnapshotTestPlan' \
|
||||
-only-testing:MastodonUITests/MastodonUISnapshotTests/testSignInAccount
|
||||
```
|
||||
|
@ -48,8 +50,14 @@ UITest may running silent. Open the Simulator.app to make the device display.
|
|||
|
||||
#### Take and extract snapshots
|
||||
```zsh
|
||||
# setup magic status bar
|
||||
xcrun simctl status_bar 'iPhone 13 Pro Max' override --time "9:41" --batteryState charged --batteryLevel 100
|
||||
xcrun simctl status_bar 'iPhone 8 Plus' override --time "9:41" --batteryState charged --batteryLevel 100
|
||||
xcrun simctl status_bar 'iPad Pro (12.9-inch) (5th generation)' override --time "9:41" --batteryState charged --batteryLevel 100
|
||||
|
||||
# take snapshots
|
||||
TEST_RUNNER_username_snapshot='Gargron' \
|
||||
TEST_RUNNER_domain='<domain.com>' \
|
||||
TEST_RUNNER_username_snapshot='username@domain.com' \
|
||||
xcodebuild \
|
||||
test \
|
||||
-derivedDataPath '~/Downloads/MastodonBuild/Derived' \
|
||||
|
@ -57,6 +65,8 @@ TEST_RUNNER_username_snapshot='Gargron' \
|
|||
-scheme 'Mastodon - Snapshot' \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max' \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 8 Plus' \
|
||||
-destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (5th generation)' \
|
||||
-testPlan 'AppStoreSnapshotTestPlan' \
|
||||
-only-testing:MastodonUITests/MastodonUISnapshotTests/testSnapshot
|
||||
|
||||
|
|
|
@ -197,16 +197,24 @@ extension MastodonUISnapshotTests {
|
|||
|
||||
// Please check the Documentation/Snapshot.md and run this test case in the command line
|
||||
func testSignInAccount() async throws {
|
||||
guard let domain = ProcessInfo.processInfo.environment["domain"] else {
|
||||
fatalError("env 'domain' missing")
|
||||
}
|
||||
guard let email = ProcessInfo.processInfo.environment["email"] else {
|
||||
fatalError("env 'email' missing")
|
||||
}
|
||||
guard let password = ProcessInfo.processInfo.environment["password"] else {
|
||||
fatalError("env 'password' missing")
|
||||
}
|
||||
try await signInApplication(email: email, password: password)
|
||||
try await signInApplication(
|
||||
domain: domain,
|
||||
email: email,
|
||||
password: password
|
||||
)
|
||||
}
|
||||
|
||||
func signInApplication(
|
||||
domain: String,
|
||||
email: String,
|
||||
password: String
|
||||
) async throws {
|
||||
|
@ -238,14 +246,14 @@ extension MastodonUISnapshotTests {
|
|||
domainTextField.tap()
|
||||
// Skip system keyboard swipe input guide
|
||||
skipKeyboardSwipeInputGuide(app: app)
|
||||
domainTextField.typeText("mastodon.social")
|
||||
domainTextField.typeText(domain)
|
||||
XCUIApplication().keyboards.buttons["Done"].firstMatch.tap()
|
||||
|
||||
// wait searching
|
||||
try await Task.sleep(nanoseconds: .second * 3)
|
||||
|
||||
// tap server
|
||||
let cell = app.cells.containing(.staticText, identifier: "mastodon.social").firstMatch
|
||||
let cell = app.cells.containing(.staticText, identifier: domain).firstMatch
|
||||
XCTAssert(cell.waitForExistence(timeout: 5))
|
||||
cell.tap()
|
||||
|
||||
|
|
Loading…
Reference in New Issue