Skip to content

Commit

Permalink
fix: e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Apr 21, 2022
1 parent 019e67a commit a569d38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions e2e-tests/fixtures.ts
Expand Up @@ -181,6 +181,9 @@ export const test = base.extend<{ page: Page, block: Block, context: BrowserCont
return page.locator('textarea >> nth=0')
},
clickNext: async (): Promise<Locator> => {
await page.$eval('.add-button-link-wrap', (element) => {
element.scrollIntoView();
});
let blockCount = await page.locator('.page-blocks-inner .ls-block').count()
// the next element after all blocks.
await page.click('.add-button-link-wrap')
Expand All @@ -201,8 +204,8 @@ export const test = base.extend<{ page: Page, block: Block, context: BrowserCont
},
waitForBlocks: async (total: number): Promise<void> => {
// NOTE: `nth=` counts from 0.
await page.waitForSelector(`.ls-block >> nth=${total - 1}`, { timeout: 1000 })
await page.waitForSelector(`.ls-block >> nth=${total}`, { state: 'detached', timeout: 1000 })
await page.waitForSelector(`.ls-block >> nth=${total - 1}`, { state: 'attached', timeout: 50000 })
await page.waitForSelector(`.ls-block >> nth=${total}`, { state: 'detached', timeout: 50000 })
},
waitForSelectedBlocks: async (total: number): Promise<void> => {
// NOTE: `nth=` counts from 0.
Expand Down
3 changes: 3 additions & 0 deletions e2e-tests/utils.ts
Expand Up @@ -248,6 +248,9 @@ export async function randomEditMoveUpDown( page: Page ) {
await page.keyboard.press('Meta+Shift+ArrowDown')
}
}

// Leave some time for UI refresh
await page.waitForTimeout(10)
}

async function scrollOnElement(page, selector) {
Expand Down

0 comments on commit a569d38

Please sign in to comment.