Fix the UI tests. (#4085)
* Compile errors 😬
* Update server selection snapshots.
The default footer string has changed.
* Remove the TemplateScreen UI tests.
We use preview tests for snapshots now, UI tests are for flow coordinators.
* Add the same looping on the OIDC UI test (but disable the test in the end).
* Run UI tests separately for iPhone and iPad.
GitHub runners don't seem to have enough memory to handle 2 simulators at once.
This commit is contained in:
@@ -98,7 +98,13 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
func testSelectingOIDCServer() {
|
||||
// Disabled for now as the looping isn't 100% fool-proof and we have OIDC on the integration tests
|
||||
// so this mock version doesn't really add anything to the tests as a whole.
|
||||
func disabled_testSelectingOIDCServer() {
|
||||
// Allow this test to run for longer to help with the loop whilst waiting to resolve the
|
||||
// webcredentials for the Web Authentication Session (see below).
|
||||
executionTimeAllowance = 300
|
||||
|
||||
// Given the authentication flow.
|
||||
let app = Application.launch(.authenticationFlow)
|
||||
|
||||
@@ -111,11 +117,31 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
||||
// Server Selection: Clear the default, enter OIDC server and continue.
|
||||
app.textFields[A11yIdentifiers.changeServerScreen.server].clearAndTypeText("company.com\n", app: app)
|
||||
|
||||
// Server Confirmation: Tap continue button
|
||||
app.buttons[A11yIdentifiers.serverConfirmationScreen.continue].tap()
|
||||
|
||||
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
|
||||
XCTAssertTrue(springboard.staticTexts["“ElementX” Wants to Use “company.com” to Sign In"].waitForExistence(timeout: 4),
|
||||
"The web authentication prompt should be shown after selecting a homeserver with OIDC.")
|
||||
let wasAlertText = springboard.staticTexts["“ElementX” Wants to Use “company.com” to Sign In"]
|
||||
|
||||
// On a fresh simulator the webcredentials association is sometimes slow to be resolved.
|
||||
// This results in an error alert being shown instead of the Web Authentication Session alert.
|
||||
// Keep looping on the Continue button for ~5 minutes until the Authentication Session is happy.
|
||||
var remainingAttempts = 30
|
||||
while !wasAlertText.exists {
|
||||
// Server Confirmation: Tap continue button
|
||||
app.buttons[A11yIdentifiers.serverConfirmationScreen.continue].tap()
|
||||
|
||||
if wasAlertText.waitForExistence(timeout: 10) {
|
||||
break
|
||||
}
|
||||
|
||||
remainingAttempts -= 1
|
||||
if remainingAttempts <= 0 {
|
||||
XCTFail("Failed to present the web authentication session.")
|
||||
}
|
||||
|
||||
if app.alerts.count > 0 {
|
||||
app.alerts.firstMatch.buttons["OK"].tap()
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertTrue(wasAlertText.exists, "The web authentication prompt should be shown after selecting a homeserver with OIDC.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,15 @@ class PollFormScreenUITests: XCTestCase {
|
||||
func testFilledPoll() async throws {
|
||||
let app = Application.launch(.createPoll)
|
||||
let questionTextField = app.textFields[A11yIdentifiers.pollFormScreen.question]
|
||||
questionTextField.tapCenter()
|
||||
questionTextField.tap(.center)
|
||||
questionTextField.typeText("Do you like polls?")
|
||||
|
||||
let option1TextField = app.textFields[A11yIdentifiers.pollFormScreen.optionID(0)]
|
||||
option1TextField.tapCenter()
|
||||
option1TextField.tap(.center)
|
||||
option1TextField.typeText("Yes")
|
||||
|
||||
let option2TextField = app.textFields[A11yIdentifiers.pollFormScreen.optionID(1)]
|
||||
option2TextField.tapCenter()
|
||||
option2TextField.tap(.center)
|
||||
option2TextField.typeText("No")
|
||||
|
||||
// Dismiss the keyboard
|
||||
|
||||
@@ -23,7 +23,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
try await Task.sleep(for: .seconds(1))
|
||||
try await app.assertScreenshot(step: 2)
|
||||
|
||||
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions].tapCenter()
|
||||
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions].tap(.center)
|
||||
try await app.assertScreenshot(step: 3)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7f41fca4268f52cffb50d6611762b3afe15074d56edd4dcc169dc48d4f4703aa
|
||||
size 178019
|
||||
oid sha256:09790b253032a3cba0bb2e3d0185239f314a9ca5261f222a8f206fec6c5b9803
|
||||
size 166204
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2622cc5aa6802a0b33ac982b327a1cfeb51f082509188316801526a5bd3b144f
|
||||
size 185421
|
||||
oid sha256:292478daac4382c9fb63766daa92e8277656ccabb46ed9780abe88ffc5c32a94
|
||||
size 163034
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03ec96c3117b93b21537a3e6a64f0b609722820d0fb967056adf2d4fabd6d0bb
|
||||
size 104825
|
||||
oid sha256:f1792419ba4926084b1862ed660385c9a288c30d5e819c041a7d203a133f0b7d
|
||||
size 92973
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17c71fda8d1494f7fc67b51b304f77f53eba92ca19153aff3a4468f3fa6add80
|
||||
size 116342
|
||||
oid sha256:48bafe417ca3f7997f59592d8aa297faa7f0ddf6e0e9281513f835f77bba2670
|
||||
size 97386
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3a08af0ee7b494b7d1d3932141c743d1e0700e4cbb734fb66abd72696472bf12
|
||||
size 72787
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:569e5ddc8cc188045103a62124f65f1ad550ee8b52b9d0f56b3692d00497dca3
|
||||
size 70422
|
||||
@@ -64,4 +64,3 @@ targets:
|
||||
- path: ../../ElementX/Sources/Other/Extensions/XCUIElement.swift
|
||||
- path: ../../ElementX/Sources/UITests/UITestsScreenIdentifier.swift
|
||||
- path: ../../ElementX/Sources/UITests/UITestsSignalling.swift
|
||||
- path: ../../Tools/Scripts/Templates/SimpleScreenExample/Tests/UI
|
||||
|
||||
Reference in New Issue
Block a user