mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
fix(web): minor bug fixes (#9696)
Co-authored-by: Mirone <Saul-Mirone@outlook.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { initCodeBlockByOneStep } from './utils';
|
||||
|
||||
test.describe('Code Block Autocomplete Operations', () => {
|
||||
test('angle brackets are not supported', async ({ page }) => {
|
||||
// open the home page and insert the code block
|
||||
await initCodeBlockByOneStep(page);
|
||||
await page.keyboard.type('<');
|
||||
const codeUnit = page.locator('affine-code-unit');
|
||||
await expect(codeUnit).toHaveText('<');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
addCodeBlock,
|
||||
clickNewPageButton,
|
||||
waitForEditorLoad,
|
||||
} from '@affine-test/kit/utils/page-logic';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export const gotoContentFromTitle = async (page: Page) => {
|
||||
await page.keyboard.press('Enter');
|
||||
};
|
||||
|
||||
export const createNewPage = async (page: Page) => {
|
||||
await clickNewPageButton(page);
|
||||
};
|
||||
|
||||
export const initCodeBlockByOneStep = async (page: Page) => {
|
||||
await openHomePage(page);
|
||||
await createNewPage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await gotoContentFromTitle(page);
|
||||
await addCodeBlock(page);
|
||||
};
|
||||
@@ -230,6 +230,13 @@ export const addDatabase = async (page: Page, title?: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const addCodeBlock = async (page: Page) => {
|
||||
await page.keyboard.press('/');
|
||||
await expect(page.locator('affine-slash-menu .slash-menu')).toBeVisible();
|
||||
await page.keyboard.type('code');
|
||||
await page.getByTestId('Code Block').click();
|
||||
};
|
||||
|
||||
export const addDatabaseRow = async (page: Page, databaseTitle: string) => {
|
||||
const db = page.locator(`affine-database-table`, {
|
||||
has: page.locator(`affine-database-title:has-text("${databaseTitle}")`),
|
||||
|
||||
Reference in New Issue
Block a user