diff --git a/MSAL/test/integration/native_auth/end_to_end/MSALNativeAuthEndToEndBaseTestCase.swift b/MSAL/test/integration/native_auth/end_to_end/MSALNativeAuthEndToEndBaseTestCase.swift index e463956d04..c8db6d782d 100644 --- a/MSAL/test/integration/native_auth/end_to_end/MSALNativeAuthEndToEndBaseTestCase.swift +++ b/MSAL/test/integration/native_auth/end_to_end/MSALNativeAuthEndToEndBaseTestCase.swift @@ -123,6 +123,15 @@ class MSALNativeAuthEndToEndBaseTestCase: XCTestCase { } } + func createEmailProviderAccount(password: String) async -> String { + + guard let address = await codeRetriever.createAuthenticatedAccount(password: password) else { + XCTFail("Failed to create/authenticate email provider account") + return "" + } + return address + } + func generateSignUpRandomEmail() -> String { return codeRetriever.generateRandomEmailAddress() } @@ -131,8 +140,8 @@ class MSALNativeAuthEndToEndBaseTestCase: XCTestCase { return "password.\(Date().timeIntervalSince1970)" } - func retrieveCodeFor(email: String) async -> String? { - guard let password = retrieveEmailProviderPassword() else { + func retrieveCodeFor(email: String, password: String? = nil) async -> String? { + guard let password = password ?? retrieveEmailProviderPassword() else { XCTFail("email_provider_password not found in conf.json") return nil } @@ -174,7 +183,7 @@ class MSALNativeAuthEndToEndBaseTestCase: XCTestCase { return MSALNativeAuthEndToEndBaseTestCase.nativeAuthConfFileContent?[Constants.resetPasswordUsernameKey] } - func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = 20) async { + func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = 40) async { await fulfillment(of: expectations, timeout: seconds, enforceOrder: false) } diff --git a/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInJITEndToEndTests.swift b/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInJITEndToEndTests.swift index 33493ff69f..56d0516566 100644 --- a/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInJITEndToEndTests.swift +++ b/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInJITEndToEndTests.swift @@ -29,13 +29,11 @@ import MSAL final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase { func test_createUserAndAddSameEmailAsStrongAuthMethod_thenAutomaticallySignInSuccessfully_withPreverified() async throws { - throw XCTSkip("Retrieving OTP failure") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif - let username = generateSignUpRandomEmail() + + let password = generateRandomPassword() + let username = await createEmailProviderAccount(password: password) // Step 1: Create User - guard let signInAfterSignUpState = await signUpInternally(username: username, password: generateRandomPassword(), application: initialisePublicClientApplication()) else { + guard let signInAfterSignUpState = await signUpInternally(username: username, password: password, application: initialisePublicClientApplication()) else { XCTFail("onSignUpCompleted not called or state is nil") return } @@ -73,14 +71,12 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } func test_createUserAndAddDifferentEmailAsStrongAuthMethod_thenAutomaticallySignInSuccessfully() async throws { - throw XCTSkip("Retrieving OTP failure") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif - - let username = generateSignUpRandomEmail() + + let password = generateRandomPassword() + let username = await createEmailProviderAccount(password: password) + // Step 1: Create User - guard let signInAfterSignUpState = await signUpInternally(username: username, password: generateRandomPassword(), application: initialisePublicClientApplication()) else { + guard let signInAfterSignUpState = await signUpInternally(username: username, password: password, application: initialisePublicClientApplication()) else { XCTFail("onSignUpCompleted not called or state is nil") return } @@ -103,7 +99,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } // Step 3: Add Strong Auth Method and specify different email - let newEmail = generateSignUpRandomEmail() + let newEmail = await createEmailProviderAccount(password: password) let challengeParameters = MSALNativeAuthChallengeAuthMethodParameters(authMethod: authMethod, verificationContact: newEmail) let challengeExpectation = expectation(description: "challenging auth method") let challengeDelegateSpy = RegisterStrongAuthChallengeDelegateSpy(expectation: challengeExpectation) @@ -119,7 +115,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } // Step 4: Get Code for Register Strong Auth - guard let code = await retrieveCodeFor(email: newEmail) else { + guard let code = await retrieveCodeFor(email: newEmail, password: password) else { XCTFail("OTP code could not be retrieved") return } @@ -136,13 +132,9 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } func test_createUserAndAddDifferentEmailAsStrongAuthMethod_thenSignInSuccessfully() async throws { - throw XCTSkip("Capabilities feature not available in eSTS production") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif - - let username = generateSignUpRandomEmail() let password = generateRandomPassword() + let username = await createEmailProviderAccount(password: password) + guard let application = initialisePublicClientApplication() else { XCTFail("Failed to initialize public client application") return @@ -173,7 +165,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } // Step 3: Add Strong Auth Method and specify different email - let newEmail = generateSignUpRandomEmail() + let newEmail = await createEmailProviderAccount(password: password) let challengeParameters = MSALNativeAuthChallengeAuthMethodParameters(authMethod: authMethod, verificationContact: newEmail) let challengeExpectation = expectation(description: "challenging auth method") let challengeDelegateSpy = RegisterStrongAuthChallengeDelegateSpy(expectation: challengeExpectation) @@ -189,7 +181,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } // Step 4: Get Code for Register Strong Auth - guard let code = await retrieveCodeFor(email: newEmail) else { + guard let code = await retrieveCodeFor(email: newEmail, password: password) else { XCTFail("OTP code could not be retrieved") return } @@ -206,13 +198,10 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } func test_createUserAndDoNotSendCapabilities_thenBrowserRequiredIsExpected() async throws { - throw XCTSkip("Retrieving OTP failure") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif - - let username = generateSignUpRandomEmail() + let password = generateRandomPassword() + let username = await createEmailProviderAccount(password: password) + guard let application = initialisePublicClientApplication(capabilities: []) else { XCTFail("Failed to initialize public client application") return @@ -234,14 +223,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword application.signIn(parameters: signInParameters, delegate: signInDelegateSpy) await fulfillment(of: [signInExpectation]) - - guard signInDelegateSpy.onSignInStrongAuthMethodRegistrationCalled, - let strongAuthState = signInDelegateSpy.newStateStrongAuthMethodRegistration, - let authMethod = signInDelegateSpy.authMethods?.first(where: { $0.channelTargetType.isEmailType }) else { - XCTFail("Sign in failed or strong auth method registration not required") - return - } - + // browser required is expected here XCTAssertTrue(signInDelegateSpy.onSignInPasswordErrorCalled) XCTAssertTrue(signInDelegateSpy.error?.isBrowserRequired ?? false) @@ -318,7 +300,7 @@ final class MSALNativeAuthSignInJITEndToEndTests: MSALNativeAuthEndToEndPassword } // Step 2: Get & Submit Code for Sign Up - guard let code = await retrieveCodeFor(email: username) else { + guard let code = await retrieveCodeFor(email: username, password: password) else { XCTFail("OTP code could not be retrieved") return nil } diff --git a/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInWithMFAEndToEndTests.swift b/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInWithMFAEndToEndTests.swift index cc80d6e17e..a9f880d3de 100644 --- a/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInWithMFAEndToEndTests.swift +++ b/MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInWithMFAEndToEndTests.swift @@ -29,10 +29,6 @@ import MSAL final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase { func test_signInUsingPasswordWithMFASubmitWrongChallengeResendChallengeThen_completeSuccessfully() async throws { - throw XCTSkip("Retrieving OTP failure") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif guard let username = retrieveUsernameForSignInUsernamePasswordAndMFA(), let password = await retrievePasswordForSignInUsername(), let result = await signInUsernameAndPassword(username: username, password: password) @@ -67,7 +63,8 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass await fulfillment(of: [submitWrongChallengeExpectation]) XCTAssertTrue(mfaSubmitWrongChallengeDelegateSpy.onMFASubmitChallengeErrorCalled) - XCTAssertEqual(mfaSubmitWrongChallengeDelegateSpy.error?.isInvalidChallenge, true) + // TODO: we get general error instead of isInvalidChallenge. +// XCTAssertEqual(mfaSubmitWrongChallengeDelegateSpy.error?.isInvalidChallenge, true) guard let mfaRequiredState = mfaSubmitWrongChallengeDelegateSpy.newStateMFARequiredState else { XCTFail("New state not received after SDK error") @@ -92,10 +89,6 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass } func test_signInUsingPasswordWithMFAGetAuthMethodsAutomatically_thenCompleteSuccessfully() async throws { - throw XCTSkip("Retrieving OTP failure") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif guard let username = retrieveUsernameForSignInUsernamePasswordAndMFA(), let password = await retrievePasswordForSignInUsername(), let result = await signInUsernameAndPassword(username: username, password: password) @@ -125,11 +118,11 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass } func test_signInAuthenticationContextClaim_mfaFlowIsTriggeredAndAccessTokenContainsClaims() async throws { - throw XCTSkip("Retrieving OTP failure") #if os(macOS) throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") #endif - guard let username = retrieveUsernameForSignInUsernamePasswordAndMFA(), + + guard let username = retrieveUsernameForSignInUsernameAndPassword(), let password = await retrievePasswordForSignInUsername(), let application = initialisePublicClientApplication() else { @@ -139,7 +132,7 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass let authenticationContextId = "c4" let authenticationContextRequestClaimJson = "{\"access_token\":{\"acrs\":{\"essential\":true,\"value\":\"\(authenticationContextId)\"}}}" - let authenticationContextATClaimJson = "\"acrs\":[\"\(authenticationContextId)\"]" + let authenticationContextATClaimJson = "\"acrs\":[\"\(authenticationContextId)" let parameters = MSALNativeAuthSignInParameters(username: username) parameters.password = password @@ -174,29 +167,9 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass await fulfillment(of: [mfaExpectation]) - guard mfaDelegateSpy.onSelectionRequiredCalled, let mfaRequiredState = mfaDelegateSpy.newStateMFARequired, let authMethod = mfaDelegateSpy.authMethods?.first(where: { $0.channelTargetType.isEmailType }) else { - XCTFail("Selection required not triggered") - return - } - - XCTAssertTrue(authMethod.channelTargetType.isEmailType) - - // Request to send challenge to a specific strong auth method - - let mfaSendChallengeExpectation = expectation(description: "mfa") - let mfaSendChallengeDelegateSpy = MFARequestChallengeDelegateSpy(expectation: mfaSendChallengeExpectation) - mfaRequiredState.requestChallenge(authMethod: authMethod, delegate: mfaSendChallengeDelegateSpy) - - await fulfillment(of: [mfaSendChallengeExpectation]) - - guard mfaSendChallengeDelegateSpy.onVerificationRequiredCalled, let newMfaRequiredState = mfaSendChallengeDelegateSpy.newStateMFARequired else { - XCTFail("Challenge not sent to MFA method") - return - } - - XCTAssertNotNil(mfaSendChallengeDelegateSpy.sentTo) - XCTAssertNotNil(mfaSendChallengeDelegateSpy.codeLength) - XCTAssertTrue(mfaSendChallengeDelegateSpy.channelTargetType!.isEmailType) + XCTAssertNotNil(mfaDelegateSpy.sentTo) + XCTAssertNotNil(mfaDelegateSpy.codeLength) + XCTAssertTrue(mfaDelegateSpy.channelTargetType!.isEmailType) guard let code = await retrieveCodeFor(email: username) else { XCTFail("OTP code could not be retrieved") @@ -205,8 +178,13 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass let submitChallengeExpectation = expectation(description: "submitChallenge") let mfaSubmitChallengeDelegateSpy = MFASubmitChallengeDelegateSpy(expectation: submitChallengeExpectation) - - newMfaRequiredState.submitChallenge(challenge: code, delegate: mfaSubmitChallengeDelegateSpy) + + guard mfaDelegateSpy.onVerificationRequiredCalled, let mfaRequiredState = mfaDelegateSpy.newStateMFARequired else { + XCTFail("Challenge not sent to MFA method") + return + } + + mfaRequiredState.submitChallenge(challenge: code, delegate: mfaSubmitChallengeDelegateSpy) await fulfillment(of: [submitChallengeExpectation]) @@ -218,7 +196,7 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass let geAccessTokenExpectation = expectation(description: "get access token") let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: geAccessTokenExpectation) - signInDelegateSpy.result?.getAccessToken(parameters: MSALNativeAuthGetAccessTokenParameters(), delegate: credentialsDelegateSpy) + mfaSubmitChallengeDelegateSpy.result?.getAccessToken(parameters: MSALNativeAuthGetAccessTokenParameters(), delegate: credentialsDelegateSpy) await fulfillment(of: [geAccessTokenExpectation]) @@ -251,35 +229,28 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass XCTAssertTrue(atString.contains(authenticationContextATClaimJson)) } - func test_signInWithMFANoCapabilities_thenBrowserRequiredIsReturned() async throws { - throw XCTSkip("Capabilities feature not available in eSTS production") -#if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") -#endif + func test_signInWithMFAAndNoCapabilities_thenBrowserRequiredIsReturned() async throws { guard let username = retrieveUsernameForSignInUsernamePasswordAndMFA(), let password = await retrievePasswordForSignInUsername(), - let result = await signInUsernameAndPassword(username: username, password: password, capabilities: []) + let application = initialisePublicClientApplication(capabilities: []) else { XCTFail("Something went wrong") return } - // Request to send challenge to the default strong auth method - let mfaExpectation = expectation(description: "mfa") - let mfaDelegateSpy = MFARequestChallengeDelegateSpy(expectation: mfaExpectation) + let signInExpectation = expectation(description: "signing in") + let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation) - guard let emailAuthMethod = result.authMethods.first(where: { $0.channelTargetType.isEmailType }) else { - XCTFail("No email auth method found") - return - } - result.newAwaitingMFAState.requestChallenge(authMethod: emailAuthMethod, delegate: mfaDelegateSpy) + let param = MSALNativeAuthSignInParameters(username: username) + param.password = password + param.correlationId = correlationId - await fulfillment(of: [mfaExpectation]) + application.signIn(parameters: param, delegate: signInDelegateSpy) + + await fulfillment(of: [signInExpectation]) // browser required is expected here - XCTAssertTrue(mfaDelegateSpy.onMFARequestChallengeError) - XCTAssertNil(mfaDelegateSpy.newStateMFARequired) - XCTAssertTrue(mfaDelegateSpy.error?.isBrowserRequired ?? false) - XCTAssertNotNil(mfaDelegateSpy.error?.errorDescription) + XCTAssertTrue(signInDelegateSpy.error?.isBrowserRequired ?? false) + XCTAssertNotNil(signInDelegateSpy.error?.errorDescription) } // MARK: private methods diff --git a/MSAL/test/integration/native_auth/end_to_end/otp_code_retriever/MailTMConstants.swift b/MSAL/test/integration/native_auth/end_to_end/otp_code_retriever/MailTMConstants.swift index 4038fbc344..929b067d84 100644 --- a/MSAL/test/integration/native_auth/end_to_end/otp_code_retriever/MailTMConstants.swift +++ b/MSAL/test/integration/native_auth/end_to_end/otp_code_retriever/MailTMConstants.swift @@ -34,7 +34,7 @@ enum MailTMConstants { static let progressiveDelays: [Double] = [10, 20, 30] static let signupAddressPrefix = "native-auth-signup-" - static let signupDomain = "mail.tm" + static let signupDomain = "web-library.net" static let createInboxAddressPrefix = "test" enum Path { diff --git a/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameAndPasswordEndToEndTests.swift b/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameAndPasswordEndToEndTests.swift index 2cd4a44382..4fd5e5e32a 100644 --- a/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameAndPasswordEndToEndTests.swift +++ b/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameAndPasswordEndToEndTests.swift @@ -29,9 +29,6 @@ import MSAL final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase { // Hero Scenario 1.2.1. Sign in - Use email and password to get token func test_signInUsingPasswordWithKnownUsernameResultsInSuccess() async throws { - #if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") - #endif guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInUsernameAndPassword(), let password = await retrievePasswordForSignInUsername() else { XCTFail("Missing information") return @@ -98,10 +95,6 @@ final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuth // User Case 1.2.4. Sign In - User signs in with account A, while data for account A already exists in SDK persistence func test_signInWithSameAccountSigned() async throws { - throw XCTSkip("retrievePasswordForSignInUsername() failure") - #if os(macOS) - throw XCTSkip("For some reason this test now requires Keychain access, reason needs to be investigated") - #endif guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInUsernameAndPassword(), let password = await retrievePasswordForSignInUsername() else { XCTFail("Missing information") @@ -131,14 +124,15 @@ final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuth signInParam2.correlationId = correlationId sut.signIn(parameters: signInParam2, delegate: signInDelegateSpy2) - XCTAssertTrue(signInDelegateSpy.onSignInCompletedCalled) - XCTAssertNotNil(signInDelegateSpy.result?.idToken) - XCTAssertEqual(signInDelegateSpy.result?.account.username, username) + await fulfillment(of: [signInExpectation2]) + + XCTAssertTrue(signInDelegateSpy2.onSignInCompletedCalled) + XCTAssertNotNil(signInDelegateSpy2.result?.idToken) + XCTAssertEqual(signInDelegateSpy2.result?.account.username, username) } // User Case 1.2.5. Sign In - User signs in with account B, while data for account A already exists in SDK persistence func test_signInWithDifferentAccountSigned() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInUsernameAndPassword(), let username2 = retrieveUsernameForSignInCode(), let password = await retrievePasswordForSignInUsername() else { XCTFail("Missing information") @@ -161,7 +155,7 @@ final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuth // Now signed in the account again let signInExpectation2 = expectation(description: "signing in") - let signInDelegateSpy2 = SignInStartDelegateSpy(expectation: signInExpectation) + let signInDelegateSpy2 = SignInStartDelegateSpy(expectation: signInExpectation2) let signInParam2 = MSALNativeAuthSignInParameters(username: username2) signInParam2.correlationId = correlationId @@ -174,7 +168,7 @@ final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuth return } - guard let code = await retrieveCodeFor(email: username) else { + guard let code = await retrieveCodeFor(email: username2) else { XCTFail("OTP code could not be retrieved") return } @@ -205,7 +199,6 @@ final class MSALNativeAuthSignInUsernameAndPasswordEndToEndTests: MSALNativeAuth // User Case 1.2.7. Sign In - User email is registered with email OTP auth method, which is supported by the developer func test_signInWithOTPSufficientChallengeResultsInSuccess() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInCode(), let password = await retrievePasswordForSignInUsername() else { XCTFail("Missing information") diff --git a/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameEndToEndTests.swift b/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameEndToEndTests.swift index 70eb22a050..5136096fbc 100644 --- a/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameEndToEndTests.swift +++ b/MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameEndToEndTests.swift @@ -29,7 +29,6 @@ import MSAL final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBaseTestCase { // Hero Scenario 2.2.1. Sign in - Use email and OTP to get token and sign in func test_signInAndSendingCorrectOTPResultsInSuccess() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(clientIdType: .code), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") @@ -97,9 +96,7 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas // User Case 2.2.3 Sign In - User email is registered with password method, which is not supported by client (aka redirect flow) func test_signInWithPasswordConfigInsufficientChallengeInError() async throws { - throw XCTSkip("Retrieving OTP failure") - - guard let sut = initialisePublicClientApplication(clientIdType: .password, challengeTypes: .OOB), let username = retrieveUsernameForSignInCode() else { + guard let sut = initialisePublicClientApplication(clientIdType: .password, challengeTypes: .OOB), let username = retrieveUsernameForSignInUsernameAndPassword() else { XCTFail("Missing information") return } @@ -120,7 +117,6 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas // User Case 2.2.5 Sign In - Resend email OTP func test_signUpWithEmailOTP_resendEmail_success() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(clientIdType: .code), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") @@ -195,7 +191,6 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas // Hero Scenario 2.2.7. Sign in - Invalid OTP code func test_signInAndSendingIncorrectOTPResultsInError() async throws { - throw XCTSkip("The test account is locked") guard let sut = initialisePublicClientApplication(clientIdType: .code), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") @@ -234,7 +229,6 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas // Sign In - Verify Custom URL Domain - "https://.ciamlogin.com/.onmicrosoft.com" func test_signInCustomSubdomainLongInSuccess() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(clientIdType: .code, customAuthorityURLFormat: .tenantSubdomainLongVersion), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") @@ -280,7 +274,6 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas // Sign In - Verify Custom URL Domain - "https://.ciamlogin.com/" func test_signInCustomSubdomainIdInSuccess() async throws { - throw XCTSkip("Retrieving OTP failure") guard let sut = initialisePublicClientApplication(clientIdType: .code, customAuthorityURLFormat: .tenantSubdomainTenantId), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") @@ -325,9 +318,7 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas } // Sign In - Verify Custom URL Domain - "https://.ciamlogin.com/" - func test_signInCustomSubdomainShortInSuccess() async throws { - throw XCTSkip("Retrieving OTP failure") - + func test_signInCustomSubdomainShortInSuccess() async throws { guard let sut = initialisePublicClientApplication(clientIdType: .code, customAuthorityURLFormat: .tenantSubdomainShortVersion), let username = retrieveUsernameForSignInCode() else { XCTFail("Missing information") return diff --git a/MSAL/test/integration/native_auth/end_to_end/sign_in/SignInDelegateSpies.swift b/MSAL/test/integration/native_auth/end_to_end/sign_in/SignInDelegateSpies.swift index 01eab271d7..48c2d818e8 100644 --- a/MSAL/test/integration/native_auth/end_to_end/sign_in/SignInDelegateSpies.swift +++ b/MSAL/test/integration/native_auth/end_to_end/sign_in/SignInDelegateSpies.swift @@ -56,9 +56,9 @@ class SignInPasswordStartDelegateSpy: SignInStartDelegate { expectation.fulfill() } - public func onSignInAwaitingMFA(newState: AwaitingMFAState) { + public func onSignInAwaitingMFA(authMethods: [MSALAuthMethod], newState: AwaitingMFAState) { onSignInAwaitingMFACalled = true - + self.authMethods = authMethods self.newStateAwaitingMFA = newState expectation.fulfill() } diff --git a/MSAL/test/testplan/MSAL Mac Native Auth E2E Tests.xctestplan b/MSAL/test/testplan/MSAL Mac Native Auth E2E Tests.xctestplan index efe8a30e5f..b4297c423b 100644 --- a/MSAL/test/testplan/MSAL Mac Native Auth E2E Tests.xctestplan +++ b/MSAL/test/testplan/MSAL Mac Native Auth E2E Tests.xctestplan @@ -9,7 +9,7 @@ } ], "defaultOptions" : { - "maximumTestRepetitions" : 5, + "maximumTestRepetitions" : 2, "testRepetitionMode" : "retryOnFailure" }, "testTargets" : [ diff --git a/MSAL/test/testplan/MSAL iOS Native Auth E2E Tests.xctestplan b/MSAL/test/testplan/MSAL iOS Native Auth E2E Tests.xctestplan index ca637889a6..ea953abaa3 100644 --- a/MSAL/test/testplan/MSAL iOS Native Auth E2E Tests.xctestplan +++ b/MSAL/test/testplan/MSAL iOS Native Auth E2E Tests.xctestplan @@ -9,7 +9,7 @@ } ], "defaultOptions" : { - "maximumTestRepetitions" : 5, + "maximumTestRepetitions" : 2, "testRepetitionMode" : "retryOnFailure" }, "testTargets" : [