fix(e2e): occasional failures

pull/4869/head
Andelf 2022-04-09 11:01:24 +08:00 committed by Tienson Qin
parent d13b2a9dce
commit cd8a4fe339
3 changed files with 9 additions and 10 deletions

View File

@ -2,7 +2,7 @@ import { expect } from '@playwright/test'
import fs from 'fs/promises'
import path from 'path'
import { test } from './fixtures'
import { randomString, createRandomPage, enterNextBlock } from './utils'
import { randomString, createRandomPage } from './utils'
test('render app', async ({ page }) => {
// NOTE: part of app startup tests is moved to `fixtures.ts`.
@ -280,5 +280,6 @@ test('invalid page props #3944', async ({ page, block }) => {
await block.mustFill('public:: true\nsize:: 65535')
await page.press('textarea >> nth=0', 'Enter')
// Force rendering property block
await block.clickNext()
})

View File

@ -56,8 +56,6 @@ test('switch code editing mode', async ({ page }) => {
await page.press('.CodeMirror textarea', 'Escape')
await page.waitForSelector('.CodeMirror pre', { state: 'hidden' })
expect(await page.inputValue('.block-editor textarea')).toBe('```clojure\n;; comment\n\n \n(+ 1 1)\n```')
await page.waitForTimeout(500)
})

View File

@ -65,16 +65,16 @@ test('hashtag and quare brackets in same line #4178', async ({ page }) => {
)
})
test('disappeared children #4814', async ({ page }) => {
test('disappeared children #4814', async ({ page, block }) => {
await createRandomPage(page)
await page.type('textarea >> nth=0', 'parent')
await enterNextBlock(page)
await page.press('textarea >> nth=0', 'Tab')
await block.mustType('parent')
await block.enterNext()
expect(await block.indent()).toBe(true)
for (let i = 0; i < 5; i++) {
await page.type('textarea >> nth=0', i.toString())
await enterNextBlock(page)
await block.mustType(i.toString())
await block.enterNext()
}
// collapse
@ -83,7 +83,7 @@ test('disappeared children #4814', async ({ page }) => {
// expand
await page.click('.block-control >> nth=0')
await page.waitForSelector('.ls-block >> nth=6') // 7 blocks
await block.waitForBlocks(7) // 1 + 5 + 1 empty
// Ensures there's no active editor
await expect(page.locator('.editor-inner')).toHaveCount(0, {timeout: 500})