test: fixed failing test on video bot (#4747)

This commit is contained in:
Max Schmitt 2020-12-18 23:46:12 +01:00 committed by GitHub
parent d498b45005
commit c81ec9ccca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -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(() => {
@ -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}) => {
@ -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');
@ -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}) => {
@ -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([
@ -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);
});

View File

@ -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;
@ -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}) => {