@@ -74,6 +74,28 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })(
7474 await expect ( socialButtonContainers . first ( ) . locator ( '.cl-button' ) ) . toHaveCount ( 3 ) ;
7575 } ) ;
7676
77+ test ( 'should show "Last used" badge when lastAuthenticationStrategy is saml_google' , async ( { page, context } ) => {
78+ const u = createTestUtils ( { app, page, context } ) ;
79+ await mockLastAuthenticationStrategyResponse ( page , 'saml_google' ) ;
80+
81+ await u . po . signIn . goTo ( ) ;
82+ await u . po . signIn . waitForMounted ( ) ;
83+
84+ // Ensure "Last used" badge is present.
85+ const lastUsedBadge = page . locator ( '.cl-lastAuthenticationStrategyBadge' ) ;
86+ await expect ( lastUsedBadge ) . toBeVisible ( ) ;
87+ await expect ( lastUsedBadge ) . toHaveCount ( 1 ) ;
88+
89+ const btn = page . getByRole ( 'button' , { name : 'Last used Sign in with Google' } ) ;
90+ await expect ( btn ) . toBeVisible ( ) ;
91+
92+ // Ensure the last used social button has been pulled to the first row.
93+ const socialButtonContainers = u . page . locator ( '.cl-socialButtons' ) ;
94+ await expect ( socialButtonContainers ) . toHaveCount ( 2 ) ;
95+ await expect ( socialButtonContainers . first ( ) . locator ( '.cl-button__google' ) ) . toHaveCount ( 1 ) ;
96+ await expect ( socialButtonContainers . last ( ) . locator ( '.cl-button' ) ) . toHaveCount ( 2 ) ;
97+ } ) ;
98+
7799 test ( 'should show "Last used" badge when lastAuthenticationStrategy is oauth_google' , async ( { page, context } ) => {
78100 const u = createTestUtils ( { app, page, context } ) ;
79101 await mockLastAuthenticationStrategyResponse ( page , 'oauth_google' ) ;
0 commit comments