// SIGN IN FOR A DEV WALK: Cinemas Dev on a walk simulator signed in to the dev Worker as this Mac's synthetic number // (from the standing simulators list), so the timed walks play the seeded object. The number and its code come from the // runner's environment (TEST_RUNNER_WALK_COTTON_PHONE, TEST_RUNNER_WALK_COTTON_CODE); the code is never written to // the log or a picture. Already signed in, it does nothing. import XCTest final class CinemasSignInDev: XCTestCase { @MainActor func testSignIn() throws { let environment = ProcessInfo.processInfo.environment let phone = try XCTUnwrap(environment["WALK_COTTON_PHONE"].flatMap { $0.isEmpty ? nil : $0 }, "WALK_COTTON_PHONE") let code = try XCTUnwrap(environment["WALK_COTTON_CODE"].flatMap { $0.isEmpty ? nil : $0 }, "WALK_COTTON_CODE") let app = XCUIApplication() app.launch() let you = app.descendants(matching: .any)["cinemas-tab-you"].firstMatch XCTAssertTrue(you.waitForExistence(timeout: 40)) you.tap() let card = app.descendants(matching: .any)["settings-card"].firstMatch XCTAssertTrue(card.waitForExistence(timeout: 10)) card.tap() let field = app.descendants(matching: .any)["home-customer-phone"].firstMatch guard field.waitForExistence(timeout: 10) else { // No number asked: signed in already. return } field.tap() field.typeText(phone) app.descendants(matching: .any)["home-customer-send"].firstMatch.tap() let codeField = app.descendants(matching: .any)["home-customer-code"].firstMatch XCTAssertTrue(codeField.waitForExistence(timeout: 120), "the code is asked") codeField.tap() codeField.typeText(code) let name = app.descendants(matching: .any)["home-customer-name"].firstMatch if name.exists { name.tap() name.typeText("Walk Member") } let confirm = app.descendants(matching: .any)["home-customer-confirm"].firstMatch if confirm.waitForExistence(timeout: 5), confirm.isHittable { confirm.tap() } XCTAssertTrue(field.waitForNonExistence(timeout: 60), "signed in") // The object's first sync: Home's Featured appears. app.descendants(matching: .any)["cinemas-tab-home"].firstMatch.tap() XCTAssertTrue(app.descendants(matching: .any)["cinemas-featured-play"].firstMatch.waitForExistence(timeout: 180), "the seeded films on Home") } }