From 14c8c7159db97458a30b2d295270367fcb3ba3fd Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 07:34:43 +0000 Subject: [PATCH 1/6] don't wait for networkidle2 in live tests --- test/source/tests/gmail.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 37c4d9dc546..f4d4b13f19c 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -308,14 +308,14 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test expect(await replyBox.read('@recipients-preview')).to.equal('e2e.enterprise.test@flowcrypt.com'); await createSecureDraft(t, browser, gmailPage, 'reply draft'); await createSecureDraft(t, browser, gmailPage, 'offline reply draft', { offline: true }); - await gmailPage.page.reload({ waitUntil: 'networkidle2' }); + await gmailPage.page.reload(/* { waitUntil: 'networkidle2' } */); await Util.sleep(30); replyBox = await pageHasSecureDraft(gmailPage, 'offline reply draft'); // await replyBox.waitAndClick('@action-send'); doesn't work for some reason, use keyboard instead await gmailPage.page.keyboard.press('Tab'); await gmailPage.page.keyboard.press('Enter'); await replyBox.waitTillGone('@action-send'); - await gmailPage.page.reload({ waitUntil: 'networkidle2' }); + await gmailPage.page.reload(/* { waitUntil: 'networkidle2' } */); await gmailPage.waitAndClick('.h7:last-child .ajz', { delay: 1 }); // the small triangle which toggles the message details await gmailPage.waitForContent('.h7:last-child .ajA', 'Re: [ci.test] encrypted email for reply render'); // make sure that the subject of the sent draft is corrent await GmailPageRecipe.deleteLastReply(gmailPage); @@ -434,7 +434,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.type('div[aria-label="Message Body"]', 'plain reply', true); await gmailPage.waitForContent('.oG.aOy', 'Draft saved'); await Util.sleep(10); - await gmailPage.page.reload({ waitUntil: 'networkidle2' }); + await gmailPage.page.reload(/* { waitUntil: 'networkidle2' }*/); await gmailPage.waitForContent('div[aria-label="Message Body"]', 'plain reply', 30); await pageDoesNotHaveSecureReplyContainer(gmailPage); await gmailPage.click('[aria-label^="Discard draft"]'); From f5dff88c5f96b2a99a47d476c919739c5c916161 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 08:44:00 +0000 Subject: [PATCH 2/6] timeout on each reload step --- test/source/tests/gmail.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index f4d4b13f19c..b3f2fa66e39 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -3,7 +3,7 @@ import test from 'ava'; import { expect } from 'chai'; -import { BrowserHandle, ControllablePage } from './../browser'; +import { BrowserHandle, ControllablePage, TIMEOUT_PAGE_LOAD } from './../browser'; import { Controllable } from './../browser/controllable'; import { TestUrls } from './../browser/test-urls'; import { TestWithBrowser } from './../test'; @@ -273,7 +273,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await createSecureDraft(t, browser, gmailPage, 'compose draft 1', { offline: true }); await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 }); await createSecureDraft(t, browser, gmailPage, 'compose draft 2', { offline: true }); - await gmailPage.page.reload(); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await gmailPage.waitAndClick('[data-tooltip="Drafts"]'); await gmailPage.waitForContent('#fc_offline_drafts', 'FlowCrypt offline drafts:'); await gmailPage.ensureElementsCount('#fc_offline_drafts a', 2); @@ -284,7 +284,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await draft.type('@input-body', 'trigger saving a draft to the cloud', true); await ComposePageRecipe.waitWhenDraftIsSaved(draft); // after draft 2 is saved to the cloud, it should be removed from offline drafts - await gmailPage.page.reload(); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await gmailPage.waitForContent('#fc_offline_drafts', 'FlowCrypt offline drafts:'); await gmailPage.ensureElementsCount('#fc_offline_drafts a', 1); await gmailPage.waitAndClick('#fc_offline_drafts a'); @@ -308,14 +308,14 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test expect(await replyBox.read('@recipients-preview')).to.equal('e2e.enterprise.test@flowcrypt.com'); await createSecureDraft(t, browser, gmailPage, 'reply draft'); await createSecureDraft(t, browser, gmailPage, 'offline reply draft', { offline: true }); - await gmailPage.page.reload(/* { waitUntil: 'networkidle2' } */); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await Util.sleep(30); replyBox = await pageHasSecureDraft(gmailPage, 'offline reply draft'); // await replyBox.waitAndClick('@action-send'); doesn't work for some reason, use keyboard instead await gmailPage.page.keyboard.press('Tab'); await gmailPage.page.keyboard.press('Enter'); await replyBox.waitTillGone('@action-send'); - await gmailPage.page.reload(/* { waitUntil: 'networkidle2' } */); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await gmailPage.waitAndClick('.h7:last-child .ajz', { delay: 1 }); // the small triangle which toggles the message details await gmailPage.waitForContent('.h7:last-child .ajA', 'Re: [ci.test] encrypted email for reply render'); // make sure that the subject of the sent draft is corrent await GmailPageRecipe.deleteLastReply(gmailPage); @@ -329,7 +329,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test // create compose draft await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 }); await createSecureDraft(t, browser, gmailPage, 'a compose draft'); - await gmailPage.page.reload(); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await gotoGmailPage(gmailPage, '', 'drafts'); // to go drafts section // open new compose window and saved draft await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 }); @@ -434,7 +434,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.type('div[aria-label="Message Body"]', 'plain reply', true); await gmailPage.waitForContent('.oG.aOy', 'Draft saved'); await Util.sleep(10); - await gmailPage.page.reload(/* { waitUntil: 'networkidle2' }*/); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); await gmailPage.waitForContent('div[aria-label="Message Body"]', 'plain reply', 30); await pageDoesNotHaveSecureReplyContainer(gmailPage); await gmailPage.click('[aria-label^="Discard draft"]'); From f371792195b874159e2dc0aeae44191d5eb80c32 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 09:11:09 +0000 Subject: [PATCH 3/6] increase TIMEOUT_OVERALL --- test/source/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/source/test.ts b/test/source/test.ts index e0d33676e28..947635f85da 100644 --- a/test/source/test.ts +++ b/test/source/test.ts @@ -36,7 +36,7 @@ const consts = { TIMEOUT_SHORT: minutes(1), TIMEOUT_EACH_RETRY: minutes(3), TIMEOUT_ALL_RETRIES: minutes(25), // this has to suffer waiting for semaphore between retries, thus almost the same as below - TIMEOUT_OVERALL: minutes(20), + TIMEOUT_OVERALL: minutes(30), ATTEMPTS: testGroup === 'STANDARD-GROUP' ? oneIfNotPooled(3) : process.argv.includes('--retry=false') ? 1 : 3, POOL_SIZE: oneIfNotPooled(isMock ? 20 : 3), PROMISE_TIMEOUT_OVERALL: undefined as unknown as Promise, // will be set right below From 5a48c61b83cb4ceaae9755a31ca95075b59078be Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 09:28:47 +0000 Subject: [PATCH 4/6] increase TIMEOUT_EACH_RETRY #5038 --- test/source/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/source/test.ts b/test/source/test.ts index 947635f85da..752ef1a8432 100644 --- a/test/source/test.ts +++ b/test/source/test.ts @@ -34,7 +34,7 @@ process.setMaxListeners(0); const consts = { // higher concurrency can cause 429 google errs when composing TIMEOUT_SHORT: minutes(1), - TIMEOUT_EACH_RETRY: minutes(3), + TIMEOUT_EACH_RETRY: minutes(4), TIMEOUT_ALL_RETRIES: minutes(25), // this has to suffer waiting for semaphore between retries, thus almost the same as below TIMEOUT_OVERALL: minutes(30), ATTEMPTS: testGroup === 'STANDARD-GROUP' ? oneIfNotPooled(3) : process.argv.includes('--retry=false') ? 1 : 3, From 5bf13db99e6eccae4ceff5aaa80c67becc6fefa9 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 12:09:58 +0000 Subject: [PATCH 5/6] fixes related to #5037 --- test/source/tests/compose.ts | 2 ++ test/source/tests/gmail.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/source/tests/compose.ts b/test/source/tests/compose.ts index a8f1a2020bf..747ceb3ba33 100644 --- a/test/source/tests/compose.ts +++ b/test/source/tests/compose.ts @@ -1494,6 +1494,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te testWithBrowser('compatibility', async (t, browser) => { let composePage = await ComposePageRecipe.openStandalone(t, browser, 'compatibility'); const subject = `مرحبا RTL plain text`; + await Util.sleep(5); // until #5037 is fixed await ComposePageRecipe.fillMsg(composePage, { to: 'human@flowcrypt.com' }, subject, 'مرحبا', { richtext: false, }); @@ -1512,6 +1513,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te testWithBrowser('compatibility', async (t, browser) => { let composePage = await ComposePageRecipe.openStandalone(t, browser, 'compatibility'); const subject = `مرحبا RTL rich text`; + await Util.sleep(5); // until #5037 is fixed await ComposePageRecipe.fillMsg(composePage, { to: 'human@flowcrypt.com' }, subject, 'مرحبا', { richtext: true, }); diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index b3f2fa66e39..259d74be3ff 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -72,7 +72,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test } else { composeBox = await gmailPage.getFrame(['/chrome/elements/compose.htm']); } - await Util.sleep(5); // the draft isn't being saved if start typing without this delay + await Util.sleep(5); // until #5037 is fixed await composeBox.type('@input-body', content, true); if (params.offline) { await ComposePageRecipe.waitWhenDraftIsSavedLocally(composeBox); @@ -280,7 +280,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.waitAndClick('#fc_offline_drafts a'); // compose draft 2 should be first in list as drafts are sorted by date descending const draft = await pageHasSecureDraft(gmailPage, 'compose draft 2'); - await Util.sleep(5); // the draft isn't being saved if start typing without this delay + await Util.sleep(5); // until #5037 is fixed await draft.type('@input-body', 'trigger saving a draft to the cloud', true); await ComposePageRecipe.waitWhenDraftIsSaved(draft); // after draft 2 is saved to the cloud, it should be removed from offline drafts From 4e176d08f51b1d197bd49e4609249878948830ce Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 24 Mar 2023 12:32:24 +0000 Subject: [PATCH 6/6] retry with networkidle2 --- test/source/tests/gmail.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 259d74be3ff..472e4929718 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -308,14 +308,14 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test expect(await replyBox.read('@recipients-preview')).to.equal('e2e.enterprise.test@flowcrypt.com'); await createSecureDraft(t, browser, gmailPage, 'reply draft'); await createSecureDraft(t, browser, gmailPage, 'offline reply draft', { offline: true }); - await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' }); await Util.sleep(30); replyBox = await pageHasSecureDraft(gmailPage, 'offline reply draft'); // await replyBox.waitAndClick('@action-send'); doesn't work for some reason, use keyboard instead await gmailPage.page.keyboard.press('Tab'); await gmailPage.page.keyboard.press('Enter'); await replyBox.waitTillGone('@action-send'); - await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' }); await gmailPage.waitAndClick('.h7:last-child .ajz', { delay: 1 }); // the small triangle which toggles the message details await gmailPage.waitForContent('.h7:last-child .ajA', 'Re: [ci.test] encrypted email for reply render'); // make sure that the subject of the sent draft is corrent await GmailPageRecipe.deleteLastReply(gmailPage); @@ -434,7 +434,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.type('div[aria-label="Message Body"]', 'plain reply', true); await gmailPage.waitForContent('.oG.aOy', 'Draft saved'); await Util.sleep(10); - await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' }); + await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' }); await gmailPage.waitForContent('div[aria-label="Message Body"]', 'plain reply', 30); await pageDoesNotHaveSecureReplyContainer(gmailPage); await gmailPage.click('[aria-label^="Discard draft"]');