Skip to content

Commit c455f05

Browse files
committed
Move notepad spec to Playwright
1 parent b203b0a commit c455f05

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

test/cypress/e2e/notepad.cy.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/e2e/notepad.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { expect, test } from '@playwright/test'
2+
import moment from 'moment'
3+
4+
test.describe('nodepad', () => {
5+
test.beforeEach(async ({ page }) => {
6+
await page.goto('/notepad')
7+
await page.waitForSelector('[data-is-mounted="true"]')
8+
await page.waitForTimeout(1000)
9+
})
10+
11+
test('is focused', async ({ page }) => {
12+
const classes = await page.evaluate(() => {
13+
return Array.from(document.activeElement?.classList || [])
14+
})
15+
16+
expect(classes).toContain('ink-mde-editor-content')
17+
})
18+
19+
test('has some default text', async ({ page }) => {
20+
const date = moment().format('dddd, MMMM Do, YYYY')
21+
22+
const doc = await page.evaluate(() => {
23+
return window.inkMde.getDoc()
24+
})
25+
26+
expect(doc).toMatch(new RegExp(`^#daily\n\n# ${date}\n\n`))
27+
})
28+
})

0 commit comments

Comments
 (0)