|
@@ -2,6 +2,7 @@ import { expect } from '@playwright/test'
|
|
|
import { test } from './fixtures'
|
|
|
|
|
|
test('enable whiteboards', async ({ page }) => {
|
|
|
+ await expect(page.locator('.nav-header .whiteboard')).toBeHidden()
|
|
|
await page.click('#head .toolbar-dots-btn')
|
|
|
await page.click('#head .dropdown-wrapper >> text=Settings')
|
|
|
await page.click('.settings-modal a[data-id=features]')
|
|
@@ -18,15 +19,27 @@ test('create new whiteboard', async ({ page }) => {
|
|
|
|
|
|
test('set whiteboard title', async ({ page }) => {
|
|
|
const title = "my-whiteboard"
|
|
|
+ // Newly created whiteboard should have a default title
|
|
|
+ await expect(page.locator('.whiteboard-page-title .title')).toContainText("Untitled");
|
|
|
+
|
|
|
await page.click('.whiteboard-page-title')
|
|
|
await page.type('.whiteboard-page-title .title', title)
|
|
|
await page.keyboard.press('Enter')
|
|
|
await expect(page.locator('.whiteboard-page-title .title')).toContainText(title);
|
|
|
+
|
|
|
+ await page.click('.whiteboard-page-title')
|
|
|
+ await page.type('.whiteboard-page-title .title', "-2")
|
|
|
+ await page.keyboard.press('Enter')
|
|
|
+
|
|
|
+ // Updating non-default title should pop up a confirmation dialog
|
|
|
+ await expect(page.locator('.ui__confirm-modal >> .headline')).toContainText(`Do you really want to change the page name to “${title}-2”?`);
|
|
|
+ await page.click('.ui__confirm-modal button')
|
|
|
+ await expect(page.locator('.whiteboard-page-title .title')).toContainText(title + "-2");
|
|
|
})
|
|
|
|
|
|
test('select rectangle tool', async ({ page }) => {
|
|
|
await page.keyboard.press('8')
|
|
|
- await expect(page.locator('.tl-geometry-tools-pane-anchor [title="Rectangle (8)"]')).toHaveAttribute('data-selected', 'true')
|
|
|
+ await expect(page.locator('.tl-geometry-tools-pane-anchor [title*="Rectangle"]')).toHaveAttribute('data-selected', 'true')
|
|
|
})
|
|
|
|
|
|
test('draw a rectangle', async ({ page }) => {
|
|
@@ -55,7 +68,7 @@ test('zoom out', async ({ page }) => {
|
|
|
})
|
|
|
|
|
|
test('open context menu', async ({ page }) => {
|
|
|
- await page.locator('.logseq-tldraw').click({button: "right"})
|
|
|
+ await page.locator('.logseq-tldraw').click({ button: "right" })
|
|
|
await expect(page.locator('.tl-context-menu')).toBeVisible()
|
|
|
})
|
|
|
|
|
@@ -63,3 +76,42 @@ test('close context menu on esc', async ({ page }) => {
|
|
|
await page.keyboard.press('Escape')
|
|
|
await expect(page.locator('.tl-context-menu')).toBeHidden()
|
|
|
})
|
|
|
+
|
|
|
+test('quick add another whiteboard', async ({ page }) => {
|
|
|
+ // create a new board first
|
|
|
+ await page.click('.nav-header .whiteboard')
|
|
|
+ await page.click('#tl-create-whiteboard')
|
|
|
+
|
|
|
+ await page.click('.whiteboard-page-title')
|
|
|
+ await page.type('.whiteboard-page-title .title', "my-whiteboard-3")
|
|
|
+ await page.keyboard.press('Enter')
|
|
|
+
|
|
|
+ const canvas = await page.waitForSelector('.logseq-tldraw');
|
|
|
+ await canvas.dblclick({
|
|
|
+ position: {
|
|
|
+ x: 100,
|
|
|
+ y: 100
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const quickAdd$ = page.locator('.tl-quick-search')
|
|
|
+ await expect(quickAdd$).toBeVisible()
|
|
|
+
|
|
|
+ await page.type('.tl-quick-search input', 'my-whiteboard')
|
|
|
+ await quickAdd$.locator('.tl-quick-search-option >> text=my-whiteboard-2').first().click()
|
|
|
+
|
|
|
+ await expect(quickAdd$).toBeHidden()
|
|
|
+ await expect(page.locator('.tl-logseq-portal-container >> text=my-whiteboard-2')).toBeVisible()
|
|
|
+})
|
|
|
+
|
|
|
+test('go to another board and check reference', async ({ page }) => {
|
|
|
+ await page.locator('.tl-logseq-portal-container >> text=my-whiteboard-2').click()
|
|
|
+ await expect(page.locator('.whiteboard-page-title .title')).toContainText("my-whiteboard-2");
|
|
|
+
|
|
|
+ const pageRefCount$ = page.locator('.whiteboard-page-refs-count')
|
|
|
+ await expect(pageRefCount$.locator('.open-page-ref-link')).toContainText('1')
|
|
|
+
|
|
|
+ await pageRefCount$.click()
|
|
|
+ await expect(page.locator('.references-blocks')).toBeVisible()
|
|
|
+ await expect(page.locator('.references-blocks >> .page-ref >> text=my-whiteboard-3')).toBeVisible()
|
|
|
+})
|