From 5588fec305ca9ec00c3a2f9153b8cb5e55a6ae44 Mon Sep 17 00:00:00 2001 From: Limon Monte Date: Mon, 2 Nov 2020 22:34:12 +0200 Subject: [PATCH 1/3] Workaround the race condition for waitForFileChooser() --- .vscode/launch.json | 6 ++++-- test/source/tests/compose.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index ff336fc7254..6dfcd9b296f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,8 @@ "args": [ "build/test/test/source/test.js", "CONSUMER-MOCK", - "--pool-size=1" + "--pool-size=1", + "--debug" ], "skipFiles": [ "/**/*.js" @@ -24,7 +25,8 @@ "program": "${workspaceFolder}/node_modules/ava/profile.js", "args": [ "build/test/test/source/test.js", - "CONSUMER-LIVE-GMAIL" + "CONSUMER-LIVE-GMAIL", + "--debug" ], "skipFiles": [ "/**/*.js" diff --git a/test/source/tests/compose.ts b/test/source/tests/compose.ts index b6f1f1ca215..ee2775b5fb5 100644 --- a/test/source/tests/compose.ts +++ b/test/source/tests/compose.ts @@ -183,10 +183,11 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te expect(await composeFrame.read('@action-send')).to.eq('Sign and Send'); })); - ava.default('compose - keyboard - Attaching file using keyboard', testWithBrowser('compose', async (t, browser) => { + ava.default.only('compose - keyboard - Attaching file using keyboard', testWithBrowser('compose', async (t, browser) => { const inboxPage = await browser.newPage(t, TestUrls.extensionInbox('test.ci.compose@org.flowcrypt.com')); const composeFrame = await InboxPageRecipe.openAndGetComposeFrame(inboxPage); await composeFrame.waitAndFocus('@action-attach-files'); + await (inboxPage.page as any)._client.send('Page.setInterceptFileChooserDialog', { enabled: true }); await Promise.all([ inboxPage.page.waitForFileChooser(), // must be called before the file chooser is launched inboxPage.press('Enter') From 874813cbc87808b6f03723402dc784832611aca9 Mon Sep 17 00:00:00 2001 From: Limon Monte Date: Mon, 2 Nov 2020 22:42:06 +0200 Subject: [PATCH 2/3] remove .only --- test/source/tests/compose.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/source/tests/compose.ts b/test/source/tests/compose.ts index ee2775b5fb5..8c2a1c78e82 100644 --- a/test/source/tests/compose.ts +++ b/test/source/tests/compose.ts @@ -183,10 +183,11 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te expect(await composeFrame.read('@action-send')).to.eq('Sign and Send'); })); - ava.default.only('compose - keyboard - Attaching file using keyboard', testWithBrowser('compose', async (t, browser) => { + ava.default('compose - keyboard - Attaching file using keyboard', testWithBrowser('compose', async (t, browser) => { const inboxPage = await browser.newPage(t, TestUrls.extensionInbox('test.ci.compose@org.flowcrypt.com')); const composeFrame = await InboxPageRecipe.openAndGetComposeFrame(inboxPage); await composeFrame.waitAndFocus('@action-attach-files'); + // workaround for https://github.com/puppeteer/puppeteer/issues/6040 await (inboxPage.page as any)._client.send('Page.setInterceptFileChooserDialog', { enabled: true }); await Promise.all([ inboxPage.page.waitForFileChooser(), // must be called before the file chooser is launched From 75751e0ba908b204fee4231f8a85c305c1108da5 Mon Sep 17 00:00:00 2001 From: Tom J Date: Mon, 2 Nov 2020 21:16:44 +0000 Subject: [PATCH 3/3] fix wkd test --- test/source/tests/compose.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/source/tests/compose.ts b/test/source/tests/compose.ts index 8c2a1c78e82..d3050fcc6da 100644 --- a/test/source/tests/compose.ts +++ b/test/source/tests/compose.ts @@ -670,7 +670,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te const composePage = await ComposePageRecipe.openStandalone(t, browser, 'compose'); await ComposePageRecipe.fillMsg(composePage, { to: 'test-wkd@metacode.biz' }, 'should find pubkey from WKD directly'); await composePage.waitForContent('.email_address.has_pgp', 'test-wkd@metacode.biz'); - expect(await composePage.attr('.email_address.has_pgp', 'title')).to.contain('92C4 E784 1B3A FF74'); + expect(await composePage.attr('.email_address.has_pgp', 'title')).to.contain('5B7A BE66 0D5C 62A6 07FE 2448 716B 1776 4E3F CACA'); })); ava.default('timeouts when searching WKD - used to never time out', testWithBrowser('compose', async (t, browser) => {