Skip to content

Commit 1eac042

Browse files
rrrooommmaaaRoman Shevchenko
andauthored
Better timeout management in live tests (#5036)
* timeout on each reload step * increase TIMEOUT_OVERALL * increase TIMEOUT_EACH_RETRY #5038 * fixes related to #5037 --------- Co-authored-by: Roman Shevchenko <[email protected]>
1 parent b041698 commit 1eac042

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

test/source/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ process.setMaxListeners(0);
3434
const consts = {
3535
// higher concurrency can cause 429 google errs when composing
3636
TIMEOUT_SHORT: minutes(1),
37-
TIMEOUT_EACH_RETRY: minutes(3),
37+
TIMEOUT_EACH_RETRY: minutes(4),
3838
TIMEOUT_ALL_RETRIES: minutes(25), // this has to suffer waiting for semaphore between retries, thus almost the same as below
39-
TIMEOUT_OVERALL: minutes(20),
39+
TIMEOUT_OVERALL: minutes(30),
4040
ATTEMPTS: testGroup === 'STANDARD-GROUP' ? oneIfNotPooled(3) : process.argv.includes('--retry=false') ? 1 : 3,
4141
POOL_SIZE: oneIfNotPooled(isMock ? 20 : 3),
4242
PROMISE_TIMEOUT_OVERALL: undefined as unknown as Promise<never>, // will be set right below

test/source/tests/compose.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te
14941494
testWithBrowser('compatibility', async (t, browser) => {
14951495
let composePage = await ComposePageRecipe.openStandalone(t, browser, 'compatibility');
14961496
const subject = `مرحبا RTL plain text`;
1497+
await Util.sleep(5); // until #5037 is fixed
14971498
await ComposePageRecipe.fillMsg(composePage, { to: '[email protected]' }, subject, 'مرحبا', {
14981499
richtext: false,
14991500
});
@@ -1512,6 +1513,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te
15121513
testWithBrowser('compatibility', async (t, browser) => {
15131514
let composePage = await ComposePageRecipe.openStandalone(t, browser, 'compatibility');
15141515
const subject = `مرحبا RTL rich text`;
1516+
await Util.sleep(5); // until #5037 is fixed
15151517
await ComposePageRecipe.fillMsg(composePage, { to: '[email protected]' }, subject, 'مرحبا', {
15161518
richtext: true,
15171519
});

test/source/tests/gmail.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import test from 'ava';
44

55
import { expect } from 'chai';
6-
import { BrowserHandle, ControllablePage } from './../browser';
6+
import { BrowserHandle, ControllablePage, TIMEOUT_PAGE_LOAD } from './../browser';
77
import { Controllable } from './../browser/controllable';
88
import { TestUrls } from './../browser/test-urls';
99
import { TestWithBrowser } from './../test';
@@ -72,7 +72,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
7272
} else {
7373
composeBox = await gmailPage.getFrame(['/chrome/elements/compose.htm']);
7474
}
75-
await Util.sleep(5); // the draft isn't being saved if start typing without this delay
75+
await Util.sleep(5); // until #5037 is fixed
7676
await composeBox.type('@input-body', content, true);
7777
if (params.offline) {
7878
await ComposePageRecipe.waitWhenDraftIsSavedLocally(composeBox);
@@ -273,18 +273,18 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
273273
await createSecureDraft(t, browser, gmailPage, 'compose draft 1', { offline: true });
274274
await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 });
275275
await createSecureDraft(t, browser, gmailPage, 'compose draft 2', { offline: true });
276-
await gmailPage.page.reload();
276+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' });
277277
await gmailPage.waitAndClick('[data-tooltip="Drafts"]');
278278
await gmailPage.waitForContent('#fc_offline_drafts', 'FlowCrypt offline drafts:');
279279
await gmailPage.ensureElementsCount('#fc_offline_drafts a', 2);
280280
await gmailPage.waitAndClick('#fc_offline_drafts a');
281281
// compose draft 2 should be first in list as drafts are sorted by date descending
282282
const draft = await pageHasSecureDraft(gmailPage, 'compose draft 2');
283-
await Util.sleep(5); // the draft isn't being saved if start typing without this delay
283+
await Util.sleep(5); // until #5037 is fixed
284284
await draft.type('@input-body', 'trigger saving a draft to the cloud', true);
285285
await ComposePageRecipe.waitWhenDraftIsSaved(draft);
286286
// after draft 2 is saved to the cloud, it should be removed from offline drafts
287-
await gmailPage.page.reload();
287+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' });
288288
await gmailPage.waitForContent('#fc_offline_drafts', 'FlowCrypt offline drafts:');
289289
await gmailPage.ensureElementsCount('#fc_offline_drafts a', 1);
290290
await gmailPage.waitAndClick('#fc_offline_drafts a');
@@ -308,14 +308,14 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
308308
expect(await replyBox.read('@recipients-preview')).to.equal('[email protected]');
309309
await createSecureDraft(t, browser, gmailPage, 'reply draft');
310310
await createSecureDraft(t, browser, gmailPage, 'offline reply draft', { offline: true });
311-
await gmailPage.page.reload({ waitUntil: 'networkidle2' });
311+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' });
312312
await Util.sleep(30);
313313
replyBox = await pageHasSecureDraft(gmailPage, 'offline reply draft');
314314
// await replyBox.waitAndClick('@action-send'); doesn't work for some reason, use keyboard instead
315315
await gmailPage.page.keyboard.press('Tab');
316316
await gmailPage.page.keyboard.press('Enter');
317317
await replyBox.waitTillGone('@action-send');
318-
await gmailPage.page.reload({ waitUntil: 'networkidle2' });
318+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' });
319319
await gmailPage.waitAndClick('.h7:last-child .ajz', { delay: 1 }); // the small triangle which toggles the message details
320320
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
321321
await GmailPageRecipe.deleteLastReply(gmailPage);
@@ -329,7 +329,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
329329
// create compose draft
330330
await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 });
331331
await createSecureDraft(t, browser, gmailPage, 'a compose draft');
332-
await gmailPage.page.reload();
332+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'load' });
333333
await gotoGmailPage(gmailPage, '', 'drafts'); // to go drafts section
334334
// open new compose window and saved draft
335335
await gmailPage.waitAndClick('@action-secure-compose', { delay: 1 });
@@ -434,7 +434,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
434434
await gmailPage.type('div[aria-label="Message Body"]', 'plain reply', true);
435435
await gmailPage.waitForContent('.oG.aOy', 'Draft saved');
436436
await Util.sleep(10);
437-
await gmailPage.page.reload({ waitUntil: 'networkidle2' });
437+
await gmailPage.page.reload({ timeout: TIMEOUT_PAGE_LOAD * 1000, waitUntil: 'networkidle2' });
438438
await gmailPage.waitForContent('div[aria-label="Message Body"]', 'plain reply', 30);
439439
await pageDoesNotHaveSecureReplyContainer(gmailPage);
440440
await gmailPage.click('[aria-label^="Discard draft"]');

0 commit comments

Comments
 (0)