diff --git a/e2e-tests/basic.spec.ts b/e2e-tests/basic.spec.ts index 02ac5203f..f6581a357 100644 --- a/e2e-tests/basic.spec.ts +++ b/e2e-tests/basic.spec.ts @@ -105,7 +105,6 @@ test('delete and backspace', async ({ page }) => { await createRandomPage(page) await page.fill('textarea >> nth=0', 'test') - expect(await page.inputValue('textarea >> nth=0')).toBe('test') // backspace @@ -114,7 +113,8 @@ test('delete and backspace', async ({ page }) => { expect(await page.inputValue('textarea >> nth=0')).toBe('te') // refill - await page.fill('textarea >> nth=0', 'test') + await enterNextBlock(page) + await page.type('textarea >> nth=0', 'test') await page.keyboard.press('ArrowLeft') await page.keyboard.press('ArrowLeft') diff --git a/e2e-tests/fixtures.ts b/e2e-tests/fixtures.ts index 4c40139bf..b56ff9886 100644 --- a/e2e-tests/fixtures.ts +++ b/e2e-tests/fixtures.ts @@ -17,18 +17,19 @@ if (fs.existsSync(testTmpDir)) { export let graphDir = path.resolve(testTmpDir, "e2e-test", repoName) -// NOTE: This is a console log watcher for error logs. +// NOTE: This following is a console log watcher for error logs. +// Save and print all logs when error happens. +let logs: string const consoleLogWatcher = (msg: ConsoleMessage) => { - // console.log(msg.text()) - let msgText = msg.text() - expect(msgText).not.toMatch(/^Failed to/) + // console.log(msg.text()) + logs += msg.text() + '\n' + expect(msg.text(), logs).not.toMatch(/^(Failed to|Uncaught)/) // youtube video - if (!msgText.match(/^Error with Permissions-Policy header: Unrecognized feature/)) { - expect(msgText).not.toMatch(/^Error/) + if (!logs.match(/^Error with Permissions-Policy header: Unrecognized feature/)) { + expect(logs).not.toMatch(/^Error/) } - expect(msgText).not.toMatch(/^Uncaught/) // NOTE: React warnings will be logged as error. // expect(msg.type()).not.toBe('error') } diff --git a/src/main/frontend/handler/ui.cljs b/src/main/frontend/handler/ui.cljs index 78571abfe..2004f2b93 100644 --- a/src/main/frontend/handler/ui.cljs +++ b/src/main/frontend/handler/ui.cljs @@ -232,9 +232,11 @@ (let [[matched {:keys [on-chosen-open-link]}] (:rum/args state) current-idx (get state :frontend.ui/current-idx)] (util/stop e) - (when (and (seq matched) - (> (count matched) - @current-idx)) + ;; FIXME: on-chosen-open-link might be nil + (when (and on-chosen-open-link + (seq matched) + (> (count matched) + @current-idx)) (on-chosen-open-link (nth matched @current-idx) false)))) ;; date-picker