fix(core): wrong fetch injected to snapshot downloader (#9460)

This commit is contained in:
liuyi
2024-12-31 16:51:19 +08:00
committed by GitHub
parent e8aabed3fa
commit 43adb85e7d
5 changed files with 44 additions and 6 deletions

View File

@@ -0,0 +1,33 @@
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 importLink = page.getByText('Use this template');
const href = await importLink.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();
btn.click();
await waitForEditorLoad(page);
});