2023-12-25 17:41:15 +01:00
|
|
|
import { test, expect } from "@playwright/test";
|
|
|
|
import { HeynotePage } from "./test-utils.js";
|
|
|
|
|
|
|
|
let heynotePage
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
heynotePage = new HeynotePage(page)
|
|
|
|
await heynotePage.goto()
|
|
|
|
});
|
|
|
|
|
|
|
|
test("test markdown mode", async ({ page }) => {
|
2023-12-26 00:27:43 +01:00
|
|
|
await heynotePage.setContent(`
|
2023-12-25 17:41:15 +01:00
|
|
|
∞∞∞markdown
|
|
|
|
# Markdown!
|
|
|
|
|
|
|
|
- [ ] todo
|
|
|
|
- [x] done
|
|
|
|
`)
|
2023-12-26 00:27:43 +01:00
|
|
|
await page.waitForTimeout(200)
|
2023-12-25 17:41:15 +01:00
|
|
|
//await page.locator("body").pressSequentially("test")
|
2023-12-26 00:27:43 +01:00
|
|
|
await expect(page.locator("css=.status .status-block.lang")).toHaveText("Markdown")
|
2023-12-25 17:41:15 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test("checkbox toggle", async ({ page }) => {
|
2023-12-26 00:27:43 +01:00
|
|
|
await heynotePage.setContent(`
|
2023-12-25 17:41:15 +01:00
|
|
|
∞∞∞markdown
|
|
|
|
- [ ] todo
|
|
|
|
`)
|
|
|
|
const checkbox = await page.locator("css=.cm-content input[type=checkbox]")
|
2023-12-26 00:27:43 +01:00
|
|
|
await expect(checkbox).toHaveCount(1)
|
2023-12-25 17:41:15 +01:00
|
|
|
await checkbox.click()
|
|
|
|
expect(await heynotePage.getBlockContent(0)).toBe("- [x] todo\n")
|
|
|
|
await checkbox.click()
|
|
|
|
expect(await heynotePage.getBlockContent(0)).toBe("- [ ] todo\n")
|
|
|
|
})
|