Skip to content

Commit

Permalink
enhance: test stability
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc authored and tiensonqin committed Jan 5, 2023
1 parent 21ddb7e commit 1bcf8db
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions e2e-tests/whiteboards.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IsMac } from './utils'

test('enable whiteboards', async ({ page }) => {
await page.evaluate(() => {
window.localStorage.removeItem('ls-onboarding-whiteboard?')
window.localStorage.setItem('ls-onboarding-whiteboard?', "true")
})

await expect(page.locator('.nav-header .whiteboard')).toBeHidden()
Expand All @@ -19,26 +19,17 @@ test('enable whiteboards', async ({ page }) => {
test('create new whiteboard', async ({ page }) => {
await page.click('.nav-header .whiteboard')
await page.click('#tl-create-whiteboard')
await page.waitForTimeout(2000)
await expect(page.locator('.logseq-tldraw')).toBeVisible()
})

test('check if the page contains the onboarding whiteboard', async ({
page,
}) => {
await expect(
page.locator('.tl-text-shape-wrapper >> text=Welcome to')
).toHaveCount(1)
})

test('cleanup the shapes', async ({ page }) => {
if (IsMac) {
await page.keyboard.press('Meta+a')
} else {
await page.keyboard.press('Control+a')
}
await page.keyboard.press('Delete')
await expect(page.locator('[data-type=Shape]')).toHaveCount(0)
})
// test('check if the page contains the onboarding whiteboard', async ({
// page,
// }) => {
// await expect(
// page.locator('.tl-text-shape-wrapper >> text=Welcome to')
// ).toHaveCount(1)
// })

test('can right click title to show context menu', async ({ page }) => {
await page.click('.whiteboard-page-title', {
Expand Down Expand Up @@ -100,6 +91,17 @@ test('draw a rectangle', async ({ page }) => {
).not.toHaveCount(0)
})


test('cleanup the shapes', async ({ page }) => {
if (IsMac) {
await page.keyboard.press('Meta+a')
} else {
await page.keyboard.press('Control+a')
}
await page.keyboard.press('Delete')
await expect(page.locator('[data-type=Shape]')).toHaveCount(0)
})

test('zoom in', async ({ page }) => {
await page.click('#tl-zoom-in')
await expect(page.locator('#tl-zoom')).toContainText('125%')
Expand Down

0 comments on commit 1bcf8db

Please sign in to comment.