aboutsummaryrefslogtreecommitdiff
path: root/test/playwright
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-02 14:37:21 +0000
committerGitHub <noreply@github.com>2023-11-02 14:37:21 +0000
commit3d2aaaeaa7a4ca3c3fe09485b3c881c168ba8a97 (patch)
treefc14b8ea696091057367a3d0199ac05f470ed8d7 /test/playwright
parent8bd2f93385ff0a2f45ebca9d7691ec2c07447040 (diff)
parent8f77e66af3ed110ab4555005b420300a5e517f52 (diff)
Merge pull request #302 from jbukl/pw-search-wait
Playwright anki test flakiness
Diffstat (limited to 'test/playwright')
-rw-r--r--test/playwright/integration.spec.js9
1 files changed, 6 insertions, 3 deletions
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;