From cae044729c424872ab7c507a45dabe2d44845ca8 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Mon, 3 Feb 2025 01:06:32 -0500 Subject: [PATCH 01/12] port some ui tests that were previously in adal --- common | 2 +- .../broker/crosscloud/TestCase1400731.java | 151 ++++++++++++ .../testpass/broker/foci/TestCase833544.java | 232 ++++++++++++++++++ .../testpass/broker/mdm/TestCase831126.java | 186 ++++++++++++++ .../broker/nonjoined/TestCase2139526.java | 142 +++++++++++ .../broker/nonjoined/TestCase3139972.java | 129 ++++++++++ .../broker/nonjoined/TestCase833546.java | 126 ++++++++++ .../broker/nonjoined/TestCase833553.java | 145 +++++++++++ .../broker/nonjoined/TestCase850455.java | 11 +- .../testpass/broker/wpj/TestCase831655.java | 80 ++++++ .../testpass/broker/wpj/TestCase833547.java | 88 +++++++ .../testpass/broker/wpj/TestCase833561.java | 88 +++++++ 12 files changed, 1375 insertions(+), 5 deletions(-) create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase2139526.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase831655.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java diff --git a/common b/common index 943fc16252..e94aee0cbe 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 943fc162520b6c39b97cc59fb44e7f7038429f3e +Subproject commit e94aee0cbea66e7a8b7537479f65d7a194aa410a diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java new file mode 100644 index 0000000000..7a3c1db853 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.crosscloud; + +import android.text.TextUtils; + +import androidx.annotation.NonNull; + +import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractGuestAccountMsalBrokerUiTest; +import com.microsoft.identity.client.ui.automation.TestContext; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.annotations.RunOnAPI29Minus; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.constants.GlobalConstants; +import com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired; +import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.GuestHomeAzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.GuestHomedIn; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; +import java.util.Collection; +import java.util.concurrent.TimeUnit; + +// [Joined] Guest Support: Interactive and Silent Auth with MSAL Test app (Authenticator or Company Portal) +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/1400731/ +@RetryOnFailure(retryCount = 2) +@RunWith(Parameterized.class) +@RunOnAPI29Minus("Keep me signed in") +public class TestCase1400731 extends AbstractGuestAccountMsalBrokerUiTest { + + private final GuestHomeAzureEnvironment mGuestHomeAzureEnvironment; + + public TestCase1400731(final String name, final @NonNull GuestHomeAzureEnvironment guestHomeAzureEnvironment) { + mGuestHomeAzureEnvironment = guestHomeAzureEnvironment; + } + + @Parameterized.Parameters(name = "{0}") + public static Collection guestHomeAzureEnvironment() { + return Arrays.asList(new Object[][]{ + {"AZURE_US_GOV", GuestHomeAzureEnvironment.AZURE_US_GOVERNMENT}, + {"AZURE_CHINA_CLOUD", GuestHomeAzureEnvironment.AZURE_CHINA_CLOUD}, + }); + } + + /** + * Tests Acquiring token for Cross cloud Guest account with broker. + */ + @Test + public void test_1420494() throws Throwable { + final String userName = mGuestUser.getHomeUpn(); + final String password = mLabClient.getPasswordForGuestUser(mGuestUser); + + //perform device registration + mBroker.performDeviceRegistration(userName, password); + + // Handler for Interactive auth call + final OnInteractionRequired interactionHandler = () -> { + final PromptHandlerParameters promptHandlerParameters = + PromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(userName) + .staySignedInPageExpected(GlobalConstants.IS_STAY_SIGN_IN_PAGE_EXPECTED) + .broker(mBroker) + .build(); + final AadPromptHandler promptHandler = new AadPromptHandler(promptHandlerParameters); + promptHandler.handlePrompt(userName, password); + }; + + final MsalAuthTestParams acquireTokenAuthParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(userName) + .scopes(Arrays.asList(getScopes())) + .promptParameter(Prompt.SELECT_ACCOUNT) + .authority(getAuthority()) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalSdk msalSdk = new MsalSdk(); + // Acquire token interactively + final MsalAuthResult acquireTokenResult = msalSdk.acquireTokenInteractive(acquireTokenAuthParams, interactionHandler, TokenRequestTimeout.SHORT); + + Assert.assertFalse("Verify accessToken is not empty", TextUtils.isEmpty(acquireTokenResult.getAccessToken())); + + // change the time on the device (without resetting to automatic time zone) + TestContext.getTestContext().getTestDevice().getSettings().forwardDeviceTimeForOneDay(); + + // Acquire token silently + MsalAuthResult acquireTokenSilentResult = msalSdk.acquireTokenSilent(acquireTokenAuthParams, TokenRequestTimeout.SHORT); + Assert.assertFalse("AccessToken is empty", TextUtils.isEmpty(acquireTokenSilentResult.getAccessToken())); + + Assert.assertNotEquals("Silent request does not return a new access token", acquireTokenSilentResult.getAccessToken(), acquireTokenResult.getAccessToken()); + + final JSONObject profileObject = getProfileObjectFromMSGraph(acquireTokenSilentResult.getAccessToken()); + Assert.assertEquals(userName, profileObject.get("mail")); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.GUEST) + .guestHomeAzureEnvironment(mGuestHomeAzureEnvironment) + .guestHomedIn(GuestHomedIn.HOST_AZURE_AD) + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .build(); + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return "https://login.microsoftonline.com/" + mGuestUser.getGuestLabTenants().get(0); + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java new file mode 100644 index 0000000000..e1859321f4 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.foci; + +import androidx.test.uiautomator.UiObject; + +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.annotations.LongUIAutomationTest; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.app.AzureSampleApp; +import com.microsoft.identity.client.ui.automation.app.OutlookApp; +import com.microsoft.identity.client.ui.automation.app.WordApp; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; +import com.microsoft.identity.client.ui.automation.logging.Logger; +import com.microsoft.identity.client.ui.automation.installer.LocalApkInstaller; +import com.microsoft.identity.client.ui.automation.interaction.FirstPartyAppPromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.utils.CommonUtils; +import com.microsoft.identity.client.ui.automation.utils.UiAutomatorUtils; +import com.microsoft.identity.common.java.util.ThreadUtils; +import com.microsoft.identity.labapi.utilities.client.ILabAccount; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.FederationProvider; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; +import com.microsoft.identity.labapi.utilities.exception.LabApiException; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +// [Non-joined][FoCl] FoCl (Multi-users) with Outlook and Word +// https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833544 +@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class}) +@RetryOnFailure +@LongUIAutomationTest +public class TestCase833544 extends AbstractMsalBrokerTest { + + @Test + public void test_833544() throws LabApiException { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + final OutlookApp outlook = new OutlookApp(new LocalApkInstaller()); + + outlook.install(); + outlook.launch(); + outlook.handleFirstRun(); + + final FirstPartyAppPromptHandlerParameters promptHandlerParameters = FirstPartyAppPromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .broker(mBroker) + .registerPageExpected(false) + .enrollPageExpected(false) + .consentPageExpected(false) + .speedBumpExpected(false) + .sessionExpected(false) + .expectingLoginPageAccountPicker(false) + .expectingBrokerAccountChooserActivity(false) + .build(); + + // add first account to Outlook + outlook.addFirstAccount(username, password, promptHandlerParameters); + outlook.onAccountAdded(); + outlook.confirmAccount(username); + + final WordApp wordApp = new WordApp(new LocalApkInstaller()); + + // open word + wordApp.install(); + wordApp.launch(); + wordApp.handleFirstRun(); + + // Word auto signs the user into with the account that was in Outlook + // Sometimes, it might take a bit longer to see this UI page in word app + final UiObject fileFetchScreen = UiAutomatorUtils.obtainUiObjectWithText("Fetching your files", TimeUnit.SECONDS.toMillis(45)); + Assert.assertTrue(fileFetchScreen.exists()); + + // Make sure the account exists in Word + wordApp.confirmAccount(username); + + // Steps from 833519 + // Make sure a Non-FOCI app (Azure sample in this case) can't see the account + AzureSampleApp azureSample = new AzureSampleApp(); + azureSample.install(); + azureSample.launch(); + + // sign in silently into Azure Sample App, should see account picker and not get signed in + azureSample.signInSilentlyWithSingleAccountFragment(mBrowser, mBroker, false); + + // Confirm that the account picker did show up + final UiObject accountPicker = UiAutomatorUtils.obtainUiObjectWithResourceId(CommonUtils.getResourceId(mBroker.getPackageName(), "account_chooser_listView")); + Assert.assertTrue(accountPicker.exists()); + + // Confirm that no account is logged in to AzureSampleApp + azureSample.forceStop(); + azureSample.launch(); + azureSample.confirmSignedIn("None"); + + // fetch another account from lab - someone from a different tenant + final LabQuery queryForAdfsV3Account = LabQuery.builder() + .userType(UserType.FEDERATED) + .federationProvider(FederationProvider.ADFS_V3) + .build(); + + final ILabAccount labAccountAdfsV3 = mLabClient.getLabAccount(queryForAdfsV3Account); + + final String usernameV3 = labAccountAdfsV3.getUsername(); + final String passwordV3 = labAccountAdfsV3.getPassword(); + + // relaunch Outlook + outlook.forceStop(); + outlook.launch(); + + final FirstPartyAppPromptHandlerParameters outlookPromptParameters = + FirstPartyAppPromptHandlerParameters.builder() + .expectingNonZeroAccountsInTSL(true) + .prompt(PromptParameter.SELECT_ACCOUNT) + .broker(mBroker) + .consentPageExpected(false) + .enrollPageExpected(false) + .registerPageExpected(false) + .isFederated(true) + .expectingBrokerAccountChooserActivity(true) + .expectingLoginPageAccountPicker(false) + .howWouldYouLikeToSignInExpected(true) + .loginHint(usernameV3) + .sessionExpected(false) + .speedBumpExpected(false) + .build(); + + // add another account in Outlook + outlook.addAnotherAccount(usernameV3, passwordV3, outlookPromptParameters); + + // Relaunching word right after outlook sign in is pressed leads to issues, sometimes the user is not signed in + ThreadUtils.sleepSafely(5000, "Sleep failed", "Interrupted"); + + // relaunch Word app + wordApp.forceStop(); + wordApp.launch(); + + // We used to check for a flag to expect what new, which occasionally appears in our testing based on word version + // Let's just ignore any AssertionErrors that get thrown here, we don't know what to expect before hand anyway + try { + // Word shows a Whats New Dialog when the app is launched NEXT TIME after adding first account + final UiObject whatsNewDialog = UiAutomatorUtils.obtainUiObjectWithResourceId( + "com.microsoft.office.word:id/WhatsNewDialogTitleTextView" + ); + + Assert.assertTrue(whatsNewDialog.exists()); + + // Click the close btn to close this dialog + UiAutomatorUtils.handleButtonClick("android:id/button2"); + } catch (AssertionError e){ + Logger.i(TestCase833544.class.getSimpleName(), "What's New Page did not appear: " + e.getMessage()); + } + + final FirstPartyAppPromptHandlerParameters wordPromptParameters = + FirstPartyAppPromptHandlerParameters.builder() + .expectingNonZeroAccountsInTSL(true) + .prompt(PromptParameter.SELECT_ACCOUNT) + .broker(mBroker) + .consentPageExpected(false) + .enrollPageExpected(false) + .registerPageExpected(false) + .isFederated(true) + .expectingBrokerAccountChooserActivity(true) + .expectingLoginPageAccountPicker(false) + .loginHint(usernameV3) + .sessionExpected(true) + .speedBumpExpected(false) + .build(); + + // add another account in Word + wordApp.addAnotherAccount(usernameV3, passwordV3, wordPromptParameters); + + // make sure this other account is in Word + wordApp.confirmAccount(usernameV3); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return mApplication.getConfiguration().getDefaultAuthority().toString(); + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java new file mode 100644 index 0000000000..46fa0fca9c --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.mdm; + +import static com.microsoft.identity.client.ui.automation.utils.CommonUtils.FIND_UI_ELEMENT_TIMEOUT; +import static org.junit.Assert.fail; + +import androidx.test.uiautomator.UiObject; + +import com.microsoft.identity.client.IAccount; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.app.OutlookApp; +import com.microsoft.identity.client.ui.automation.app.WordApp; +import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; +import com.microsoft.identity.client.ui.automation.broker.IMdmAgent; +import com.microsoft.identity.client.ui.automation.installer.LocalApkInstaller; +import com.microsoft.identity.client.ui.automation.interaction.FirstPartyAppPromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.utils.CommonUtils; +import com.microsoft.identity.client.ui.automation.utils.UiAutomatorUtils; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.ProtectionPolicy; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Arrays; + +// [Joined][MDM] Device Admin MDM: MDM Account with Microsoft Outlook and Word +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/831126 +@SupportedBrokers(brokers = {BrokerCompanyPortal.class}) +@RetryOnFailure +//public class TestCase831126 extends AbstractFirstPartyBrokerTest { +public class TestCase831126 extends AbstractMsalBrokerTest { + + @Test + public void test_831126() throws Throwable { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + final OutlookApp outlook = new OutlookApp(new LocalApkInstaller()); + + outlook.install(); + + // launch outlook and handle first run + outlook.launch(); + outlook.handleFirstRun(); + + // This went back and forth about needing an additional password prompt in browser, might need to revisit this one + final FirstPartyAppPromptHandlerParameters promptHandlerParameters = FirstPartyAppPromptHandlerParameters.builder() + .broker(mBroker) + .prompt(PromptParameter.LOGIN) + .loginHint(username) + .consentPageExpected(false) + .expectingBrokerAccountChooserActivity(false) + .secondPasswordPageExpected(true) + .expectingLoginPageAccountPicker(false) + .enrollPageExpected(true) + .build(); + + // add first account in Outlook + outlook.addFirstAccount(username, password, promptHandlerParameters); + + // verify go to playstore page to download CP + mBrowser.handleFirstRun(); + final UiObject goToPlayStoreBtn = UiAutomatorUtils.obtainUiObjectWithText("Go to Google Play"); + if (!goToPlayStoreBtn.waitForExists(FIND_UI_ELEMENT_TIMEOUT)) { + fail("Go to play store page did not show up"); + } + + // enroll device in MDM via the Company Portal app + ((IMdmAgent) mBroker).enrollDevice(username, password); + + // SILENT REQUEST - start a acquireTokenSilent request in MSAL with the Account 2 + final MsalSdk msalSdk = new MsalSdk(); + final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),username); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .authority(account.getAuthority()) + .forceRefresh(true) + .scopes(Arrays.asList(mScopes)) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + // get a token silently + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams, TokenRequestTimeout.SILENT); + silentAuthResult.assertSuccess(); + + // re-launch outlook + outlook.launch(); + + final FirstPartyAppPromptHandlerParameters promptHandlerParamsPostEnroll = FirstPartyAppPromptHandlerParameters.builder() + .broker(mBroker) + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(true) + .build(); + + outlook.addFirstAccount(username, password, promptHandlerParamsPostEnroll); + outlook.onAccountAdded(); + + // make sure our Account is in Outlook now + outlook.confirmAccount(username); + + final WordApp wordApp = new WordApp(new LocalApkInstaller()); + wordApp.install(); + wordApp.launch(); + wordApp.handleFirstRun(); + + // Word performs auto login using the account that was previously used in one of the other + // microsoft apps. + UiObject fileFetchScreen = UiAutomatorUtils.obtainUiObjectWithText("Fetching your files", CommonUtils.FIND_UI_ELEMENT_TIMEOUT_LONG); + Assert.assertTrue(fileFetchScreen.exists()); + + // confirm that the account appears in Word + wordApp.confirmAccount(username); + // advance clock by more than an hour to expire AT in cache + getSettingsScreen().forwardDeviceTimeForOneDay(); + + // again open outlook and confirm that there is no interactive prompt + outlook.launch(); + outlook.confirmAccount(username); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.CLOUD) + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .protectionPolicy(ProtectionPolicy.MDM_CA) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return mApplication.getConfiguration().getDefaultAuthority().getAuthorityURL().toString(); + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} + diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase2139526.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase2139526.java new file mode 100644 index 0000000000..0967de1795 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase2139526.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.nonjoined; + +import com.microsoft.identity.client.IAccount; +import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.TestContext; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.annotations.LongUIAutomationTest; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.ProtectionPolicy; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +// Acquire Token Silent After Policy Change Should Fail +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2139526 +@RetryOnFailure +@LongUIAutomationTest +public class TestCase2139526 extends AbstractMsalBrokerTest { + + @Test + public void test_2139526() throws Throwable { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + final MsalSdk msalSdk = new MsalSdk(); + + // Interactive call + final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .scopes(Arrays.asList(getScopes())) + .resource("00000003-0000-0ff1-ce00-000000000000") + .promptParameter(Prompt.SELECT_ACCOUNT) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(false) + .consentPageExpected(false) + .speedBumpExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .build(); + + new AadPromptHandler(promptHandlerParameters) + .handlePrompt(username, password); + } + }, TokenRequestTimeout.MEDIUM); + + authResult.assertSuccess(); + + // Change the policy to MAM_CA + mLabClient.enablePolicy(username, ProtectionPolicy.MAM_CA); + + // It takes some time for the policy change to reflect + Thread.sleep(TimeUnit.MINUTES.toMillis(3)); + + // advance clock by more than an hour to expire AT in cache + TestContext.getTestContext().getTestDevice().getSettings().forwardDeviceTimeForOneDay(); + + // Try silent call with sharepoint as the resource, this should fail + // Silent call + final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),username); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .authority(account.getAuthority()) + .forceRefresh(true) + .scopes(Arrays.asList(getScopes())) + .resource("00000003-0000-0ff1-ce00-000000000000") + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams,TokenRequestTimeout.SILENT); + silentAuthResult.assertFailure(); + } + + @Override + public LabQuery getLabQuery() { + return null; + } + + @Override + public TempUserType getTempUserType() { + return TempUserType.BASIC; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return "https://login.microsoftonline.us/common"; + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java new file mode 100644 index 0000000000..6fff7e8aae --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.nonjoined; + +import com.microsoft.identity.client.IAccount; +import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Test; + +import java.util.Arrays; + +// [Non-joined][MSAL] Acquire Token + Acquire Token Silent, no loginhint (Prompt.SELECT_ACCOUNT) +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3139972 +//@RetryOnFailure(retryCount = 2) +public class TestCase3139972 extends AbstractMsalBrokerTest { + + @Test + public void test_3139972() throws Throwable { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + final MsalSdk msalSdk = new MsalSdk(); + + // Interactive call + final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(null) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") + .promptParameter(Prompt.SELECT_ACCOUNT) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(null) + .sessionExpected(false) + .consentPageExpected(false) + .speedBumpExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .build(); + + new AadPromptHandler(promptHandlerParameters) + .handlePrompt(username, password); + } + }, TokenRequestTimeout.MEDIUM); + + authResult.assertSuccess(); + + // Silent call + final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),username); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(null) + .authority(account.getAuthority()) + .forceRefresh(true) + .resource(mScopes[0]) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams,TokenRequestTimeout.SILENT); + silentAuthResult.assertSuccess(); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return "https://login.microsoftonline.us/common"; + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java new file mode 100644 index 0000000000..7e35162116 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.nonjoined; + +import com.microsoft.identity.client.IAccount; +import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Test; + +import java.util.Arrays; + +// [ADAL] Broker Auth for Non-Joined Account - Multiple Resources +// https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833546 +public class TestCase833546 extends AbstractMsalBrokerTest { + @Test + public void test_833546() throws Throwable { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + final MsalSdk msalSdk = new MsalSdk(); + + // Interactive call + final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .scopes(Arrays.asList(getScopes())) + .resource("00000003-0000-0ff1-ce00-000000000000") + .promptParameter(Prompt.SELECT_ACCOUNT) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(false) + .consentPageExpected(false) + .speedBumpExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .build(); + + new AadPromptHandler(promptHandlerParameters) + .handlePrompt(username, password); + } + }, TokenRequestTimeout.MEDIUM); + + authResult.assertSuccess(); + + // Silent call + final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),username); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .authority(account.getAuthority()) + .forceRefresh(true) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams,TokenRequestTimeout.SILENT); + silentAuthResult.assertSuccess(); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + @Override + public String getAuthority() { + return "https://login.microsoftonline.us/common"; + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java new file mode 100644 index 0000000000..71bac7e45b --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.nonjoined; + +import com.microsoft.identity.client.IAccount; +import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; +import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; +import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabGuestAccount; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.FederationProvider; +import com.microsoft.identity.labapi.utilities.constants.GuestHomedIn; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Test; + +import java.util.Arrays; + +// [ADAL] Broker Auth for Non-Joined Account (Federated User) +// https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833553 +public class TestCase833553 extends AbstractMsalBrokerTest { + @Test + public void test_833546() throws Throwable { + final String username = mLabAccount.getUsername(); + + // query to load another user from the same tenant + final LabQuery queryForUserB = LabQuery.builder() + .userType(UserType.GUEST) + .guestHomedIn(GuestHomedIn.ON_PREM) + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .federationProvider(FederationProvider.ADFS_V4) + .build(); + + // load this other user + final LabGuestAccount userB = mLabClient.loadGuestAccountFromLab(queryForUserB); + + final String usernameB = userB.getHomeUpn(); + final String passwordB = mLabClient.getPasswordForGuestUser(userB); + + final MsalSdk msalSdk = new MsalSdk(); + + // Interactive call + final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(null) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") + .promptParameter(Prompt.SELECT_ACCOUNT) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(false) + .consentPageExpected(false) + .speedBumpExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .build(); + + new AadPromptHandler(promptHandlerParameters) + .handlePrompt(usernameB, passwordB); + } + }, TokenRequestTimeout.MEDIUM); + + authResult.assertSuccess(); + + // Silent call + final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),usernameB); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(usernameB) + .authority(account.getAuthority()) + .forceRefresh(true) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams,TokenRequestTimeout.SILENT); + silentAuthResult.assertSuccess(); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.FEDERATED) + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .federationProvider(FederationProvider.ADFS_V4) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + @Override + public String getAuthority() { + return "https://login.microsoftonline.us/common"; + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase850455.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase850455.java index d4a07f223b..83a9e2a494 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase850455.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase850455.java @@ -40,6 +40,8 @@ import org.junit.Test; +import java.util.Arrays; + // [Non-joined][MSAL] Acquire Token + Acquire Token Silent (Prompt.SELECT_ACCOUNT) // https://identitydivision.visualstudio.com/DevEx/_workitems/edit/850455 @RetryOnFailure(retryCount = 2) @@ -56,7 +58,8 @@ public void test_850455() throws Throwable { final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() .activity(mActivity) .loginHint(username) - .resource(mScopes[0]) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") .promptParameter(Prompt.SELECT_ACCOUNT) .msalConfigResourceId(getConfigFileResourceId()) .build(); @@ -89,7 +92,8 @@ public void handleUserInteraction() { .loginHint(username) .authority(account.getAuthority()) .forceRefresh(true) - .resource(mScopes[0]) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") .msalConfigResourceId(getConfigFileResourceId()) .build(); @@ -111,9 +115,8 @@ public TempUserType getTempUserType() { @Override public String[] getScopes() { - return new String[]{"00000002-0000-0000-c000-000000000000"}; + return new String[]{"User.read"}; } - @Override public String getAuthority() { return "https://login.microsoftonline.us/common"; diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase831655.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase831655.java new file mode 100644 index 0000000000..effeba2530 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase831655.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.wpj; + +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Test; + +// Verify WPJ Cert installation on a Non samsung device with Authenticator +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/831655 + +// Technically this works on Samsung device too (at least Galaxy S6) +// So this should also cover TestCase831570 +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/831570 +@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class, BrokerCompanyPortal.class}) +public class TestCase831655 extends AbstractMsalBrokerTest { + + @Test + public void test_831655() { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + // add work account via Settings screen + getSettingsScreen().addWorkAccount(mBroker, username, password); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return mApplication.getConfiguration().getDefaultAuthority().getAuthorityURL().toString(); + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java new file mode 100644 index 0000000000..6ec46c6a15 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.wpj; + +import androidx.test.uiautomator.UiObject; + +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; +import com.microsoft.identity.client.ui.automation.utils.UiAutomatorUtils; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; +import com.microsoft.identity.labapi.utilities.constants.UserType; + +import org.junit.Assert; +import org.junit.Test; + +// Broker Add Account via Account Manager +// https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833547 +@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class}) +@RetryOnFailure +public class TestCase833547 extends AbstractMsalBrokerTest { + + @Test + public void test_833547() { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + getSettingsScreen().addWorkAccount(mBroker, username, password); + + // Assert Authenticator Account screen has account + mBroker.launch(); // open Authenticator App + mBroker.handleFirstRun(); + + final UiObject account1 = UiAutomatorUtils.obtainUiObjectWithText(username); + Assert.assertTrue(account1.exists()); // make sure account 1 is there + } + + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(UserType.CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return mApplication.getConfiguration().getDefaultAuthority().getAuthorityURL().toString(); + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java new file mode 100644 index 0000000000..a6e77841c8 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// All rights reserved. +// +// This code is licensed under the MIT License. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +package com.microsoft.identity.client.msal.automationapp.testpass.broker.wpj; + +import com.microsoft.identity.client.msal.automationapp.BuildConfig; +import com.microsoft.identity.client.msal.automationapp.R; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.broker.BrokerHost; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; +import com.microsoft.identity.labapi.utilities.client.LabQuery; +import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; + +import org.junit.Assume; +import org.junit.Test; + +// [WPJ] Install WPJ Certificate for Browser Access +// https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833561 +@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class, BrokerHost.class}) +@RetryOnFailure(retryCount = 2) +public class TestCase833561 extends AbstractMsalBrokerTest { + + @Test + public void test_833561() { + // Check flight, this is checking what was passed to automation app, not the broker apks + Assume.assumeFalse( "EnableKeyStoreKeyFactory flight is activated, Test will be skipped", + BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableKeyStoreKeyFactory:true")); + + // Fetch credentials + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + // perform device registration in broker + mBroker.performDeviceRegistration(username, password); + + // enable browser access via broker + mBroker.enableBrowserAccess(username); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .azureEnvironment(AzureEnvironment.AZURE_CLOUD) + .build(); + } + + @Override + public TempUserType getTempUserType() { + return null; + } + + @Override + public String[] getScopes() { + return new String[]{"User.read"}; + } + + @Override + public String getAuthority() { + return mApplication.getConfiguration().getDefaultAuthority().getAuthorityURL().toString(); + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; + } +} From 069ccaa25c86619b2e8a1a83bdfca033827383be Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 11 Feb 2025 14:43:58 -0500 Subject: [PATCH 02/12] tweaks --- common | 2 +- .../broker/crosscloud/TestCase1400731.java | 158 +++++++++--------- .../testpass/broker/mdm/TestCase831126.java | 18 -- .../broker/nonjoined/TestCase3139972.java | 7 +- .../broker/nonjoined/TestCase833546.java | 2 +- .../broker/nonjoined/TestCase833553.java | 52 +++++- .../testpass/broker/wpj/TestCase833561.java | 2 +- 7 files changed, 133 insertions(+), 108 deletions(-) diff --git a/common b/common index e94aee0cbe..258956814b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit e94aee0cbea66e7a8b7537479f65d7a194aa410a +Subproject commit 258956814b952d60c46edef77c05700bed86613e diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java index 7a3c1db853..f05b0d3349 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/crosscloud/TestCase1400731.java @@ -27,125 +27,133 @@ import androidx.annotation.NonNull; import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.R; import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthResult; import com.microsoft.identity.client.msal.automationapp.sdk.MsalAuthTestParams; import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; -import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractGuestAccountMsalBrokerUiTest; -import com.microsoft.identity.client.ui.automation.TestContext; +import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; -import com.microsoft.identity.client.ui.automation.annotations.RunOnAPI29Minus; import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; -import com.microsoft.identity.client.ui.automation.constants.GlobalConstants; -import com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; -import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.labapi.utilities.client.LabGuestAccount; import com.microsoft.identity.labapi.utilities.client.LabQuery; -import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; -import com.microsoft.identity.labapi.utilities.constants.GuestHomeAzureEnvironment; -import com.microsoft.identity.labapi.utilities.constants.GuestHomedIn; +import com.microsoft.identity.labapi.utilities.constants.LabConstants; +import com.microsoft.identity.labapi.utilities.constants.TempUserType; import com.microsoft.identity.labapi.utilities.constants.UserType; -import org.json.JSONObject; import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import java.util.Arrays; -import java.util.Collection; -import java.util.concurrent.TimeUnit; // [Joined] Guest Support: Interactive and Silent Auth with MSAL Test app (Authenticator or Company Portal) // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/1400731/ @RetryOnFailure(retryCount = 2) -@RunWith(Parameterized.class) -@RunOnAPI29Minus("Keep me signed in") -public class TestCase1400731 extends AbstractGuestAccountMsalBrokerUiTest { +public class TestCase1400731 extends AbstractMsalBrokerTest { - private final GuestHomeAzureEnvironment mGuestHomeAzureEnvironment; + @Test + public void test_1400731() throws Throwable { + // load a guest user account from the Lab + final LabGuestAccount labGuest = mLabClient.loadGuestAccountFromLab(getLabQuery()); - public TestCase1400731(final String name, final @NonNull GuestHomeAzureEnvironment guestHomeAzureEnvironment) { - mGuestHomeAzureEnvironment = guestHomeAzureEnvironment; - } + final String username = "gcidlab@msidlab4.onmicrosoft.com"; + final String password = mLabClient.getPasswordForGuestUser(labGuest); - @Parameterized.Parameters(name = "{0}") - public static Collection guestHomeAzureEnvironment() { - return Arrays.asList(new Object[][]{ - {"AZURE_US_GOV", GuestHomeAzureEnvironment.AZURE_US_GOVERNMENT}, - {"AZURE_CHINA_CLOUD", GuestHomeAzureEnvironment.AZURE_CHINA_CLOUD}, - }); - } + //perform device registration + mBroker.performDeviceRegistration(username, password); - /** - * Tests Acquiring token for Cross cloud Guest account with broker. - */ - @Test - public void test_1420494() throws Throwable { - final String userName = mGuestUser.getHomeUpn(); - final String password = mLabClient.getPasswordForGuestUser(mGuestUser); + final MsalSdk msalSdk = new MsalSdk(); - //perform device registration - mBroker.performDeviceRegistration(userName, password); - - // Handler for Interactive auth call - final OnInteractionRequired interactionHandler = () -> { - final PromptHandlerParameters promptHandlerParameters = - PromptHandlerParameters.builder() - .prompt(PromptParameter.SELECT_ACCOUNT) - .loginHint(userName) - .staySignedInPageExpected(GlobalConstants.IS_STAY_SIGN_IN_PAGE_EXPECTED) - .broker(mBroker) - .build(); - final AadPromptHandler promptHandler = new AadPromptHandler(promptHandlerParameters); - promptHandler.handlePrompt(userName, password); - }; - - final MsalAuthTestParams acquireTokenAuthParams = MsalAuthTestParams.builder() + final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() .activity(mActivity) - .loginHint(userName) - .scopes(Arrays.asList(getScopes())) + .loginHint(username) + .scopes(Arrays.asList(mScopes)) .promptParameter(Prompt.SELECT_ACCOUNT) - .authority(getAuthority()) + .authority(LabConstants.MSID_LAB3) .msalConfigResourceId(getConfigFileResourceId()) .build(); - final MsalSdk msalSdk = new MsalSdk(); - // Acquire token interactively - final MsalAuthResult acquireTokenResult = msalSdk.acquireTokenInteractive(acquireTokenAuthParams, interactionHandler, TokenRequestTimeout.SHORT); + // start interactive acquire token request in MSAL (should succeed) + final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + // Should be silent + } + }, TokenRequestTimeout.MEDIUM); - Assert.assertFalse("Verify accessToken is not empty", TextUtils.isEmpty(acquireTokenResult.getAccessToken())); + Assert.assertFalse(TextUtils.isEmpty(authResult.getAccessToken())); - // change the time on the device (without resetting to automatic time zone) - TestContext.getTestContext().getTestDevice().getSettings().forwardDeviceTimeForOneDay(); + final MsalAuthTestParams authTestParams2 = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .scopes(Arrays.asList(mScopes)) + .promptParameter(Prompt.SELECT_ACCOUNT) + .authority(LabConstants.MSID_LAB4) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); - // Acquire token silently - MsalAuthResult acquireTokenSilentResult = msalSdk.acquireTokenSilent(acquireTokenAuthParams, TokenRequestTimeout.SHORT); - Assert.assertFalse("AccessToken is empty", TextUtils.isEmpty(acquireTokenSilentResult.getAccessToken())); + // start interactive acquire token request in MSAL for msidlab4 (should succeed and be silent) + final MsalAuthResult authResult2 = msalSdk.acquireTokenInteractive(authTestParams2, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + // Should be silent + } + }, TokenRequestTimeout.MEDIUM); - Assert.assertNotEquals("Silent request does not return a new access token", acquireTokenSilentResult.getAccessToken(), acquireTokenResult.getAccessToken()); + authResult2.assertSuccess(); - final JSONObject profileObject = getProfileObjectFromMSGraph(acquireTokenSilentResult.getAccessToken()); - Assert.assertEquals(userName, profileObject.get("mail")); + // advance clock by more than an hour to expire AT in cache + getSettingsScreen().forwardDeviceTimeForOneDay(); + + final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .authority(LabConstants.MSID_LAB3) + .forceRefresh(true) + .scopes(Arrays.asList(mScopes)) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + // get a token silently for msidlab3 + final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams, TokenRequestTimeout.SILENT); + silentAuthResult.assertSuccess(); + + final MsalAuthTestParams silentParams2 = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .authority(LabConstants.MSID_LAB4) + .forceRefresh(true) + .scopes(Arrays.asList(mScopes)) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + // get a token silently for msidlab4 + final MsalAuthResult silentAuthResult2 = msalSdk.acquireTokenSilent(silentParams2, TokenRequestTimeout.SILENT); + silentAuthResult2.assertSuccess(); } @Override public LabQuery getLabQuery() { return LabQuery.builder() .userType(UserType.GUEST) - .guestHomeAzureEnvironment(mGuestHomeAzureEnvironment) - .guestHomedIn(GuestHomedIn.HOST_AZURE_AD) - .azureEnvironment(AzureEnvironment.AZURE_CLOUD) .build(); } + @Override + public TempUserType getTempUserType() { + return null; + } + @Override public String[] getScopes() { return new String[]{"User.read"}; } - @Override public String getAuthority() { - return "https://login.microsoftonline.com/" + mGuestUser.getGuestLabTenants().get(0); + return "https://login.microsoftonline.us/common"; + } + + @Override + public int getConfigFileResourceId() { + return R.raw.msal_config_default; } -} +} \ No newline at end of file diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java index 46fa0fca9c..0deb3698ff 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/mdm/TestCase831126.java @@ -60,7 +60,6 @@ // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/831126 @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) @RetryOnFailure -//public class TestCase831126 extends AbstractFirstPartyBrokerTest { public class TestCase831126 extends AbstractMsalBrokerTest { @Test @@ -101,23 +100,6 @@ public void test_831126() throws Throwable { // enroll device in MDM via the Company Portal app ((IMdmAgent) mBroker).enrollDevice(username, password); - // SILENT REQUEST - start a acquireTokenSilent request in MSAL with the Account 2 - final MsalSdk msalSdk = new MsalSdk(); - final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),username); - - final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() - .activity(mActivity) - .loginHint(username) - .authority(account.getAuthority()) - .forceRefresh(true) - .scopes(Arrays.asList(mScopes)) - .msalConfigResourceId(getConfigFileResourceId()) - .build(); - - // get a token silently - final MsalAuthResult silentAuthResult = msalSdk.acquireTokenSilent(silentParams, TokenRequestTimeout.SILENT); - silentAuthResult.assertSuccess(); - // re-launch outlook outlook.launch(); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java index 6fff7e8aae..b0fed0c7fa 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase3139972.java @@ -44,7 +44,7 @@ // [Non-joined][MSAL] Acquire Token + Acquire Token Silent, no loginhint (Prompt.SELECT_ACCOUNT) // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3139972 -//@RetryOnFailure(retryCount = 2) +@RetryOnFailure(retryCount = 2) public class TestCase3139972 extends AbstractMsalBrokerTest { @Test @@ -89,10 +89,11 @@ public void handleUserInteraction() { final MsalAuthTestParams silentParams = MsalAuthTestParams.builder() .activity(mActivity) - .loginHint(null) + .loginHint(username) .authority(account.getAuthority()) .forceRefresh(true) - .resource(mScopes[0]) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") .msalConfigResourceId(getConfigFileResourceId()) .build(); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java index 7e35162116..5011ec3c2b 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833546.java @@ -41,7 +41,7 @@ import java.util.Arrays; -// [ADAL] Broker Auth for Non-Joined Account - Multiple Resources +// [MSAL] Broker Auth for Non-Joined Account - Multiple Resources // https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833546 public class TestCase833546 extends AbstractMsalBrokerTest { @Test diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java index 71bac7e45b..c74e3af6f1 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/nonjoined/TestCase833553.java @@ -30,9 +30,10 @@ import com.microsoft.identity.client.msal.automationapp.sdk.MsalSdk; import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest; import com.microsoft.identity.client.ui.automation.TokenRequestTimeout; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.MicrosoftStsPromptHandler; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.MicrosoftStsPromptHandlerParameters; import com.microsoft.identity.labapi.utilities.client.LabGuestAccount; import com.microsoft.identity.labapi.utilities.client.LabQuery; import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment; @@ -45,11 +46,12 @@ import java.util.Arrays; -// [ADAL] Broker Auth for Non-Joined Account (Federated User) +// [MSAL] Broker Auth for Non-Joined Account (Federated User) // https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833553 +@RetryOnFailure() public class TestCase833553 extends AbstractMsalBrokerTest { @Test - public void test_833546() throws Throwable { + public void test_833553() throws Throwable { final String username = mLabAccount.getUsername(); // query to load another user from the same tenant @@ -64,14 +66,14 @@ public void test_833546() throws Throwable { final LabGuestAccount userB = mLabClient.loadGuestAccountFromLab(queryForUserB); final String usernameB = userB.getHomeUpn(); - final String passwordB = mLabClient.getPasswordForGuestUser(userB); + final String password = mLabClient.getPasswordForGuestUser(userB); final MsalSdk msalSdk = new MsalSdk(); // Interactive call final MsalAuthTestParams authTestParams = MsalAuthTestParams.builder() .activity(mActivity) - .loginHint(null) + .loginHint(username) .scopes(Arrays.asList(getScopes())) .resource("00000002-0000-0000-c000-000000000000") .promptParameter(Prompt.SELECT_ACCOUNT) @@ -81,23 +83,55 @@ public void test_833546() throws Throwable { final MsalAuthResult authResult = msalSdk.acquireTokenInteractive(authTestParams, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { @Override public void handleUserInteraction() { - final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() + final MicrosoftStsPromptHandlerParameters promptHandlerParameters = MicrosoftStsPromptHandlerParameters.builder() .prompt(PromptParameter.SELECT_ACCOUNT) .loginHint(username) .sessionExpected(false) .consentPageExpected(false) + .isFederated(true) .speedBumpExpected(false) .broker(mBroker) .expectingBrokerAccountChooserActivity(false) .build(); - new AadPromptHandler(promptHandlerParameters) - .handlePrompt(usernameB, passwordB); + new MicrosoftStsPromptHandler(promptHandlerParameters) + .handlePrompt(username, password); } }, TokenRequestTimeout.MEDIUM); authResult.assertSuccess(); + // Interactive call for user b + final MsalAuthTestParams authTestParams2 = MsalAuthTestParams.builder() + .activity(mActivity) + .loginHint(username) + .scopes(Arrays.asList(getScopes())) + .resource("00000002-0000-0000-c000-000000000000") + .promptParameter(Prompt.LOGIN) + .msalConfigResourceId(getConfigFileResourceId()) + .build(); + + final MsalAuthResult authResult2 = msalSdk.acquireTokenInteractive(authTestParams2, new com.microsoft.identity.client.ui.automation.interaction.OnInteractionRequired() { + @Override + public void handleUserInteraction() { + final MicrosoftStsPromptHandlerParameters promptHandlerParameters = MicrosoftStsPromptHandlerParameters.builder() + .prompt(PromptParameter.LOGIN) + .loginHint(null) + .sessionExpected(false) + .consentPageExpected(false) + .isFederated(true) + .speedBumpExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .build(); + + new MicrosoftStsPromptHandler(promptHandlerParameters) + .handlePrompt(usernameB, password); + } + }, TokenRequestTimeout.MEDIUM); + + authResult2.assertSuccess(); + // Silent call final IAccount account = msalSdk.getAccount(mActivity,getConfigFileResourceId(),usernameB); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java index a6e77841c8..a0d3484d37 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833561.java @@ -39,7 +39,7 @@ // [WPJ] Install WPJ Certificate for Browser Access // https://identitydivision.visualstudio.com/DevEx/_workitems/edit/833561 @SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class, BrokerHost.class}) -@RetryOnFailure(retryCount = 2) +//@RetryOnFailure(retryCount = 2) public class TestCase833561 extends AbstractMsalBrokerTest { @Test From be8ba5554b15e0191e22ea3ce011bb45bb0afee1 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 11 Feb 2025 21:50:11 -0500 Subject: [PATCH 03/12] common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 258956814b..d6a122935e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 258956814b952d60c46edef77c05700bed86613e +Subproject commit d6a122935e0deadf6939e444019ce6d6725251d2 From 4a2ee36b3dc091b285a401b0165dd0e92719d14e Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 11 Feb 2025 22:10:12 -0500 Subject: [PATCH 04/12] pull common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index d6a122935e..c546d79903 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit d6a122935e0deadf6939e444019ce6d6725251d2 +Subproject commit c546d79903278219cc62fe9396b31185933942e4 From e9d7ddab8f55826ddbc7814d39182d72e2c3faa9 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 18 Feb 2025 23:56:46 -0500 Subject: [PATCH 05/12] tests --- common | 2 +- .../msal/automationapp/testpass/broker/foci/TestCase833544.java | 2 ++ .../msal/automationapp/testpass/broker/wpj/TestCase833547.java | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common b/common index c546d79903..9a4d764944 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c546d79903278219cc62fe9396b31185933942e4 +Subproject commit 9a4d76494414dff241077e397cf4a4f27420a80f diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java index e1859321f4..e7fdc955d5 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java @@ -62,6 +62,8 @@ public class TestCase833544 extends AbstractMsalBrokerTest { @Test public void test_833544() throws LabApiException { + getSettingsScreen().toggleNotificationsThroughSettings(mBroker.getPackageName()); + final String username = mLabAccount.getUsername(); final String password = mLabAccount.getPassword(); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java index 6ec46c6a15..3fb28e3c66 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java @@ -45,6 +45,8 @@ public class TestCase833547 extends AbstractMsalBrokerTest { @Test public void test_833547() { + getSettingsScreen().toggleNotificationsThroughSettings(mBroker.getPackageName()); + final String username = mLabAccount.getUsername(); final String password = mLabAccount.getPassword(); From df83207983fae990adaa64c327f10d94e1a466ab Mon Sep 17 00:00:00 2001 From: fadidurah Date: Wed, 19 Feb 2025 00:06:52 -0500 Subject: [PATCH 06/12] add comment --- .../msal/automationapp/testpass/broker/foci/TestCase833544.java | 1 + .../msal/automationapp/testpass/broker/wpj/TestCase833547.java | 1 + 2 files changed, 2 insertions(+) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java index e7fdc955d5..03b5b1f47c 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/foci/TestCase833544.java @@ -62,6 +62,7 @@ public class TestCase833544 extends AbstractMsalBrokerTest { @Test public void test_833544() throws LabApiException { + // Recent build of authenticator seems to produce a notification popup on device, this blocks some ui we rely on to validate account presence. Disabling notifications will work. getSettingsScreen().toggleNotificationsThroughSettings(mBroker.getPackageName()); final String username = mLabAccount.getUsername(); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java index 3fb28e3c66..fadbd2f4d0 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/wpj/TestCase833547.java @@ -45,6 +45,7 @@ public class TestCase833547 extends AbstractMsalBrokerTest { @Test public void test_833547() { + // Recent build of authenticator seems to produce a notification popup on device, this blocks some ui we rely on to validate account presence. Disabling notifications will work. getSettingsScreen().toggleNotificationsThroughSettings(mBroker.getPackageName()); final String username = mLabAccount.getUsername(); From 498dca84e30dc688efb994c976353ce83cf68e61 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Wed, 19 Feb 2025 15:44:17 -0500 Subject: [PATCH 07/12] common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 9a4d764944..d1162824b9 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 9a4d76494414dff241077e397cf4a4f27420a80f +Subproject commit d1162824b919c43176751676125b9a2b1bc81dc9 From 9ce3ed86480c949c986c3b381ef83d5221c32b45 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Wed, 19 Feb 2025 16:00:48 -0500 Subject: [PATCH 08/12] fix one test --- .../testpass/broker/brokerapi/TestCase2110359.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java index d5dab57def..7dd3b62903 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java @@ -108,7 +108,7 @@ public void checkForDcfOption(@Nullable final String tenantId) { UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); final UiObject optionsObject = device.findObject(new UiSelector() - .text("Sign-in options").className("android.widget.Button")); + .textContains("Sign-in options").className("android.widget.Button")); try { optionsObject.click(); From b5bf052f1451b528dd31aa4c4aa47480129f6173 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Thu, 20 Feb 2025 12:31:15 -0500 Subject: [PATCH 09/12] common --- common | 2 +- .../testpass/broker/brokerapi/TestCase2110359.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common b/common index d1162824b9..c7ef2e5558 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit d1162824b919c43176751676125b9a2b1bc81dc9 +Subproject commit c7ef2e5558b54f8b6f48af20b13a860011bc63b5 diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java index 7dd3b62903..d5dab57def 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/brokerapi/TestCase2110359.java @@ -108,7 +108,7 @@ public void checkForDcfOption(@Nullable final String tenantId) { UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); final UiObject optionsObject = device.findObject(new UiSelector() - .textContains("Sign-in options").className("android.widget.Button")); + .text("Sign-in options").className("android.widget.Button")); try { optionsObject.click(); From ee928355a104fc08ebeb700f27764d131155769f Mon Sep 17 00:00:00 2001 From: fadidurah Date: Fri, 21 Feb 2025 19:53:47 -0500 Subject: [PATCH 10/12] common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index c7ef2e5558..b90c04aa2c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c7ef2e5558b54f8b6f48af20b13a860011bc63b5 +Subproject commit b90c04aa2ced48e83ec3e5331fff5a589ed40e4e From b15115db67f4c29dc4fdddb98b389b2d1de77549 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Fri, 21 Feb 2025 20:15:42 -0500 Subject: [PATCH 11/12] common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 7217b23707..5be0fdf1d6 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 7217b23707fafec6d693acb6006d27629ba0d6c3 +Subproject commit 5be0fdf1d62f4f044e11cf28af59016db71e8b3c From b0a8cc0bd286ad17c6147a50e1b95ca427b37a78 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Sat, 22 Feb 2025 23:28:38 -0500 Subject: [PATCH 12/12] common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 5be0fdf1d6..605a869c4e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5be0fdf1d62f4f044e11cf28af59016db71e8b3c +Subproject commit 605a869c4eea81fb31c163333bdd30f845433a5a