Browse Source

fix: e2e issue

Peng Xiao 3 years ago
parent
commit
d45e5507b5
2 changed files with 4 additions and 3 deletions
  1. 3 3
      e2e-tests/whiteboards.spec.ts
  2. 1 0
      src/main/frontend/handler/whiteboard.cljs

+ 3 - 3
e2e-tests/whiteboards.spec.ts

@@ -15,11 +15,11 @@ test('enable whiteboards', async ({ page }) => {
 test('create new whiteboard', async ({ page }) => {
     await page.click('.nav-header .whiteboard')
     await page.click('#tl-create-whiteboard')
-    await expect(page.locator('.logseq-tldraw')).toBeVisible()
+    await expect(page.locator('.logseq-tldraw')).toHaveCount(1)
 })
 
 test('check if the page contains the onboarding whiteboard', async ({ page }) => {
-    await expect(page.locator('.tl-text-shape-wrapper >> text=Welcome to')).toBeVisible()
+    await expect(page.locator('.tl-text-shape-wrapper >> text=Welcome to')).toHaveCount(1)
 })
 
 test('cleanup the shapes', async ({ page }) => {
@@ -29,7 +29,7 @@ test('cleanup the shapes', async ({ page }) => {
         await page.keyboard.press('Control+a')
     }
     await page.keyboard.press('Delete')
-    await expect(page.locator('[data-type=Shape]')).not.toBeVisible()
+    await expect(page.locator('[data-type=Shape]')).toHaveCount(0)
 })
 
 test('set whiteboard title', async ({ page }) => {

+ 1 - 0
src/main/frontend/handler/whiteboard.cljs

@@ -233,6 +233,7 @@
      (clone-whiteboard-from-edn edn (.-api app))))
   ([{:keys [pages blocks]} api]
    (let [page-block (first pages)
+         ;; FIXME: should also clone normal blocks
          shapes (->> blocks
                      (filter gp-whiteboard/shape-block?)
                      (map gp-whiteboard/block->shape)