AFFiNE/tests/affine-legacy/0.8.0-canary.7/e2e/basic.spec.ts
Alex Yang 1b6a78cd00
feat!: unified migration logic in server electron, and browser (#4079)
Co-authored-by: Mirone <Saul-Mirone@outlook.com>
2023-09-06 07:44:53 +00:00

50 lines
1.6 KiB
TypeScript

import { resolve } from 'node:path';
import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor';
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
import {
check8080Available,
setupProxyServer,
} from '@affine-test/kit/utils/proxy';
import { expect, test } from '@playwright/test';
const { switchToNext } = setupProxyServer(
test,
resolve(__dirname, '..', 'static')
);
test('database migration', async ({ page, context }) => {
await check8080Available(context);
await page.goto('http://localhost:8081/');
await page.waitForSelector('v-line', {
timeout: 10000,
});
await page.getByTestId('new-page-button').click();
const title = page.locator('.affine-default-page-block-title');
await title.type('hello');
await page.keyboard.press('Enter', { delay: 50 });
await page.keyboard.press('/', { delay: 50 });
await page.keyboard.press('d');
await page.keyboard.press('a');
await page.keyboard.press('t');
await page.keyboard.press('a');
await page.keyboard.press('b');
await page.keyboard.press('a', { delay: 50 });
await page.keyboard.press('Enter', { delay: 50 });
const url = page.url();
await switchToNext();
await page.waitForTimeout(1000);
await page.goto(url);
await waitForEditorLoad(page);
// check page mode is correct
expect(await page.locator('v-line').nth(0).textContent()).toBe('hello');
expect(await page.locator('affine-database').isVisible()).toBe(true);
// check edgeless mode is correct
await clickEdgelessModeButton(page);
await page.waitForTimeout(200);
expect(await page.locator('affine-database').isVisible()).toBe(true);
});