Skip to content

Commit

Permalink
fix: flaky code block test
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlewind committed Dec 28, 2022
1 parent 8ab46b3 commit 8c80989
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 0 additions & 7 deletions tests/code.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ use fern::{
await initEmptyParagraphState(page);
await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');
await pasteByKeyboard(page);

const locator = page.locator('affine-paragraph');
Expand All @@ -126,7 +125,6 @@ test('drag copy paste', async ({ page }) => {

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');
await page.keyboard.type('use');

const position = await page.evaluate(() => {
Expand Down Expand Up @@ -157,7 +155,6 @@ test('keyboard selection and copy paste', async ({ page }) => {

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');

await page.keyboard.type('use');
await page.keyboard.down('Shift');
Expand Down Expand Up @@ -208,7 +205,6 @@ test('press enter twice at end of code block can jump out', async ({

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');

await page.keyboard.press('Enter');
await page.keyboard.press('Enter');
Expand All @@ -224,7 +220,6 @@ test('press backspace after code block can jump into start of code block', async

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');

await page.keyboard.press('Enter');
await page.keyboard.press('Enter');
Expand All @@ -241,7 +236,6 @@ test('press ArrowUp after code block can jump into start of code block', async (

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');

await page.keyboard.press('Enter');
await page.keyboard.press('Enter');
Expand All @@ -256,7 +250,6 @@ test('undo and redo works in code block', async ({ page }) => {

await focusRichText(page);
await addCodeBlock(page);
await page.waitForSelector('rich-text');

await page.keyboard.type('const a = 10;');
await assertRichTexts(page, ['const a = 10;\n']);
Expand Down
1 change: 1 addition & 0 deletions tests/utils/actions/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function switchMode(page: Page) {

export async function addCodeBlock(page: Page) {
await page.click('button[aria-label="code block"]');
await page.waitForSelector('rich-text');

This comment has been minimized.

Copy link
@lawvs

lawvs Dec 28, 2022

Member

This check is unsafe, because other rich-text may exist on the page, maybe @thorseraq can help improve it.

}

export async function switchMouseMode(page: Page) {
Expand Down

2 comments on commit 8c80989

@vercel
Copy link

@vercel vercel bot commented on 8c80989 Dec 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blocksuite-react – ./packages/react/examples/next

blocksuite-react.vercel.app
blocksuite-react-toeverything.vercel.app
blocksuite-react-git-master-toeverything.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8c80989 Dec 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blocksuite – ./packages/playground

blocksuite-five.vercel.app
blocksuite-toeverything.vercel.app
blocksuite-git-master-toeverything.vercel.app

Please sign in to comment.