mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Fix the integration tests. (#4084)
* Fix logging/alerts during OIDC cancellation. - Cancelling from within the web view wasn't being handled since moving the UserIndicatorController into the presenter. - The WAS canceledLogin error code is also used when the system cancels the login. When the system cancels there's a failure reason included in the error. * Allow UI tests to tap on any point within a view. * Make the homeserver optional in integration tests. * Dismiss the keyboard after entering a username to reveal the password text field. Do the same after entering the password field too, just in case. * Add a loop while waiting for the WAS prompt to be shown.
This commit is contained in:
@@ -43,13 +43,17 @@ class OIDCAuthenticationPresenter: NSObject {
|
||||
// Check for user cancellation to avoid showing an alert in that instance.
|
||||
if let nsError = error as? NSError,
|
||||
nsError.domain == ASWebAuthenticationSessionErrorDomain,
|
||||
nsError.code == ASWebAuthenticationSessionError.canceledLogin.rawValue {
|
||||
nsError.code == ASWebAuthenticationSessionError.canceledLogin.rawValue,
|
||||
// If there's a failure reason then the cancellation wasn't made by the user.
|
||||
nsError.localizedFailureReason == nil {
|
||||
// No need to show an error here, just abort and return a failure.
|
||||
await authenticationService.abortOIDCLogin(data: oidcData)
|
||||
return .failure(.oidcError(.userCancellation))
|
||||
}
|
||||
|
||||
MXLog.error("Missing callback URL from the web authentication session.")
|
||||
let errorDescription = error.map(String.init(describing:)) ?? "Unknown error"
|
||||
MXLog.error("Missing callback URL from the web authentication session: \(errorDescription)")
|
||||
|
||||
userIndicatorController.alertInfo = AlertInfo(id: UUID())
|
||||
await authenticationService.abortOIDCLogin(data: oidcData)
|
||||
return .failure(.oidcError(.unknown))
|
||||
@@ -62,6 +66,9 @@ class OIDCAuthenticationPresenter: NSObject {
|
||||
switch await authenticationService.loginWithOIDCCallback(url) {
|
||||
case .success(let userSession):
|
||||
return .success(userSession)
|
||||
case .failure(.oidcError(.userCancellation)):
|
||||
// No need to show an error here, just return the failure.
|
||||
return .failure(.oidcError(.userCancellation))
|
||||
case .failure(let error):
|
||||
MXLog.error("Error occurred: \(error)")
|
||||
userIndicatorController.alertInfo = AlertInfo(id: UUID())
|
||||
|
||||
Reference in New Issue
Block a user