Files
AFFiNE-Mirror/tests/login.spec.ts
T
2022-12-24 22:39:13 +08:00

38 lines
1.2 KiB
TypeScript

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();
});
test('Open google firebase page', 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);
const [firebasePage] = await Promise.all([
page.waitForEvent('popup'),
page
.getByRole('button', {
name: 'Google Continue with Google Set up an AFFINE account to sync data',
})
.click(),
]);
expect(await firebasePage.url()).toContain(
'.firebaseapp.com/__/auth/handler'
);
});
});