mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 14:46:56 +02:00
Add sunset banners guiding users to install Element X when registering against a server with MAS. (#7890)
This commit is contained in:
+14
@@ -30,6 +30,9 @@ class AuthenticationServerSelectionUITests: MockScreenTestCase {
|
||||
|
||||
let dismissButton = app.buttons["dismissButton"]
|
||||
XCTAssertTrue(dismissButton.exists, "The dismiss button should be shown during modal presentation.")
|
||||
|
||||
let downloadBanner = app.buttons["sunsetBanners"]
|
||||
XCTAssertFalse(downloadBanner.exists, "The sunset banners should not be shown when registering against a legacy homeserver.")
|
||||
}
|
||||
|
||||
func testLoginState() {
|
||||
@@ -76,4 +79,15 @@ class AuthenticationServerSelectionUITests: MockScreenTestCase {
|
||||
let confirmButton = app.buttons["confirmButton"]
|
||||
XCTAssertEqual(confirmButton.label, VectorL10n.next, "The confirm button should say Next when not in modal presentation.")
|
||||
}
|
||||
|
||||
func testSunsetBanners() {
|
||||
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.mas.title)
|
||||
|
||||
let downloadBanner = app.buttons["sunsetBanners"]
|
||||
XCTAssertTrue(downloadBanner.exists, "The sunset banners should be shown when registering against a homeserver with MAS.")
|
||||
|
||||
let confirmButton = app.buttons["confirmButton"]
|
||||
XCTAssertTrue(confirmButton.exists, "The confirm button should always be shown.")
|
||||
XCTAssertFalse(confirmButton.isEnabled, "The confirm button should be disabled when there is an error.")
|
||||
}
|
||||
}
|
||||
|
||||
+27
-3
@@ -24,7 +24,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
|
||||
@MainActor func testErrorMessage() async throws {
|
||||
// Given a new instance of the view model.
|
||||
XCTAssertNil(context.viewState.footerErrorMessage, "There should not be an error message for a new view model.")
|
||||
XCTAssertNil(context.viewState.footerError, "There should not be an error message for a new view model.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown.")
|
||||
|
||||
// When an error occurs.
|
||||
@@ -32,7 +32,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
viewModel.displayError(.footerMessage(message))
|
||||
|
||||
// Then the footer should now be showing an error.
|
||||
XCTAssertEqual(context.viewState.footerErrorMessage, message, "The error message should be stored.")
|
||||
XCTAssertEqual(context.viewState.footerError, .message(message), "The error message should be stored.")
|
||||
XCTAssertTrue(context.viewState.isShowingFooterError, "There should be an error shown.")
|
||||
|
||||
// And when clearing the error.
|
||||
@@ -42,7 +42,31 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
await Task.yield()
|
||||
|
||||
// Then the error message should now be removed.
|
||||
XCTAssertNil(context.viewState.footerErrorMessage, "The error message should have been cleared.")
|
||||
XCTAssertNil(context.viewState.footerError, "The error message should have been cleared.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown anymore.")
|
||||
}
|
||||
|
||||
@MainActor func testSunsetBanner() async throws {
|
||||
// Given a new instance of the view model.
|
||||
XCTAssertNil(context.viewState.footerError, "There should not be an error for a new view model.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown.")
|
||||
|
||||
// When an error occurs.
|
||||
let message = "Unable to contact server."
|
||||
viewModel.displayError(.requiresReplacementApp)
|
||||
|
||||
// Then the footer should now be showing an error.
|
||||
XCTAssertEqual(context.viewState.footerError, .sunsetBanner, "The banner should be shown.")
|
||||
XCTAssertTrue(context.viewState.isShowingFooterError, "There should be an error shown.")
|
||||
|
||||
// And when clearing the error.
|
||||
context.send(viewAction: .clearFooterError)
|
||||
|
||||
// Wait for the action to spawn a Task on the main actor as the Context protocol doesn't support actors.
|
||||
await Task.yield()
|
||||
|
||||
// Then the error message should now be removed.
|
||||
XCTAssertNil(context.viewState.footerError, "The error should have been cleared.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown anymore.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user