fix(pw): Cloud - OpenID Auth Flow test fail issue

This commit is contained in:
Ramesh Mane
2025-08-16 10:02:17 +00:00
parent 5849d5e834
commit f435face3c
2 changed files with 8 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ export class CloudOpenIDLoginPage extends BasePage {
async goto(_title = 'test', email: string) {
await this.ssoLoginPage.goto(email);
await this.ssoLoginPage.signIn({ email });
await this.ssoLoginPage.signIn({ email, waitForUserInfoMenu: false });
// // reload page to get latest app info
// await this.rootPage.reload({ waitUntil: 'networkidle' });
// // click sign in with SAML

View File

@@ -21,7 +21,7 @@ export class CloudSSOLoginPage extends BasePage {
return this.rootPage.locator('html');
}
async signIn({ email }: { email: string }) {
async signIn({ email, waitForUserInfoMenu = true }: { email: string; waitForUserInfoMenu?: boolean }) {
const signIn = this.get();
await signIn.locator('[data-testid="nc-form-org-sso-signin__email"]').waitFor();
@@ -32,9 +32,12 @@ export class CloudSSOLoginPage extends BasePage {
signIn.getByTestId('nc-form-signin__submit').click(),
]);
const userInfoMenu = this.rootPage.locator(`[data-testid="nc-sidebar-userinfo"]`);
await userInfoMenu.waitFor();
// If it is cloud auth login flow then we first login sso and then redirect to localhost:4000 and there we need to login again
if (waitForUserInfoMenu) {
const userInfoMenu = this.rootPage.locator(`[data-testid="nc-sidebar-userinfo"]`);
await userInfoMenu.waitFor();
await expect(userInfoMenu).toHaveAttribute('data-email', email);
await expect(userInfoMenu).toHaveAttribute('data-email', email);
}
}
}