Skip to content

Commit 05182e6

Browse files
authored
Update BrokerSelection E2E Test, Fixes AB#3285353 (#2298)
[AB#3285353](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3285353) Main PR: AzureAD/ad-accounts-for-android#3101 We'll make ipc requests to each broker apps to get the flight values. If the broker selection v2 flight is enabled in all 3, then we expect the new result (LTW is the broker).
1 parent 72deaa0 commit 05182e6

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572249.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -71,6 +72,12 @@ public static List<UserType> userType() {
7172

7273
@Test
7374
public void test_2572249_LTW_SSOAfterLTWUninstallIfAuthenticatorPresent() throws Throwable {
75+
if (BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true")) {
76+
// No longer applicable with V2 protocol.
77+
return;
78+
}
79+
80+
7481
final String username = mLabAccount.getUsername();
7582
final String password = mLabAccount.getPassword();
7683

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2572294.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -105,7 +106,13 @@ public void test_2572294_LTW_AuthenticatorHighestPriorityLTWAuthCP() throws Thro
105106

106107
msalTestApp.handleBackButton();
107108
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
108-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
109+
110+
// Check flight, if v2 is enabled, LTW should have the highest priority.
111+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
112+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
113+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
114+
115+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
109116
}
110117

111118
@Override

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584409.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -105,7 +106,13 @@ public void test_2584409_LTW_AuthenticatorHighestPriorityLTWCPAuth() throws Thro
105106

106107
msalTestApp.handleBackButton();
107108
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
108-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
109+
110+
// Check flight, if v2 is enabled, LTW should have the highest priority.
111+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
112+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
113+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
114+
115+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
109116
}
110117

111118
@Override

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584410.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -108,7 +109,13 @@ public void test_2584410_LTW_AuthenticatorHighestPriorityAuthLTWCP() throws Thro
108109

109110
msalTestApp.handleBackButton();
110111
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
111-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
112+
113+
// Check flight, if v2 is enabled, LTW should have the highest priority.
114+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
115+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
116+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
117+
118+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
112119
}
113120

114121
@Override

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584411.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -67,6 +68,7 @@ public static List<UserType> userType() {
6768
UserType.CLOUD
6869
);
6970
}
71+
7072
@Test
7173
public void test_2584411_LTW_AuthenticatorHighestPriorityAuthCPLTW() throws Throwable {
7274
final String username = mLabAccount.getUsername();
@@ -107,7 +109,13 @@ public void test_2584411_LTW_AuthenticatorHighestPriorityAuthCPLTW() throws Thro
107109

108110
msalTestApp.handleBackButton();
109111
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
110-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
112+
113+
// Check flight, if v2 is enabled, LTW should have the highest priority.
114+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
115+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
116+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
117+
118+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
111119
}
112120

113121
@Override

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584412.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -107,7 +108,13 @@ public void test_2584412_LTW_AuthenticatorHighestPriorityCPAuthLTW() throws Thro
107108

108109
msalTestApp.handleBackButton();
109110
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
110-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
111+
112+
// Check flight, if v2 is enabled, LTW should have the highest priority.
113+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
114+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
115+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
116+
117+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
111118
}
112119

113120
@Override

msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/ltw/TestCase2584414.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import androidx.annotation.NonNull;
2626

27+
import com.microsoft.identity.client.msal.automationapp.BuildConfig;
2728
import com.microsoft.identity.client.msal.automationapp.R;
2829
import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest;
2930
import com.microsoft.identity.client.ui.automation.annotations.LTWTests;
@@ -107,7 +108,13 @@ public void test_2584414_LTW_AuthenticatorHighestPriorityCPLTWAuth() throws Thro
107108

108109
msalTestApp.handleBackButton();
109110
final String activeBroker = msalTestApp.getActiveBrokerPackageName();
110-
Assert.assertEquals("Active broker pkg name : " + BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME, activeBroker);
111+
112+
// Check flight, if v2 is enabled, LTW should have the highest priority.
113+
final String activeBrokerApp = BuildConfig.COPY_OF_LOCAL_FLIGHTS_FOR_TEST_PURPOSES.contains("EnableBrokerDiscoveryV2Protocol:true") ?
114+
BrokerLTW.BROKER_LTW_APP_PACKAGE_NAME :
115+
BrokerMicrosoftAuthenticator.AUTHENTICATOR_APP_PACKAGE_NAME;
116+
117+
Assert.assertEquals("Active broker pkg name : " + activeBrokerApp, activeBroker);
111118
}
112119
@Override
113120
public LabQuery getLabQuery() {

0 commit comments

Comments
 (0)