Skip to content

Commit 9f635de

Browse files
author
Ioan Moldovan
authored
#5806 Fix live tests (#5808)
* fix: live test * fix: gmail timeout * fix: pr reviews
1 parent 0eee059 commit 9f635de

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

test/source/browser/browser-handle.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,18 @@ export class BrowserHandle {
7373
public newPageTriggeredBy = async (t: AvaContext, triggeringAction: () => Promise<void>): Promise<ControllablePage> => {
7474
const page = (await this.doAwaitTriggeredPage(triggeringAction))!;
7575
const url = page.url();
76-
const parsedUrl = new URL(url);
76+
let pathname: string;
77+
try {
78+
pathname = new URL(url).pathname;
79+
} catch {
80+
pathname = url;
81+
}
7782
const controllablePage = new ControllablePage(t, page);
7883
try {
7984
await page.setViewport(this.viewport);
8085
this.pages.push(controllablePage);
8186

82-
if (parsedUrl.pathname.includes(t.context.urls!.extensionId)) {
87+
if (pathname.includes(t.context.urls!.extensionId)) {
8388
await controllablePage.waitUntilViewLoaded();
8489
}
8590
return controllablePage;

test/source/tests/gmail.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,28 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
120120

121121
test(
122122
'mail.google.com - send rich-text encrypted message',
123-
testWithBrowser(async (t, browser) => {
124-
const acctEmail = '[email protected]';
125-
await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail');
126-
const gmailPage = await BrowserRecipe.openGmailPageAndVerifyComposeBtnPresent(t, browser);
127-
const composePage = await GmailPageRecipe.openSecureComposeWithRichTextWorkaround(t, gmailPage, browser);
128-
const subject = `New Rich Text Message ${Util.lousyRandom()}`;
129-
await ComposePageRecipe.fillMsg(composePage, { to: acctEmail }, subject, undefined, {
130-
richtext: true,
131-
});
132-
await ComposePageRecipe.sendAndClose(composePage);
133-
await GmailPageRecipe.expandMainMenuIfNeeded(gmailPage);
134-
await gmailPage.waitAndClick('[aria-label^="Inbox"]');
135-
await gmailPage.waitAndClick('[role="row"]:first-of-type'); // click the first message
136-
await gmailPage.waitForContent('.nH h2.hP', `Automated puppeteer test: ${subject}`);
137-
const urls = await gmailPage.getFramesUrls(['/chrome/elements/pgp_block.htm'], { sleep: 1 });
138-
await GmailPageRecipe.deleteThread(gmailPage);
139-
expect(urls.length).to.eq(1);
140-
})
123+
testWithBrowser(
124+
async (t, browser) => {
125+
const acctEmail = '[email protected]';
126+
await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail');
127+
const gmailPage = await BrowserRecipe.openGmailPageAndVerifyComposeBtnPresent(t, browser);
128+
const composePage = await GmailPageRecipe.openSecureComposeWithRichTextWorkaround(t, gmailPage, browser);
129+
const subject = `New Rich Text Message ${Util.lousyRandom()}`;
130+
await ComposePageRecipe.fillMsg(composePage, { to: acctEmail }, subject, undefined, {
131+
richtext: true,
132+
});
133+
await ComposePageRecipe.sendAndClose(composePage);
134+
await GmailPageRecipe.expandMainMenuIfNeeded(gmailPage);
135+
await gmailPage.waitAndClick('[aria-label^="Inbox"]');
136+
await gmailPage.waitAndClick('[role="row"]:first-of-type'); // click the first message
137+
await gmailPage.waitForContent('.nH h2.hP', `Automated puppeteer test: ${subject}`);
138+
const urls = await gmailPage.getFramesUrls(['/chrome/elements/pgp_block.htm'], { sleep: 1 });
139+
await GmailPageRecipe.deleteThread(gmailPage);
140+
expect(urls.length).to.eq(1);
141+
},
142+
undefined,
143+
minutes(6) // explicitly set timer-controlled timeout
144+
)
141145
);
142146

143147
test(

0 commit comments

Comments
 (0)