Skip to content

Commit 9cb872e

Browse files
committed
update test code to get guest tenant
1 parent 15418a4 commit 9cb872e

8 files changed

Lines changed: 29 additions & 3 deletions

File tree

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/client/ILabAccount.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public interface ILabAccount {
5858
*/
5959
String getHomeTenantId();
6060

61+
/**
62+
* Get the guest tenant id of this account.
63+
*
64+
* @return a String representing the account's home tenant id
65+
*/
66+
String getGuestTenantId();
67+
6168
/**
6269
* Get the object id in home tenant.
6370
*

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/client/LabAccount.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class LabAccount implements ILabAccount {
5555
private final String mHomeObjectId;
5656

5757
private final String mAssociatedClientId;
58+
private final String mGuestTenantId;
5859

5960
private final String mCloudUrl;
6061

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/client/LabClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ public ILabAccount getAccountFromLabJsonStringInMobileBuildVault(UserType userTy
371371
.userType(userType)
372372
.homeTenantId(accountEntry.getHomeTenantId())
373373
.homeObjectId(accountEntry.getHomeObjectId())
374+
.guestTenantId(accountEntry.getGuestTenantId())
374375
.associatedClientId(accountEntry.getAssociatedClientId())
375376
.azureEnvironment(accountEntry.getAzureEnvironment())
376377
.cloudUrl(accountEntry.getCloudUrl())

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/client/LabJsonStringAccountEntry.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public class LabJsonStringAccountEntry implements Serializable {
4848
@SerializedName("HomeTenantId")
4949
private String homeTenantId;
5050

51+
@SerializedName("GuestTenantId")
52+
private String guestTenantId;
53+
5154
@SerializedName("AssociatedClientId")
5255
private String associatedClientId;
5356

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/constants/LabConstants.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public class LabConstants {
2929
public static final String DEFAULT_LAB_SCOPE = "https://request.msidlab.com/.default";
3030
public static final String KEYVAULT_SCOPE = "https://vault.azure.net/.default";
3131
public static final String DEFAULT_LAB_CERT_ALIAS = "LabAuth.MSIDLab.com";
32-
public static final String MSID_LAB3 = "https://login.microsoftonline.com/msidlab3.com";
33-
public static final String MSID_LAB4 = "https://login.microsoftonline.com/msidlab4.com";
32+
public static final String ID4SLAB2 = "https://login.microsoftonline.com/id4slab2.onmicrosoft.com";
33+
public static final String ID4SLAB1 = "https://login.microsoftonline.com/id4slab1.onmicrosoft.com";
3434

3535
// TODO, REMOVE LEGACY UserTypes WHEN WE REMOVE LAB QUERY USAGE
3636
static final class UserType {
@@ -47,6 +47,7 @@ static final class UserType {
4747
public static final String USGOV = "usgov";
4848
public static final String USGOV_GUEST = "usgov_guest";
4949
public static final String CHINA = "china";
50+
public static final String CHINA_GUEST = "china_guest";
5051
public static final String QR_PIN = "qr_pin";
5152
public static final String TOKEN_BINDING = "token_binding";
5253
public static final String CBA = "cba";

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/constants/UserType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public enum UserType {
3737
USGOV(LabConstants.UserType.USGOV),
3838
USGOV_GUEST(LabConstants.UserType.USGOV_GUEST),
3939
CHINA(LabConstants.UserType.CHINA),
40+
CHINA_GUEST(LabConstants.UserType.CHINA_GUEST),
4041
QR_PIN(LabConstants.UserType.QR_PIN),
4142
TOKEN_BINDING(LabConstants.UserType.TOKEN_BINDING),
4243
CBA(LabConstants.UserType.CBA),

uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/broker/BrokerMicrosoftAuthenticator.java

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

2525
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
2626

27+
import static com.microsoft.identity.client.ui.automation.utils.CommonUtils.FIND_UI_ELEMENT_TIMEOUT_SHORT;
28+
2729
import android.Manifest;
2830
import android.content.Context;
2931
import android.content.pm.PackageInfo;
@@ -398,7 +400,7 @@ public void handleFirstRun() {
398400
// the skip button
399401
UiAutomatorUtils.handleButtonClick("com.azure.authenticator:id/frx_skip_button");
400402
// This is required for auth app as it has increased the compile sdk version to 34
401-
UiAutomatorUtils.handleButtonClickForObjectWithTextSafely("NOT NOW");
403+
UiAutomatorUtils.handleButtonClickForObjectWithTextSafely("NOT NOW", FIND_UI_ELEMENT_TIMEOUT_SHORT);
402404
shouldHandleFirstRun = false;
403405
}
404406
}

uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/utils/UiAutomatorUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,16 @@ public static void handleButtonClickForObjectWithTextSafely(@NonNull final Strin
550550
}
551551
}
552552

553+
public static void handleButtonClickForObjectWithTextSafely(@NonNull final String text, final long existsTimeout) {
554+
final UiObject button = obtainUiObjectWithText(text, existsTimeout);
555+
556+
try {
557+
button.click();
558+
} catch (final UiObjectNotFoundException e) {
559+
Logger.w(TAG, "Button with text \"" + text + "\" was not found: " + e.getMessage());
560+
}
561+
}
562+
553563
/**
554564
* Clicks the button element that contains text matching the supplied regex
555565
*/

0 commit comments

Comments
 (0)