mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-05 03:25:10 +08:00
94c9717a35
Close [BS-2315](https://linear.app/affine-design/issue/BS-2315/page-block-header) ### What Changes - Add header toolbar to page block (the first note in canvas) - Add e2e tests - Add some edgeless e2e test utils. **The package `@blocksuite/affine` was added to `"@affine-test/kit"`**
24 lines
762 B
TypeScript
24 lines
762 B
TypeScript
import { Path } from '@affine-tools/utils/path';
|
|
import type { Page } from '@playwright/test';
|
|
|
|
export async function importImage(page: Page, pathInFixtures: string) {
|
|
await page.evaluate(() => {
|
|
// Force fallback to input[type=file] in tests
|
|
// See https://github.com/microsoft/playwright/issues/8850
|
|
window.showOpenFilePicker = undefined;
|
|
});
|
|
|
|
const fileChooser = page.waitForEvent('filechooser');
|
|
|
|
// open slash menu
|
|
await page.keyboard.type('/image', { delay: 50 });
|
|
await page.keyboard.press('Enter');
|
|
await (
|
|
await fileChooser
|
|
).setFiles(
|
|
Path.dir(import.meta.url).join('../../../fixtures', pathInFixtures).value
|
|
);
|
|
// TODO(@catsjuice): wait for image to be loaded more reliably
|
|
await page.waitForTimeout(1000);
|
|
}
|