Преглед изворни кода

test: add a test case for whiteboard context menu

Peng Xiao пре 2 година
родитељ
комит
cff3f155ad
1 измењених фајлова са 16 додато и 0 уклоњено
  1. 16 0
      e2e-tests/whiteboards.spec.ts

+ 16 - 0
e2e-tests/whiteboards.spec.ts

@@ -3,6 +3,10 @@ import { test } from './fixtures'
 import { IsMac } from './utils'
 
 test('enable whiteboards', async ({ page }) => {
+    await page.evaluate(() => {
+        window.localStorage.removeItem('ls-onboarding-whiteboard?')
+    })
+
     await expect(page.locator('.nav-header .whiteboard')).toBeHidden()
     await page.click('#head .toolbar-dots-btn')
     await page.click('#head .dropdown-wrapper >> text=Settings')
@@ -32,6 +36,18 @@ test('cleanup the shapes', async ({ page }) => {
     await expect(page.locator('[data-type=Shape]')).toHaveCount(0)
 })
 
+test('can right click title to show context menu', async ({ page }) => {
+    await page.click('.whiteboard-page-title', {
+        button: 'right',
+    })
+  
+    await expect(page.locator('#custom-context-menu')).toBeVisible()
+  
+    await page.keyboard.press('Escape')
+  
+    await expect(page.locator('#custom-context-menu')).toHaveCount(0)
+})
+
 test('set whiteboard title', async ({ page }) => {
     const title = "my-whiteboard"
     // Newly created whiteboard should have a default title