1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-04 20:46:11 +02:00
Files
slate/playwright/integration/examples/check-lists.test.ts
Gary Borton 5dc4396f6b Switch from cypress to playwright. (#5248)
* empty

* empty

* empty

* Begin move from cypress to playwright.

* Switch remaining tests to playwright, remove old cypress suppport files.

* Clean up playwright config

* Enable ff, and safari when on mac.

* Fix safari/ff mentions test

* Fix code-highlighting test on ff/safari

* Add a local retry as a few tests are flaky.

* Replace cypress w/ playwright in gitignore.

* Update to latest yarn to fix ci install?

* Update yarn.lock w/ yarn command.

* Fix mocha tests.

* Fix prettier
2023-01-13 20:36:04 -07:00

51 lines
1.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
test.describe('Check-lists example', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:3000/examples/check-lists')
})
test('checks the bullet when clicked', async ({ page }) => {
const slateNodeElement = 'div[data-slate-node="element"]'
expect(
await page
.locator(slateNodeElement)
.nth(3)
.textContent()
).toBe('Criss-cross!')
await expect(
page
.locator(slateNodeElement)
.nth(3)
.locator('span')
.nth(1)
).toHaveCSS('text-decoration-line', 'line-through')
// Unchecking the checkboxes should un-cross the corresponding text.
await page
.locator(slateNodeElement)
.nth(3)
.locator('span')
.nth(0)
.locator('input')
.uncheck()
expect(
await page
.locator(slateNodeElement)
.nth(3)
.textContent()
).toBe('Criss-cross!')
await expect(
page
.locator(slateNodeElement)
.nth(3)
.locator('span')
.nth(1)
).toHaveCSS('text-decoration-line', 'none')
expect(await page.locator('p[data-slate-node="element"]').count()).toBe(2)
})
})