Skip to content

Commit

Permalink
test: fixed failing test on video bot
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Dec 17, 2020
1 parent 35533b1 commit 3ab2206
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 11 additions & 3 deletions test/page-event-popup.spec.ts
Expand Up @@ -35,7 +35,9 @@ it('should work with window features', async ({page, server}) => {
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
});

it('should emit for immediately closed popups', async ({page}) => {
it('should emit for immediately closed popups', async ({browser}) => {
const context = await browser.newContext();
const page = await context.newPage();
const [popup] = await Promise.all([
page.waitForEvent('popup'),
page.evaluate(() => {
Expand All @@ -44,6 +46,7 @@ it('should emit for immediately closed popups', async ({page}) => {
}),
]);
expect(popup).toBeTruthy();
await context.close();
});

it('should emit for immediately closed popups 2', async ({page, server}) => {
Expand All @@ -58,7 +61,9 @@ it('should emit for immediately closed popups 2', async ({page, server}) => {
expect(popup).toBeTruthy();
});

it('should be able to capture alert', async ({page}) => {
it('should be able to capture alert', async ({browser}) => {
const context = await browser.newContext();
const page = await context.newPage();
const evaluatePromise = page.evaluate(() => {
const win = window.open('');
win.alert('hello');
Expand All @@ -68,6 +73,7 @@ it('should be able to capture alert', async ({page}) => {
expect(dialog.message()).toBe('hello');
await dialog.dismiss();
await evaluatePromise;
await context.close();
});

it('should work with empty url', async ({page}) => {
Expand Down Expand Up @@ -142,7 +148,8 @@ it('should work with clicking target=_blank and rel=noopener', async ({page, ser
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
});

it('should not treat navigations as new popups', async ({page, server}) => {
it('should not treat navigations as new popups', async ({context, server}) => {
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
const [popup] = await Promise.all([
Expand All @@ -152,6 +159,7 @@ it('should not treat navigations as new popups', async ({page, server}) => {
let badSecondPopup = false;
page.on('popup', () => badSecondPopup = true);
await popup.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
await context.close();
expect(badSecondPopup).toBe(false);
});

5 changes: 4 additions & 1 deletion test/page-wait-for-load-state.spec.ts
Expand Up @@ -140,7 +140,9 @@ it('should wait for load state of newPage', async ({browser, context, page, serv
expect(await newPage.evaluate(() => document.readyState)).toBe('complete');
});

it('should resolve after popup load', async ({page, server}) => {
it('should resolve after popup load', async ({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
// Stall the 'load' by delaying css.
let cssResponse;
Expand All @@ -160,6 +162,7 @@ it('should resolve after popup load', async ({page, server}) => {
await loadSatePromise;
expect(resolved).toBe(true);
expect(popup.url()).toBe(server.PREFIX + '/one-style.html');
await context.close();
});

it('should work for frame', async ({page, server}) => {
Expand Down

0 comments on commit 3ab2206

Please sign in to comment.