Files
AFFiNE-Mirror/tests/blocksuite/e2e/latex/block.spec.ts

63 lines
1.5 KiB
TypeScript

import { expect } from '@playwright/test';
import {
enterPlaygroundRoom,
focusRichText,
getPageSnapshot,
initEmptyParagraphState,
type,
} from '../utils/actions/index.js';
import { test } from '../utils/playwright.js';
test('add latex block using slash menu', async ({ page }, testInfo) => {
await enterPlaygroundRoom(page);
await initEmptyParagraphState(page);
await focusRichText(page);
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_init.json`
);
await type(page, '/eq\naaa');
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_finial.json`
);
});
test('add latex block using markdown shortcut with space', async ({
page,
}, testInfo) => {
await enterPlaygroundRoom(page);
await initEmptyParagraphState(page);
await focusRichText(page);
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_init.json`
);
await type(page, '$$$$ aaa');
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_finial.json`
);
});
test('add latex block using markdown shortcut with enter', async ({
page,
}, testInfo) => {
await enterPlaygroundRoom(page);
await initEmptyParagraphState(page);
await focusRichText(page);
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_init.json`
);
await type(page, '$$$$\naaa');
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_finial.json`
);
});