diff --git a/packages/app/src/components/login-modal/index.tsx b/packages/app/src/components/login-modal/index.tsx index 8c2429c0eb..f398383196 100644 --- a/packages/app/src/components/login-modal/index.tsx +++ b/packages/app/src/components/login-modal/index.tsx @@ -11,7 +11,7 @@ interface LoginModalProps { export const LoginModal = ({ open, onClose }: LoginModalProps) => { return ( - +
{ const { triggerLoginModal } = useModal(); return ( - triggerLoginModal()}> + triggerLoginModal()} + data-testid="open-login-modal" + > A diff --git a/tests/contact-us.spec.ts b/tests/contact-us.spec.ts index c6a05382db..7c095a6056 100644 --- a/tests/contact-us.spec.ts +++ b/tests/contact-us.spec.ts @@ -5,10 +5,10 @@ loadPage(); test.describe('Open contact us', () => { test('Click about us', async ({ page }) => { - page.waitForTimeout(1000); + // page.waitForTimeout(1000); const currentWorkspace = page.getByTestId('current-workspace'); await currentWorkspace.click(); - + page.waitForTimeout(1000); await page .getByRole('tooltip', { name: 'A AFFiNE Log in to sync with affine About AFFiNE', diff --git a/tests/login.spec.ts b/tests/login.spec.ts new file mode 100644 index 0000000000..c1c41abae4 --- /dev/null +++ b/tests/login.spec.ts @@ -0,0 +1,17 @@ +import { test, expect, type Page } from '@playwright/test'; +import { loadPage } from './libs/load-page'; + +loadPage(); + +test.describe('Login Flow', () => { + test('Open Login Modal', async ({ page }) => { + await page.getByTestId('current-workspace').click(); + await page.waitForTimeout(800); + // why don't we use waitForSelector, It seems that waitForSelector not stable? + await page.getByTestId('open-login-modal').click(); + await page.waitForTimeout(800); + await page + .getByRole('heading', { name: 'Currently not logged in' }) + .click(); + }); +});