1+ // Copyright (c) Microsoft Corporation.
2+ // All rights reserved.
3+ //
4+ // This code is licensed under the MIT License.
5+ //
6+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7+ // of this software and associated documentation files(the "Software"), to deal
8+ // in the Software without restriction, including without limitation the rights
9+ // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10+ // copies of the Software, and to permit persons to whom the Software is
11+ // furnished to do so, subject to the following conditions :
12+ //
13+ // The above copyright notice and this permission notice shall be included in
14+ // all copies or substantial portions of the Software.
15+ //
16+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+ // THE SOFTWARE.
23+ package com.microsoft.identity.client.msal.automationapp.testpass.broker.msa
24+
25+ import com.microsoft.identity.client.msal.automationapp.R
26+ import com.microsoft.identity.client.msal.automationapp.testpass.broker.AbstractMsalBrokerTest
27+ import com.microsoft.identity.client.ui.automation.annotations.RetryOnFailure
28+ import com.microsoft.identity.client.ui.automation.app.OneDriveApp
29+ import com.microsoft.identity.client.ui.automation.app.OutlookApp
30+ import com.microsoft.identity.client.ui.automation.app.WordApp
31+ import com.microsoft.identity.client.ui.automation.installer.LocalApkInstaller
32+ import com.microsoft.identity.labapi.utilities.client.LabQuery
33+ import com.microsoft.identity.labapi.utilities.constants.TempUserType
34+ import com.microsoft.identity.labapi.utilities.constants.UserType
35+ import org.junit.Assert
36+ import org.junit.Test
37+
38+ // [Brokered] When Broker Installed, OneDrive and Office should show phone sign up option, Outlook should not
39+ // https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3040042
40+ @RetryOnFailure
41+ class TestCase3040042 : AbstractMsalBrokerTest (){
42+
43+ @Test
44+ @Throws(Throwable ::class )
45+ fun test_3040042 () {
46+ // Word should have phone sign-up option
47+ val word = WordApp (LocalApkInstaller ())
48+ word.install()
49+ Assert .assertTrue(" Word should have option for phone sign-up, but doesn't..." , word.checkPhoneSignUpIsAvailable())
50+
51+ // OneDrive should have phone sign-up option
52+ val onedrive = OneDriveApp (LocalApkInstaller ())
53+ onedrive.install()
54+ Assert .assertTrue(" OneDrive should have option for phone sign-up, but doesn't..." , onedrive.checkPhoneSignUpIsAvailable())
55+
56+ // Outlook should NOT have phone sign-up option
57+ val outlook = OutlookApp (LocalApkInstaller ())
58+ outlook.install();
59+ Assert .assertTrue(" Outlook should not have an option for phone sign-up, but does..." , outlook.checkPhoneSignUpIsNotAvailable())
60+ }
61+
62+ override fun getScopes (): Array <String > {
63+ return arrayOf(" User.read" )
64+ }
65+
66+ override fun getAuthority (): String {
67+ return mApplication.configuration.defaultAuthority.toString()
68+ }
69+
70+ override fun getConfigFileResourceId (): Int {
71+ return R .raw.msal_config_msa_only
72+ }
73+
74+ override fun getLabQuery (): LabQuery {
75+ return LabQuery .builder()
76+ .userType(UserType .MSA )
77+ .build()
78+ }
79+
80+ override fun getTempUserType (): TempUserType ? {
81+ return null ;
82+ }
83+ }
0 commit comments