瀏覽代碼

fix(e2e): occasional failures

Andelf 3 年之前
父節點
當前提交
cd8a4fe339
共有 3 個文件被更改,包括 9 次插入10 次删除
  1. 2 1
      e2e-tests/basic.spec.ts
  2. 0 2
      e2e-tests/code-editing.spec.ts
  3. 7 7
      e2e-tests/editor.spec.ts

+ 2 - 1
e2e-tests/basic.spec.ts

@@ -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()
 })

+ 0 - 2
e2e-tests/code-editing.spec.ts

@@ -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)
 })
 
 

+ 7 - 7
e2e-tests/editor.spec.ts

@@ -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})