Skip to content

Commit

Permalink
fix: e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin authored and andelf committed Mar 29, 2023
1 parent 3977aa4 commit 7318f3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion e2e-tests/editor.spec.ts
Expand Up @@ -188,11 +188,16 @@ test('copy & paste block ref and replace its content', async ({ page, block }) =

await expect(page.locator('textarea >> nth=0')).not.toHaveValue('Some random text')

// FIXME: Sometimes the cursor is in the end of the editor
for (let i = 0; i < 4; i++) {
await page.press('textarea >> nth=0', 'ArrowLeft')
}

// Trigger replace-block-reference-with-content-at-point
await page.keyboard.press(modKey + '+Shift+r')
await page.waitForTimeout(100)

await expect(page.locator('textarea >> nth=0')).toHaveValue('Some random text')

await block.escapeEditing()

await expect(page.locator('.block-ref >> text="Some random text"')).toHaveCount(0);
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/logseq-url.spec.ts
Expand Up @@ -15,6 +15,9 @@ test("Logseq URLs (same graph)", async ({ page, block }) => {
await createRandomPage(page)
await block.mustFill("") // to enter editing mode
await page.keyboard.press(paste_key)
// paste returns a promise which is async, so we need give it a little bit
// more time
await page.waitForTimeout(100)
let cursor_locator = page.locator('textarea >> nth=0')
expect(await cursor_locator.inputValue()).toContain("page=" + page_title)
await cursor_locator.press("Enter")
Expand All @@ -32,6 +35,7 @@ test("Logseq URLs (same graph)", async ({ page, block }) => {
await createRandomPage(page)
await block.mustFill("") // to enter editing mode
await page.keyboard.press(paste_key)
await page.waitForTimeout(100)
cursor_locator = page.locator('textarea >> nth=0')
expect(await cursor_locator.inputValue()).toContain("block-id=")
await cursor_locator.press("Enter")
Expand Down

0 comments on commit 7318f3c

Please sign in to comment.