From a12f45cfb8698a759f957ece3ea98384cdd9539a Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Fri, 22 Dec 2023 18:17:14 -0800 Subject: [PATCH 01/17] automation app name changes --- msalautomationapp/build.gradle | 2 +- msalautomationapp/src/main/res/raw/msal_automation_config.json | 3 +-- msalautomationapp/src/main/res/raw/msal_config_arlington.json | 2 +- msalautomationapp/src/main/res/raw/msal_config_b2c_siso.json | 2 +- msalautomationapp/src/main/res/raw/msal_config_default.json | 2 +- msalautomationapp/src/main/res/raw/msal_config_msa.json | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/msalautomationapp/build.gradle b/msalautomationapp/build.gradle index b31b07caf1..65ea301956 100644 --- a/msalautomationapp/build.gradle +++ b/msalautomationapp/build.gradle @@ -48,7 +48,7 @@ android { defaultConfig { multiDexEnabled true namespace = "com.microsoft.identity.client.msal.automationapp" - applicationId "com.msft.identity.client.sample" + applicationId "com.msft.identity.client.msal.automationapp" minSdkVersion rootProject.ext.automationAppMinSDKVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/msalautomationapp/src/main/res/raw/msal_automation_config.json b/msalautomationapp/src/main/res/raw/msal_automation_config.json index 8ecf04ec91..d61dae2494 100644 --- a/msalautomationapp/src/main/res/raw/msal_automation_config.json +++ b/msalautomationapp/src/main/res/raw/msal_automation_config.json @@ -1,8 +1,7 @@ { "client_id" : "4b0db8c2-9f26-4417-8bde-3f0e3656f8e0", "authorization_user_agent" : "DEFAULT", - "redirect_uri" : "msauth://com.microsoft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", - "multiple_clouds_supported":true, + "redirect_uri" : "msauth://com.msft.identity.client.msal.automationapp.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", "multiple_clouds_supported":true, "account_mode": "MULTIPLE", "authorities" : [ { diff --git a/msalautomationapp/src/main/res/raw/msal_config_arlington.json b/msalautomationapp/src/main/res/raw/msal_config_arlington.json index 6e738958c8..ab6724f03b 100644 --- a/msalautomationapp/src/main/res/raw/msal_config_arlington.json +++ b/msalautomationapp/src/main/res/raw/msal_config_arlington.json @@ -1,7 +1,7 @@ { "client_id" : "8efc1284-a3c4-4ffd-b7b9-ff7c75965bc5", "authorization_user_agent" : "DEFAULT", - "redirect_uri" : "msauth://com.msft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", + "redirect_uri" : "msauth://com.msft.identity.client.msal.automationapp.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", "authorities" : [ { "type": "AAD", diff --git a/msalautomationapp/src/main/res/raw/msal_config_b2c_siso.json b/msalautomationapp/src/main/res/raw/msal_config_b2c_siso.json index c5cab70200..f7fe6a1912 100644 --- a/msalautomationapp/src/main/res/raw/msal_config_b2c_siso.json +++ b/msalautomationapp/src/main/res/raw/msal_config_b2c_siso.json @@ -1,6 +1,6 @@ { "client_id" : "e3b9ad76-9763-4827-b088-80c7a7888f79", - "redirect_uri" : "msauth://com.msft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", + "redirect_uri" : "msauth://com.msft.identity.client.msal.automationapp.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", "authorities" : [ { "type": "B2C", diff --git a/msalautomationapp/src/main/res/raw/msal_config_default.json b/msalautomationapp/src/main/res/raw/msal_config_default.json index e010c6d7ae..184e289cba 100644 --- a/msalautomationapp/src/main/res/raw/msal_config_default.json +++ b/msalautomationapp/src/main/res/raw/msal_config_default.json @@ -1,7 +1,7 @@ { "client_id" : "4b0db8c2-9f26-4417-8bde-3f0e3656f8e0", "authorization_user_agent" : "default", - "redirect_uri" : "msauth://com.msft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", + "redirect_uri" : "msauth://com.msft.identity.client.msal.automationapp.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", "authorities" : [ { "type": "AAD", diff --git a/msalautomationapp/src/main/res/raw/msal_config_msa.json b/msalautomationapp/src/main/res/raw/msal_config_msa.json index f46c169316..54de88c1e5 100644 --- a/msalautomationapp/src/main/res/raw/msal_config_msa.json +++ b/msalautomationapp/src/main/res/raw/msal_config_msa.json @@ -1,7 +1,7 @@ { "client_id" : "9668f2bd-6103-4292-9024-84fa2d1b6fb2", "authorization_user_agent" : "DEFAULT", - "redirect_uri" : "msauth://com.msft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", + "redirect_uri" : "msauth://com.msft.identity.client.msal.automationapp.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", "authorities" : [ { "type": "AAD", From 8d9328c6d18658cca0b5f776ab690bc95e310b6b Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Sat, 23 Dec 2023 11:47:33 -0800 Subject: [PATCH 02/17] automation app name changes --- msalautomationapp/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msalautomationapp/src/main/AndroidManifest.xml b/msalautomationapp/src/main/AndroidManifest.xml index d4a8bbeb09..1e0d2dbbea 100644 --- a/msalautomationapp/src/main/AndroidManifest.xml +++ b/msalautomationapp/src/main/AndroidManifest.xml @@ -35,7 +35,7 @@ From 7590d4587928c07358d9ebb0c310a8f44675112e Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Sun, 24 Dec 2023 22:49:58 -0800 Subject: [PATCH 03/17] automation app name changes --- msalautomationapp/src/main/AndroidManifest.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/msalautomationapp/src/main/AndroidManifest.xml b/msalautomationapp/src/main/AndroidManifest.xml index 1e0d2dbbea..053874da0c 100644 --- a/msalautomationapp/src/main/AndroidManifest.xml +++ b/msalautomationapp/src/main/AndroidManifest.xml @@ -47,7 +47,10 @@ - + + + \ No newline at end of file From 02a907d39f0e22d0e438a8b0d5223c35e673d324 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Tue, 26 Dec 2023 13:11:32 -0800 Subject: [PATCH 04/17] automation app name changes --- msalautomationapp/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msalautomationapp/src/main/AndroidManifest.xml b/msalautomationapp/src/main/AndroidManifest.xml index 053874da0c..2426146e98 100644 --- a/msalautomationapp/src/main/AndroidManifest.xml +++ b/msalautomationapp/src/main/AndroidManifest.xml @@ -47,7 +47,7 @@ - From 854bade2422593e3f10b042f56ee8198fa200d6c Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Tue, 2 Jan 2024 15:19:37 -0800 Subject: [PATCH 05/17] tests with oneAuthTestApp updated --- common | 2 +- .../msal/automationapp/testpass/broker/ltw/TestCase2571345.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common b/common index c5baf12815..667c65cdb8 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c5baf12815c8a46b64d642ba0e36cd2358774f65 +Subproject commit 667c65cdb80f5c6bd2c6edb4250c14bd0355468c diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571345.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571345.java index da20e206f7..50eb5628cb 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571345.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571345.java @@ -27,6 +27,7 @@ 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.LTWTests; +import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure; import com.microsoft.identity.client.ui.automation.annotations.RunOnAPI29Minus; import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; import com.microsoft.identity.client.ui.automation.app.MsalTestApp; @@ -50,6 +51,7 @@ // Samsung GA Coverage // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2571345 @LTWTests +@RetryOnFailure @RunOnAPI29Minus @SupportedBrokers(brokers = {BrokerLTW.class}) @RunWith(Parameterized.class) From 45c46467920d7a4d01e952f74d8cc63012381b4a Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Tue, 2 Jan 2024 18:53:52 -0800 Subject: [PATCH 06/17] use lab query instead of temp user --- .../automationapp/testpass/broker/ltw/TestCase2572280.java | 2 ++ .../automationapp/testpass/broker/ltw/TestCase2582294.java | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java index da84e50dea..be37d667ae 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java @@ -77,6 +77,8 @@ public void test_2572280() throws Throwable { brokerCompanyPortal.install(); final MsalTestApp msalTestApp = new MsalTestApp(); + // just to see if it is a state issue + msalTestApp.uninstall(); msalTestApp.install(); msalTestApp.launch(); msalTestApp.handleFirstRunBasedOnUserType(mUserType); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java index 01236ff932..c53650284c 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java @@ -31,6 +31,7 @@ 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.Assert; import org.junit.Test; @@ -109,12 +110,14 @@ public void test_2582294() throws Throwable{ @Override public LabQuery getLabQuery() { - return null; + return LabQuery.builder() + .userType(UserType.CLOUD) + .build(); } @Override public TempUserType getTempUserType() { - return TempUserType.BASIC; + return null; } @Override From 582c4cc1e304e9898c04b7ef8ad9235fbaadf503 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 3 Jan 2024 14:55:36 -0800 Subject: [PATCH 07/17] removed temp user --- .../msalonly/ltw/TestCase2517381.java | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java new file mode 100644 index 0000000000..f9621103e2 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java @@ -0,0 +1,174 @@ +// 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.msalonly.ltw; + +import android.text.TextUtils; + +import com.microsoft.identity.client.msal.automationapp.AbstractMsalUiTest; +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.LTWTests; +import com.microsoft.identity.client.ui.automation.annotations.RunOnAPI29Minus; +import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; +import com.microsoft.identity.client.ui.automation.app.MsalTestApp; +import com.microsoft.identity.client.ui.automation.app.OneAuthTestApp; +import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; +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.interaction.microsoftsts.MicrosoftStsPromptHandlerParameters; +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; + +// Add a UI testcase with update scenarios on OneAuthTest and MsalTest apps +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2517381 +@LTWTests +@RunOnAPI29Minus +public class TestCase2517381 extends AbstractMsalUiTest { + + @Test + public void test_2517381 () throws Throwable { + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + // install old MsalTestApp then acquires token interactively and silently + MsalTestApp msalTestApp = new MsalTestApp(); + msalTestApp.installOldApk(); + msalTestApp.launch(); + msalTestApp.handleFirstRun(); + + final MicrosoftStsPromptHandlerParameters promptHandlerParametersMsal = MicrosoftStsPromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(false) + .broker(null) + .expectingBrokerAccountChooserActivity(false) + .expectingProvidedAccountInBroker(false) + .expectingLoginPageAccountPicker(false) + .expectingProvidedAccountInCookie(false) + .consentPageExpected(false) + .passwordPageExpected(true) + .speedBumpExpected(false) + .registerPageExpected(false) + .enrollPageExpected(false) + .staySignedInPageExpected(false) + .verifyYourIdentityPageExpected(false) + .howWouldYouLikeToSignInExpected(false) + .build(); + + String token = msalTestApp.acquireToken(username, password, promptHandlerParametersMsal, mBrowser,true, true); + Assert.assertNotNull(token); + + // then acquire token silently and validate the token + msalTestApp.handleBackButton(); + String silentToken = msalTestApp.acquireTokenSilent(); + Assert.assertNotNull(silentToken); + + // install old OneAuthTestApp then acquires token interactively and silently + final OneAuthTestApp oneAuthApp = new OneAuthTestApp(); + oneAuthApp.installOldApk(); + oneAuthApp.launch(); + oneAuthApp.handleFirstRun(); + + final FirstPartyAppPromptHandlerParameters promptHandlerParametersOneAuth = FirstPartyAppPromptHandlerParameters.builder() + .broker(null) + .prompt(PromptParameter.LOGIN) + .loginHint(username) + .consentPageExpected(false) + .speedBumpExpected(false) + .sessionExpected(false) + .expectingBrokerAccountChooserActivity(false) + .expectingLoginPageAccountPicker(false) + .enrollPageExpected(false) + .build(); + oneAuthApp.addFirstAccount(username, password, promptHandlerParametersOneAuth); + oneAuthApp.confirmAccount(username); + + // Hit back button to go on launch screen + oneAuthApp.handleBackButton(); + + final String silentTokenOneAuth = oneAuthApp.acquireTokenSilent(); + Assert.assertFalse(TextUtils.isEmpty(silentTokenOneAuth)); + oneAuthApp.assertSuccess(); + + // update msal test app + msalTestApp.update(); + msalTestApp.launch(); + msalTestApp.handleFirstRun(); + + // acquire token interactively and silently without prompting for creds + msalTestApp.handleUserNameInput(username); + final String tokenAfterUpdatedMsal = msalTestApp.acquireToken(username, password, promptHandlerParametersMsal, false); + Assert.assertNotNull(tokenAfterUpdatedMsal); + + msalTestApp.handleBackButton(); + final String silentTokenAfterUpdatedMsal = msalTestApp.acquireTokenSilent(); + Assert.assertNotNull(silentTokenAfterUpdatedMsal); + + // update oneauth test app + oneAuthApp.update(); + oneAuthApp.launch(); + + // acquire token without prompting for creds + oneAuthApp.handleUserNameInput(username); + oneAuthApp.selectFromAppConfiguration("com.microsoft.identity.LabsApi.Guest"); + oneAuthApp.handlePreferBrokerSwitchButton(); + oneAuthApp.handleSignInWithoutPrompt(); + + oneAuthApp.handleBackButton(); + + // acquire token silently without prompting for creds + final String tokenAfterUpdatedOneAuth = oneAuthApp.acquireTokenSilent(); + Assert.assertFalse(TextUtils.isEmpty(tokenAfterUpdatedOneAuth)); + } + + @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; + } +} From ed3612218e2edf259cfbdba59d6fc5207b648be3 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Thu, 9 May 2024 09:54:22 -0700 Subject: [PATCH 08/17] rebased and removed unnecessary code --- .../testpass/broker/ltw/TestCase2572280.java | 2 - .../msalonly/ltw/TestCase2517381.java | 174 ------------------ 2 files changed, 176 deletions(-) delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java index be37d667ae..da84e50dea 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572280.java @@ -77,8 +77,6 @@ public void test_2572280() throws Throwable { brokerCompanyPortal.install(); final MsalTestApp msalTestApp = new MsalTestApp(); - // just to see if it is a state issue - msalTestApp.uninstall(); msalTestApp.install(); msalTestApp.launch(); msalTestApp.handleFirstRunBasedOnUserType(mUserType); diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java deleted file mode 100644 index f9621103e2..0000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/ltw/TestCase2517381.java +++ /dev/null @@ -1,174 +0,0 @@ -// 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.msalonly.ltw; - -import android.text.TextUtils; - -import com.microsoft.identity.client.msal.automationapp.AbstractMsalUiTest; -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.LTWTests; -import com.microsoft.identity.client.ui.automation.annotations.RunOnAPI29Minus; -import com.microsoft.identity.client.ui.automation.annotations.SupportedBrokers; -import com.microsoft.identity.client.ui.automation.app.MsalTestApp; -import com.microsoft.identity.client.ui.automation.app.OneAuthTestApp; -import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; -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.interaction.microsoftsts.MicrosoftStsPromptHandlerParameters; -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; - -// Add a UI testcase with update scenarios on OneAuthTest and MsalTest apps -// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2517381 -@LTWTests -@RunOnAPI29Minus -public class TestCase2517381 extends AbstractMsalUiTest { - - @Test - public void test_2517381 () throws Throwable { - final String username = mLabAccount.getUsername(); - final String password = mLabAccount.getPassword(); - - // install old MsalTestApp then acquires token interactively and silently - MsalTestApp msalTestApp = new MsalTestApp(); - msalTestApp.installOldApk(); - msalTestApp.launch(); - msalTestApp.handleFirstRun(); - - final MicrosoftStsPromptHandlerParameters promptHandlerParametersMsal = MicrosoftStsPromptHandlerParameters.builder() - .prompt(PromptParameter.SELECT_ACCOUNT) - .loginHint(username) - .sessionExpected(false) - .broker(null) - .expectingBrokerAccountChooserActivity(false) - .expectingProvidedAccountInBroker(false) - .expectingLoginPageAccountPicker(false) - .expectingProvidedAccountInCookie(false) - .consentPageExpected(false) - .passwordPageExpected(true) - .speedBumpExpected(false) - .registerPageExpected(false) - .enrollPageExpected(false) - .staySignedInPageExpected(false) - .verifyYourIdentityPageExpected(false) - .howWouldYouLikeToSignInExpected(false) - .build(); - - String token = msalTestApp.acquireToken(username, password, promptHandlerParametersMsal, mBrowser,true, true); - Assert.assertNotNull(token); - - // then acquire token silently and validate the token - msalTestApp.handleBackButton(); - String silentToken = msalTestApp.acquireTokenSilent(); - Assert.assertNotNull(silentToken); - - // install old OneAuthTestApp then acquires token interactively and silently - final OneAuthTestApp oneAuthApp = new OneAuthTestApp(); - oneAuthApp.installOldApk(); - oneAuthApp.launch(); - oneAuthApp.handleFirstRun(); - - final FirstPartyAppPromptHandlerParameters promptHandlerParametersOneAuth = FirstPartyAppPromptHandlerParameters.builder() - .broker(null) - .prompt(PromptParameter.LOGIN) - .loginHint(username) - .consentPageExpected(false) - .speedBumpExpected(false) - .sessionExpected(false) - .expectingBrokerAccountChooserActivity(false) - .expectingLoginPageAccountPicker(false) - .enrollPageExpected(false) - .build(); - oneAuthApp.addFirstAccount(username, password, promptHandlerParametersOneAuth); - oneAuthApp.confirmAccount(username); - - // Hit back button to go on launch screen - oneAuthApp.handleBackButton(); - - final String silentTokenOneAuth = oneAuthApp.acquireTokenSilent(); - Assert.assertFalse(TextUtils.isEmpty(silentTokenOneAuth)); - oneAuthApp.assertSuccess(); - - // update msal test app - msalTestApp.update(); - msalTestApp.launch(); - msalTestApp.handleFirstRun(); - - // acquire token interactively and silently without prompting for creds - msalTestApp.handleUserNameInput(username); - final String tokenAfterUpdatedMsal = msalTestApp.acquireToken(username, password, promptHandlerParametersMsal, false); - Assert.assertNotNull(tokenAfterUpdatedMsal); - - msalTestApp.handleBackButton(); - final String silentTokenAfterUpdatedMsal = msalTestApp.acquireTokenSilent(); - Assert.assertNotNull(silentTokenAfterUpdatedMsal); - - // update oneauth test app - oneAuthApp.update(); - oneAuthApp.launch(); - - // acquire token without prompting for creds - oneAuthApp.handleUserNameInput(username); - oneAuthApp.selectFromAppConfiguration("com.microsoft.identity.LabsApi.Guest"); - oneAuthApp.handlePreferBrokerSwitchButton(); - oneAuthApp.handleSignInWithoutPrompt(); - - oneAuthApp.handleBackButton(); - - // acquire token silently without prompting for creds - final String tokenAfterUpdatedOneAuth = oneAuthApp.acquireTokenSilent(); - Assert.assertFalse(TextUtils.isEmpty(tokenAfterUpdatedOneAuth)); - } - - @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; - } -} From 63db71bda593c3de1ea30b3c937ef08b4238f825 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Fri, 2 Aug 2024 19:40:53 -0700 Subject: [PATCH 09/17] updated common --- .../testpass/broker/ltw/TestCase2582294.java | 137 ------------------ 1 file changed, 137 deletions(-) delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java deleted file mode 100644 index c53650284c..0000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582294.java +++ /dev/null @@ -1,137 +0,0 @@ -// 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.ltw; - -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.LTWTests; -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.BrokerLTW; -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.Assert; -import org.junit.Test; - -// If LTW is the active broker, and request is made through Authenticator from Legacy WorkplaceJoin API, nothing should break -// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2582294 -@SupportedBrokers(brokers = {BrokerLTW.class}) -@LTWTests -public class TestCase2582294 extends AbstractMsalBrokerTest { - - @Test - public void test_2582294() throws Throwable{ - final String username = mLabAccount.getUsername(); - final String password = mLabAccount.getPassword(); - final String homeTenantId = mLabAccount.getHomeTenantId(); - - // Shared Steps 2693823: Set up LTW with WPJ cert (non-joined) - // Install new LTW with broker SDK changes of broker selection logic - // installed LTW by SupportedBrokers annotation - - // Install BrokerHost app with broker selection logic - final BrokerHost brokerHost = new BrokerHost(); - brokerHost.install(); - brokerHost.launch(); - - // Under Multiple WPJ - Click on "Device Registration" button - brokerHost.multipleWpjApiFragment.performDeviceRegistration(username, password); - - // Uninstall brokerHost - brokerHost.uninstall(); - - // Install new Authenticator with broker SDK changes of broker selection logic - final BrokerMicrosoftAuthenticator brokerMicrosoftAuthenticator = new BrokerMicrosoftAuthenticator(); - brokerMicrosoftAuthenticator.install(); - - // Install BrokerHost with NO Broker Selection Logic. Navigate to "Single WPJ API" Tab. - final BrokerHost brokerHostWithoutBrokerSelection = new BrokerHost(BrokerHost.BROKER_HOST_WITHOUT_BROKER_SELECTION_APK); - brokerHostWithoutBrokerSelection.install(); - brokerHostWithoutBrokerSelection.launch(); - - // click on "device id" button - // You should see a popup with a deviceId - final String deviceId = brokerHostWithoutBrokerSelection.obtainDeviceId(); - Assert.assertTrue(!deviceId.isEmpty()); - - // click on "device state" button - // You should see the "joined" state - final String state = brokerHostWithoutBrokerSelection.getDeviceState(); - Assert.assertTrue("Assert that the device state is true", state.contains("true")); - - // click on "get wpj upn" button - // You should see the upn with which we performed join - final String upn = brokerHostWithoutBrokerSelection.getAccountUpn(); - Assert.assertEquals(username, upn); - - // click on "get device token" - // You should see the popup with device token - final String token = brokerHostWithoutBrokerSelection.getDeviceToken(); - Assert.assertTrue(!token.isEmpty()); - - // Click on "wpj leave" button - // Device should WPJ leave successfully. A popup with leave successful message should be shown - brokerHostWithoutBrokerSelection.wpjLeave(); - - // Enter tenantId in tenantId text box - // Click on "Get preprovisioning blob" button - // You should see a popup with the blob - final String blob = brokerHostWithoutBrokerSelection.getBlob(homeTenantId); - Assert.assertTrue(!blob.isEmpty()); - - // Enter username in username textbox - // Click on "User based join" button - // Complete the device registration flow. See a popup message that the flow was successful - brokerHostWithoutBrokerSelection.performDeviceRegistration(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; - } -} From 31b520670dbe3ea3e6e3b2e31fc47462b8484d3c Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Sun, 4 Aug 2024 14:30:14 -0700 Subject: [PATCH 10/17] ignore unnecessary test --- .../testpass/msalonly/update/TestCaseUpdateCompanyPortal.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateCompanyPortal.kt b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateCompanyPortal.kt index 035f584b85..d50f34ee4c 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateCompanyPortal.kt +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateCompanyPortal.kt @@ -41,10 +41,12 @@ import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadP 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.Ignore import org.junit.Test import java.util.* // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2516681 +@Ignore @RetryOnFailure @LTWTests class TestCaseUpdateCompanyPortal : AbstractMsalCustomBrokerInstallationTest() { From 47f7451fac218ca9e27f94f699fdfbd68c624bbc Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Thu, 8 Aug 2024 12:54:06 -0700 Subject: [PATCH 11/17] increase sleep time to reliably run a test --- .../msal/automationapp/testpass/broker/ltw/TestCase2582292.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java index e37a73bc82..97298c8e12 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java @@ -86,7 +86,7 @@ public void test_2582292() throws LabApiException, InterruptedException, UiObjec msalTestApp.launch(); msalTestApp.handleFirstRun(); try { - Thread.sleep(3000); + Thread.sleep(5000); } catch (final InterruptedException e) { throw new AssertionError(e); } From 2809f63d8129c8de73edbf06066304602aabf00c Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Sun, 11 Aug 2024 20:56:42 -0700 Subject: [PATCH 12/17] retry on failure --- .../msal/automationapp/testpass/broker/ltw/TestCase2582292.java | 2 ++ .../msal/automationapp/testpass/broker/ltw/TestCase2584411.java | 2 ++ .../msal/automationapp/testpass/broker/ltw/TestCase2584412.java | 2 ++ .../msal/automationapp/testpass/broker/ltw/TestCase2584414.java | 1 + 4 files changed, 7 insertions(+) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java index 97298c8e12..2fd45acd7d 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2582292.java @@ -27,6 +27,7 @@ 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.LTWTests; +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.MsalTestApp; import com.microsoft.identity.client.ui.automation.broker.BrokerHost; @@ -51,6 +52,7 @@ // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2582292 @LTWTests @SupportedBrokers(brokers = {BrokerLTW.class}) +@RetryOnFailure public class TestCase2582292 extends AbstractMsalBrokerTest { @Test diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584411.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584411.java index cdacf9c02c..5d9ffae6da 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584411.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584411.java @@ -27,6 +27,7 @@ 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.LTWTests; +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.MsalTestApp; import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; @@ -51,6 +52,7 @@ @LTWTests @SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class}) @RunWith(Parameterized.class) +@RetryOnFailure public class TestCase2584411 extends AbstractMsalBrokerTest { private final UserType mUserType; diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584412.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584412.java index 8a44dae62e..0ee9dcdcdd 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584412.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584412.java @@ -27,6 +27,7 @@ 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.LTWTests; +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.MsalTestApp; import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; @@ -51,6 +52,7 @@ @LTWTests @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) @RunWith(Parameterized.class) +@RetryOnFailure public class TestCase2584412 extends AbstractMsalBrokerTest { private final UserType mUserType; diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java index ed130c3586..73507e5f51 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java @@ -53,6 +53,7 @@ @RetryOnFailure @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) @RunWith(Parameterized.class) +@RetryOnFailure public class TestCase2584414 extends AbstractMsalBrokerTest { private final UserType mUserType; From af4f89351ea0b7c90a57c4aa04bbb5bf0c9a417d Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 14 Aug 2024 13:02:05 -0700 Subject: [PATCH 13/17] ignored unnecessary test --- .../msal/automationapp/testpass/broker/ltw/TestCase2571565.java | 2 +- .../testpass/msalonly/update/TestCaseUpdateAuthenticator.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571565.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571565.java index a4cb387381..e49068c4a7 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571565.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2571565.java @@ -143,7 +143,7 @@ public void test_2571565() throws Throwable { @Override public LabQuery getLabQuery() { return LabQuery.builder() - .userType(UserType.CLOUD) + .userType(mUserType) .build(); } diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateAuthenticator.kt b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateAuthenticator.kt index 6c4e8873b2..f7fc988704 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateAuthenticator.kt +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/msalonly/update/TestCaseUpdateAuthenticator.kt @@ -41,12 +41,14 @@ import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadP 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.Ignore import org.junit.Test import java.util.* // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2516681 @RetryOnFailure @LTWTests +@Ignore class TestCaseUpdateAuthenticator : AbstractMsalCustomBrokerInstallationTest() { @Test From ea322fa11b95ab44a854a59901d4aa5d4196e557 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Thu, 15 Aug 2024 14:21:49 -0700 Subject: [PATCH 14/17] retry added --- .../msal/automationapp/testpass/broker/ltw/TestCase2572283.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java index 9e1163d58f..0a7ffbdeb9 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java @@ -27,6 +27,7 @@ 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.LTWTests; +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.MsalTestApp; import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; @@ -49,6 +50,7 @@ // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2572283 @LTWTests @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) +@RetryOnFailure @RunWith(Parameterized.class) public class TestCase2572283 extends AbstractMsalBrokerTest { private final UserType mUserType; From 09311d762979700c37e12e273b7bd9724a5ff0ec Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Tue, 24 Sep 2024 11:14:18 -0700 Subject: [PATCH 15/17] removed retry --- .../msal/automationapp/testpass/broker/ltw/TestCase2584414.java | 1 - 1 file changed, 1 deletion(-) diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java index 73507e5f51..ed130c3586 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java @@ -53,7 +53,6 @@ @RetryOnFailure @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) @RunWith(Parameterized.class) -@RetryOnFailure public class TestCase2584414 extends AbstractMsalBrokerTest { private final UserType mUserType; From 2dfcc30e21c612fbbae914a4afcd8e99d62032f2 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Mon, 30 Sep 2024 11:47:30 -0400 Subject: [PATCH 16/17] save test --- common | 2 +- .../testpass/broker/ltw/TestCase3029738.java | 114 ++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java diff --git a/common b/common index 667c65cdb8..b2da42e8b7 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 667c65cdb80f5c6bd2c6edb4250c14bd0355468c +Subproject commit b2da42e8b777f0421440950bdbdd7505f0ac5f28 diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java new file mode 100644 index 0000000000..68734b2a71 --- /dev/null +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java @@ -0,0 +1,114 @@ +package com.microsoft.identity.client.msal.automationapp.testpass.broker.ltw; + +import androidx.annotation.NonNull; + +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.LTWTests; +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.MsalTestApp; +import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; +import com.microsoft.identity.client.ui.automation.broker.BrokerLTW; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; +import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.MicrosoftStsPromptHandlerParameters; +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; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; +import java.util.List; + +// +// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3029738 +@LTWTests +@RetryOnFailure +@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class}) +@RunWith(Parameterized.class) +public class TestCase3029738 extends AbstractMsalBrokerTest { + + private final UserType mUserType; + + public TestCase3029738(@NonNull UserType userType) { + mUserType = userType; + } + + @Parameterized.Parameters(name = "{0}") + public static List userType() { + return Arrays.asList( + UserType.MSA, + UserType.CLOUD + ); + } + + @Test + public void test() throws Throwable { + // Fetch account credentials + final String username = mLabAccount.getUsername(); + final String password = mLabAccount.getPassword(); + + // Install and launch msal test app + // set configuration based on user type + final MsalTestApp msalTestApp = new MsalTestApp(); + msalTestApp.install(); + msalTestApp.launch(); + msalTestApp.handleFirstRunBasedOnUserType(mUserType); + + // Prompt handler for the subsequent + final MicrosoftStsPromptHandlerParameters promptHandlerParameters = MicrosoftStsPromptHandlerParameters.builder() + .prompt(PromptParameter.SELECT_ACCOUNT) + .loginHint(username) + .sessionExpected(false) + .broker(mBroker) + .expectingBrokerAccountChooserActivity(false) + .expectingProvidedAccountInBroker(false) + .expectingLoginPageAccountPicker(false) + .expectingProvidedAccountInCookie(false) + .consentPageExpected(false) + .passwordPageExpected(true) + .speedBumpExpected(false) + .registerPageExpected(false) + .enrollPageExpected(false) + .staySignedInPageExpected(false) + .verifyYourIdentityPageExpected(false) + .howWouldYouLikeToSignInExpected(false) + .build(); + + // Make sure we get a token + final String token = msalTestApp.acquireToken(username, password, promptHandlerParameters, true); + Assert.assertNotNull(token); + } + + @Override + public LabQuery getLabQuery() { + return LabQuery.builder() + .userType(mUserType) + .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 0cdfbc18609cf2ac5e2e23ddddf6c1cd06d00afd Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 22 Oct 2024 22:01:35 -0400 Subject: [PATCH 17/17] push changes --- msalautomationapp/build.gradle | 7 ++++++ .../testpass/broker/ltw/TestCase2572283.java | 1 - .../testpass/broker/ltw/TestCase3029738.java | 17 ++++++++++---- ...tCase3026459.java => TestCase3026421.java} | 22 +++++++++---------- 4 files changed, 31 insertions(+), 16 deletions(-) rename msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/{TestCase3026459.java => TestCase3026421.java} (88%) diff --git a/msalautomationapp/build.gradle b/msalautomationapp/build.gradle index 2f83b45f1c..81bd3c6bb3 100644 --- a/msalautomationapp/build.gradle +++ b/msalautomationapp/build.gradle @@ -7,6 +7,12 @@ if (project.hasProperty("distMsalVersion")) { msalVersion = distMsalVersion } +// Used to check what flights are passed during pipeline runs +def copyOfLocalFlights = "" +if (project.hasProperty("localFlights")) { + copyOfLocalFlights = localFlights +} + android { packagingOptions { @@ -67,6 +73,7 @@ android { buildConfigField("String", BROKER_LTW, "\"$BROKER_LTW\"") buildConfigField("String", BROKER_HOST, "\"$BROKER_HOST\"") buildConfigField("String", AUTO_BROKER, "\"$AUTO_BROKER\"") + buildConfigField("String", "COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES", "\"$copyOfLocalFlights\"") } testOptions { diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java index 33b9be5661..7941f3c952 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572283.java @@ -51,7 +51,6 @@ @LTWTests @RetryOnFailure @SupportedBrokers(brokers = {BrokerCompanyPortal.class}) -@RetryOnFailure @RunWith(Parameterized.class) public class TestCase2572283 extends AbstractMsalBrokerTest { private final UserType mUserType; diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java index 68734b2a71..14a4cc5d04 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase3029738.java @@ -2,22 +2,23 @@ import androidx.annotation.NonNull; +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.LTWTests; 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.MsalTestApp; -import com.microsoft.identity.client.ui.automation.broker.BrokerCompanyPortal; import com.microsoft.identity.client.ui.automation.broker.BrokerLTW; -import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.MicrosoftStsPromptHandlerParameters; +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.Assume; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -25,11 +26,11 @@ import java.util.Arrays; import java.util.List; -// +// Sign in with AAD and MSA account // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3029738 @LTWTests @RetryOnFailure -@SupportedBrokers(brokers = {BrokerMicrosoftAuthenticator.class}) +@SupportedBrokers(brokers = {BrokerLTW.class}) @RunWith(Parameterized.class) public class TestCase3029738 extends AbstractMsalBrokerTest { @@ -49,6 +50,10 @@ public static List userType() { @Test public void test() throws Throwable { + // Check flight, this is checking what was passed to automation app, not the broker apks + Assume.assumeTrue( "EnableSystemAccountManager flight is not activated, Test will be skipped", + BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableSystemAccountManager:true")); + // Fetch account credentials final String username = mLabAccount.getUsername(); final String password = mLabAccount.getPassword(); @@ -83,6 +88,10 @@ public void test() throws Throwable { // Make sure we get a token final String token = msalTestApp.acquireToken(username, password, promptHandlerParameters, true); Assert.assertNotNull(token); + + // Launch OS Account page and make sure username shows up in account manager. + getSettingsScreen().launchAccountListPage(); + Assert.assertTrue(UiAutomatorUtils.obtainUiObjectWithText(username).exists()); } @Override diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026459.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026421.java similarity index 88% rename from msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026459.java rename to msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026421.java index 017365ad6b..12bc3e7b98 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026459.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TransferToken/TestCase3026421.java @@ -24,6 +24,7 @@ import com.microsoft.identity.client.Prompt; +import com.microsoft.identity.client.msal.automationapp.BuildConfig; 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; @@ -31,10 +32,10 @@ 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.LTWTests; -import com.microsoft.identity.client.ui.automation.annotations.LocalBrokerHostDebugUiTest; 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.BrokerLTW; 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; @@ -43,7 +44,7 @@ import com.microsoft.identity.labapi.utilities.constants.TempUserType; import com.microsoft.identity.labapi.utilities.constants.UserType; -import org.junit.Before; +import org.junit.Assume; import org.junit.Test; import java.util.ArrayList; @@ -54,18 +55,17 @@ // Transfer token generation and restore // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3026421 @LTWTests -@LocalBrokerHostDebugUiTest @RetryOnFailure -@SupportedBrokers(brokers = {BrokerHost.class}) -public class TestCase3026459 extends AbstractMsalBrokerTest { - - @Before - public void before() { - ((BrokerHost) mBroker).enableGenerateAndSaveTransferToken(); - } +@SupportedBrokers(brokers = {BrokerLTW.class}) +public class TestCase3026421 extends AbstractMsalBrokerTest { @Test - public void test_3026459() throws Throwable { + public void test_3026421() throws Throwable { + // Check flight, this is checking what was passed to automation app, not the broker apks + Assume.assumeTrue( " EnableGenerateAndStoreTransferTokens flight is not activated, Test will be skipped", + BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableGenerateAndStoreTransferTokens:true")); + + // Start credentials final String username = mLabAccount.getUsername(); final String password = mLabAccount.getPassword();