mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-05 03:25:10 +08:00
36 lines
1015 B
TypeScript
36 lines
1015 B
TypeScript
import { test } from '@affine-test/kit/playwright';
|
|
import { createRandomUser, loginUser } from '@affine-test/kit/utils/cloud';
|
|
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
const user = await createRandomUser();
|
|
await loginUser(page, user);
|
|
});
|
|
|
|
test('import from template should work', async ({ page }) => {
|
|
await page.goto('https://affine.pro/templates', { waitUntil: 'load' });
|
|
|
|
await page.click('.template-list > a:first-child');
|
|
const importButton = page.getByRole('button', {
|
|
name: 'Use this template',
|
|
});
|
|
|
|
const href = await importButton.evaluate((el: HTMLElement) => {
|
|
const a = el.closest('a');
|
|
if (!a) {
|
|
throw new Error('Import link not found');
|
|
}
|
|
return a.href;
|
|
});
|
|
|
|
const url = new URL(href);
|
|
|
|
await page.goto(url.pathname + url.search);
|
|
|
|
const btn = page.getByTestId('import-template-to-workspace-btn');
|
|
|
|
await btn.isVisible();
|
|
await btn.click();
|
|
await waitForEditorLoad(page);
|
|
});
|