Skip to content

Commit

Permalink
covered old app installations as well
Browse files Browse the repository at this point in the history
  • Loading branch information
somalaya committed Nov 29, 2023
1 parent 68f2492 commit ff70cee
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 434 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
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;
Expand All @@ -36,17 +38,38 @@
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;

// Even Authenticator has the highest priority, if CP already has an artifact, CP will remain the broker.
// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2579095
@LTWTests
@RunOnAPI29Minus
@RetryOnFailure
@RunWith(Parameterized.class)
public class TestCase2579095 extends AbstractMsalBrokerTest {

private final UserType mUserType;

public TestCase2579095(@NonNull UserType userType) {
mUserType = userType;
}

@Parameterized.Parameters(name = "{0}")
public static List<UserType> userType() {
return Arrays.asList(
UserType.MSA,
UserType.CLOUD
);
}

@Test
public void test_2579095() throws Throwable {
final String username = mLabAccount.getUsername();
Expand All @@ -65,7 +88,7 @@ public void test_2579095() throws Throwable {
final OneAuthTestApp oldOneAuthTestApp = new OneAuthTestApp();
oldOneAuthTestApp.installOldApk();
oldOneAuthTestApp.launch();
oldOneAuthTestApp.handleFirstRun();
oldOneAuthTestApp.handleFirstRunBasedOnUserType(mUserType);

// acquire token interactively on OneAuthTestApp
final FirstPartyAppPromptHandlerParameters promptHandlerParametersOneAuth = FirstPartyAppPromptHandlerParameters.builder()
Expand All @@ -92,7 +115,7 @@ public void test_2579095() throws Throwable {
// install new MsalTestApp
msalTestApp.install();
msalTestApp.launch();
msalTestApp.handleFirstRun();
msalTestApp.handleFirstRunBasedOnUserType(mUserType);

// acquire token interactively on MsalTestApp and should not get prompt
final MicrosoftStsPromptHandlerParameters promptHandlerParametersMsal = MicrosoftStsPromptHandlerParameters.builder()
Expand Down Expand Up @@ -126,12 +149,14 @@ public void test_2579095() throws Throwable {

@Override
public LabQuery getLabQuery() {
return null;
return LabQuery.builder()
.userType(mUserType)
.build();
}

@Override
public TempUserType getTempUserType() {
return TempUserType.BASIC;
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
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;
Expand All @@ -35,16 +37,37 @@
import com.microsoft.identity.client.ui.automation.interaction.PromptParameter;
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;

// If LTW is the active broker, and request is made through Authenticator from OneAuth, nothing should break
// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2582288
@LTWTests
@RunOnAPI29Minus("OneAuth test app dependency")
@SupportedBrokers(brokers = {BrokerLTW.class})
@RunWith(Parameterized.class)
public class TestCase2582288 extends AbstractMsalBrokerTest {

private final UserType mUserType;

public TestCase2582288(@NonNull UserType userType) {
mUserType = userType;
}

@Parameterized.Parameters(name = "{0}")
public static List<UserType> userType() {
return Arrays.asList(
UserType.MSA,
UserType.CLOUD
);
}
@Test
public void test_2582288() throws Throwable {
final String username = mLabAccount.getUsername();
Expand All @@ -57,7 +80,7 @@ public void test_2582288() throws Throwable {
final MsalTestApp msalTestApp = new MsalTestApp();
msalTestApp.install();
msalTestApp.launch();
msalTestApp.handleFirstRun();
msalTestApp.handleFirstRunBasedOnUserType(mUserType);

// AcquireToken Interactively in MsalTestApp
final FirstPartyAppPromptHandlerParameters promptHandlerParameters = FirstPartyAppPromptHandlerParameters.builder()
Expand All @@ -83,7 +106,7 @@ public void test_2582288() throws Throwable {
final OneAuthTestApp oneAuthTestApp = new OneAuthTestApp();
oneAuthTestApp.installOldApk();
oneAuthTestApp.launch();
oneAuthTestApp.handleFirstRun();
oneAuthTestApp.handleFirstRunBasedOnUserType(mUserType);

// Enter username in AccountName textbox
oneAuthTestApp.handleUserNameInput(username);
Expand All @@ -95,12 +118,14 @@ public void test_2582288() throws Throwable {

@Override
public LabQuery getLabQuery() {
return null;
return LabQuery.builder()
.userType(mUserType)
.build();
}

@Override
public TempUserType getTempUserType() {
return TempUserType.BASIC;
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
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;
Expand All @@ -35,16 +37,38 @@
import com.microsoft.identity.client.ui.automation.interaction.PromptParameter;
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;

// If LTW is the active broker, and request is made through CP from OneAuth, nothing should break
// https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2582289
@LTWTests
@RunOnAPI29Minus("OneAuth test app dependency")
@SupportedBrokers(brokers = {BrokerLTW.class})
@RunWith(Parameterized.class)
public class TestCase2582289 extends AbstractMsalBrokerTest {

private final UserType mUserType;

public TestCase2582289(@NonNull UserType userType) {
mUserType = userType;
}

@Parameterized.Parameters(name = "{0}")
public static List<UserType> userType() {
return Arrays.asList(
UserType.MSA,
UserType.CLOUD
);
}

@Test
public void test_2582289() throws Throwable {
final String username = mLabAccount.getUsername();
Expand All @@ -57,7 +81,7 @@ public void test_2582289() throws Throwable {
final MsalTestApp msalTestApp = new MsalTestApp();
msalTestApp.install();
msalTestApp.launch();
msalTestApp.handleFirstRun();
msalTestApp.handleFirstRunBasedOnUserType(mUserType);

// AcquireToken Interactively in MsalTestApp
final FirstPartyAppPromptHandlerParameters promptHandlerParameters = FirstPartyAppPromptHandlerParameters.builder()
Expand All @@ -83,7 +107,7 @@ public void test_2582289() throws Throwable {
final OneAuthTestApp oneAuthTestApp = new OneAuthTestApp();
oneAuthTestApp.installOldApk();
oneAuthTestApp.launch();
oneAuthTestApp.handleFirstRun();
oneAuthTestApp.handleFirstRunBasedOnUserType(mUserType);

// Enter username in AccountName textbox
oneAuthTestApp.handleUserNameInput(username);
Expand All @@ -95,12 +119,14 @@ public void test_2582289() throws Throwable {

@Override
public LabQuery getLabQuery() {
return null;
return LabQuery.builder()
.userType(mUserType)
.build();
}

@Override
public TempUserType getTempUserType() {
return TempUserType.BASIC;
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public TestCase2582290(@NonNull UserType userType) {
@Parameterized.Parameters(name = "{0}")
public static List<UserType> userType() {
return Arrays.asList(
// UserType.MSA,
UserType.MSA,
UserType.CLOUD
);
}
Expand Down
Loading

0 comments on commit ff70cee

Please sign in to comment.