Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(pw): wait for form to unmount

Ramesh Mane5849d5e834a0
diff --git a/tests/playwright/pages/OrgAdmin/OpenIDLoginPage.ts b/tests/playwright/pages/OrgAdmin/OpenIDLoginPage.ts
index a502f49c1f..aa1e9e37d3 100644
--- a/tests/playwright/pages/OrgAdmin/OpenIDLoginPage.ts
+++ b/tests/playwright/pages/OrgAdmin/OpenIDLoginPage.ts
@@ -28,16 +28,20 @@ export class CloudOpenIDLoginPage extends BasePage {
async signIn({ email }: { email: string }) {
const signIn = this.get();
- await signIn.locator('[name="login"]').waitFor();
+ const loginLocator = signIn.locator('[name="login"]');
+ await loginLocator.waitFor({ state: 'visible' });
- await signIn.locator(`[name="login"]`).fill(email);
+ await loginLocator.fill(email);
await signIn.locator(`[name="password"]`).fill('dummy-password');
await signIn.locator(`[type="submit"]`).click();
+
+ await loginLocator.waitFor({ state: 'hidden' });
+
const authorize = this.get();
await Promise.all([
- this.rootPage.waitForNavigation({ url: /localhost:3000/ }),
+ this.rootPage.waitForNavigation({ url: /localhost:3000/, waitUntil: 'networkidle' }),
authorize.locator(`[type="submit"]`).click(),
]);
diff --git a/tests/playwright/pages/OrgAdmin/SAMLLoginPage.ts b/tests/playwright/pages/OrgAdmin/SAMLLoginPage.ts
index b81bb7e6d0..d10510003b 100644
--- a/tests/playwright/pages/OrgAdmin/SAMLLoginPage.ts
+++ b/tests/playwright/pages/OrgAdmin/SAMLLoginPage.ts
@@ -1,4 +1,4 @@
-import { Page } from '@playwright/test';
+import { expect, Page } from '@playwright/test';
import BasePage from '../Base';
import { ProjectsPage } from '../ProjectsPage';
import { CloudSSOLoginPage } from './SSOLoginPage';
@@ -31,21 +31,19 @@ export class CloudSAMLLoginPage extends BasePage {
async signIn({ email }: { email: string }) {
const signIn = this.get();
- await signIn.locator('#userName').waitFor();
+ await signIn.locator('#userName').waitFor({ state: 'visible' });
await signIn.locator(`#userName`).fill(email);
await signIn.locator(`#email`).fill(email);
+
await Promise.all([
- this.rootPage.waitForNavigation({ url: /localhost:3000/ }),
+ this.rootPage.waitForNavigation({ url: /localhost:3000/, waitUntil: 'networkidle' }),
signIn.locator(`#btn-sign-in`).click(),
]);
const userInfoMenu = this.rootPage.locator(`[data-testid="nc-sidebar-userinfo"]`);
await userInfoMenu.waitFor();
- await this.rootPage.waitForFunction(
- async selector => (await selector.getAttribute('data-email'))?.startsWith(email.split('@')[0]),
- userInfoMenu
- );
+ await expect(userInfoMenu).toHaveAttribute('data-email', email);
}
}
diff --git a/tests/playwright/pages/SsoIdpPage/GoogleLoginPage.ts b/tests/playwright/pages/SsoIdpPage/GoogleLoginPage.ts
index c6925639ce..a62403467e 100644
--- a/tests/playwright/pages/SsoIdpPage/GoogleLoginPage.ts
+++ b/tests/playwright/pages/SsoIdpPage/GoogleLoginPage.ts
@@ -1,7 +1,6 @@
import { Page } from '@playwright/test';
import BasePage from '../Base';
import { ProjectsPage } from '../ProjectsPage';
-import { expect } from '@playwright/test';
export class GoogleLoginPage extends BasePage {
readonly projectsPage: ProjectsPage;
diff --git a/tests/playwright/pages/SsoIdpPage/OpenIDLoginPage.ts b/tests/playwright/pages/SsoIdpPage/OpenIDLoginPage.ts
index d04f6acf79..c9ac893e49 100644
--- a/tests/playwright/pages/SsoIdpPage/OpenIDLoginPage.ts
+++ b/tests/playwright/pages/SsoIdpPage/OpenIDLoginPage.ts
@@ -24,7 +24,7 @@ export class OpenIDLoginPage extends BasePage {
async signIn({ email }: { email: string }) {
const signIn = this.get();
const loginLocator = signIn.locator('[name="login"]');
- await loginLocator.waitFor();
+ await loginLocator.waitFor({ state: 'visible' });
await loginLocator.fill(email);
await signIn.locator(`[name="password"]`).fill('dummy-password');