From 8f77e66af3ed110ab4555005b420300a5e517f52 Mon Sep 17 00:00:00 2001 From: jbukl Date: Thu, 2 Nov 2023 10:22:26 -0400 Subject: Playwright search wait for input success --- test/playwright/integration.spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js index 4e4663d6..1bfd39ea 100644 --- a/test/playwright/integration.spec.js +++ b/test/playwright/integration.spec.js @@ -31,7 +31,7 @@ const {createDictionaryArchive} = require('../../dev/util'); test.beforeEach(async ({context}) => { // wait for the on-install welcome.html tab to load, which becomes the foreground tab const welcome = await context.waitForEvent('page'); - welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang + await welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang }); test('search clipboard', async ({page, extensionId}) => { @@ -82,8 +82,11 @@ test('anki add', async ({context, page, extensionId}) => { // add to anki deck await page.goto(`chrome-extension://${extensionId}/search.html`); - await page.waitForTimeout(500); // race - await page.locator('#search-textbox').fill('読む'); + await expect(async () => { + await page.locator('#search-textbox').clear(); + await page.locator('#search-textbox').fill('読む'); + await expect(page.locator('#search-textbox')).toHaveValue('読む'); + }).toPass({timeout: 5000}); await page.locator('#search-textbox').press('Enter'); await page.locator('[data-mode="term-kanji"]').click(); const addNoteReqBody = await addNotePromise; -- cgit v1.2.3