Skip to content

Commit

Permalink
Merge pull request yomidevs#302 from jbukl/pw-search-wait
Browse files Browse the repository at this point in the history
Playwright anki test flakiness
  • Loading branch information
djahandarie authored Nov 2, 2023
2 parents 8bd2f93 + 8f77e66 commit 3d2aaae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/playwright/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3d2aaae

Please sign in to comment.