Fix broken tests

This commit is contained in:
Jonatan Heyman 2023-12-25 23:58:22 +01:00
parent bc77fa725a
commit 594e23c439
3 changed files with 12 additions and 11 deletions

View File

@ -41,7 +41,7 @@ export default defineConfig({
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },

View File

@ -11,11 +11,11 @@ test.beforeEach(async ({ page }) => {
test("test valid JSON detection", async ({ page }) => {
page.locator("body").pressSequentially(`
await page.locator("body").pressSequentially(`
{"test": 1, "key2": "hey!"}
`)
await page.waitForTimeout(200);
expect(await page.locator("css=.status .status-block.lang")).toHaveText("JSON (auto)")
await page.waitForTimeout(1000);
await expect(page.locator("css=.status .status-block.lang")).toHaveText("JSON (auto)")
const block = (await heynotePage.getBlocks())[0]
expect(block.language.name).toBe("json")
expect(block.language.auto).toBeTruthy()
@ -23,7 +23,7 @@ test("test valid JSON detection", async ({ page }) => {
test("python detection", async ({ page }) => {
page.locator("body").pressSequentially(`
await page.locator("body").pressSequentially(`
# import complex math module
import cmath
@ -36,6 +36,6 @@ sol2 = (-b+cmath.sqrt(d))/(2*a)
print('The solution are {0} and {1}'.format(sol1,sol2))
`)
await page.waitForTimeout(1000);
expect(await page.locator("css=.status .status-block.lang")).toHaveText("Python (auto)")
await page.waitForTimeout(3000);
await expect(page.locator("css=.status .status-block.lang")).toHaveText("Python (auto)")
})

View File

@ -10,24 +10,25 @@ test.beforeEach(async ({ page }) => {
});
test("test markdown mode", async ({ page }) => {
heynotePage.setContent(`
await heynotePage.setContent(`
markdown
# Markdown!
- [ ] todo
- [x] done
`)
await page.waitForTimeout(200)
//await page.locator("body").pressSequentially("test")
expect(await page.locator("css=.status .status-block.lang")).toHaveText("Markdown")
await expect(page.locator("css=.status .status-block.lang")).toHaveText("Markdown")
})
test("checkbox toggle", async ({ page }) => {
heynotePage.setContent(`
await heynotePage.setContent(`
markdown
- [ ] todo
`)
const checkbox = await page.locator("css=.cm-content input[type=checkbox]")
expect(checkbox).toHaveCount(1)
await expect(checkbox).toHaveCount(1)
await checkbox.click()
expect(await heynotePage.getBlockContent(0)).toBe("- [x] todo\n")
await checkbox.click()