test: unskip passing Firefox tests (#966)

This commit is contained in:
Dmitry Gozman 2020-02-12 16:27:45 -08:00 committed by GitHub
parent aa60a7cebd
commit fbce2908ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 19 deletions

View file

@ -183,8 +183,10 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
await page.emulateMedia({ colorScheme: 'light' }); await page.emulateMedia({ colorScheme: 'light' });
const navigated = page.goto(server.EMPTY_PAGE); const navigated = page.goto(server.EMPTY_PAGE);
for (let i = 0; i < 9; i++) { for (let i = 0; i < 9; i++) {
page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] }); await Promise.all([
await new Promise(f => setTimeout(f, 1)); page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] }),
new Promise(f => setTimeout(f, 1)),
]);
} }
await navigated; await navigated;
expect(await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true); expect(await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);

View file

@ -767,7 +767,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
await page.goto(server.PREFIX + '/one-style.html', {waitUntil: []}); await page.goto(server.PREFIX + '/one-style.html', {waitUntil: []});
await page.waitForLoadState({ waitUntil: 'domcontentloaded' }); await page.waitForLoadState({ waitUntil: 'domcontentloaded' });
}); });
it.skip(FFOX)('should work with pages that have loaded before being connected to', async({page, context, server}) => { it('should work with pages that have loaded before being connected to', async({page, context, server}) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
await page.evaluate(async () => { await page.evaluate(async () => {
const child = window.open(document.location.href); const child = window.open(document.location.href);
@ -903,7 +903,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
it('should work', async({page, server}) => { it('should work', async({page, server}) => {
await page.goto(server.PREFIX + '/frames/one-frame.html'); await page.goto(server.PREFIX + '/frames/one-frame.html');
const frame = page.frames()[1]; const frame = page.frames()[1];
const requestPromise = new Promise(resolve => page.route(server.PREFIX + '/one-style.css',resolve)); const requestPromise = new Promise(resolve => page.route(server.PREFIX + '/one-style.css',resolve));
await frame.goto(server.PREFIX + '/one-style.html', {waitUntil: 'domcontentloaded'}); await frame.goto(server.PREFIX + '/one-style.html', {waitUntil: 'domcontentloaded'});
const request = await requestPromise; const request = await requestPromise;

View file

@ -76,7 +76,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
await newPage.close(); await newPage.close();
expect(newPage.isClosed()).toBe(true); expect(newPage.isClosed()).toBe(true);
}); });
it.skip(FFOX)('should terminate network waiters', async({context, server}) => { it('should terminate network waiters', async({context, server}) => {
const newPage = await context.newPage(); const newPage = await context.newPage();
const results = await Promise.all([ const results = await Promise.all([
newPage.waitForRequest(server.EMPTY_PAGE).catch(e => e), newPage.waitForRequest(server.EMPTY_PAGE).catch(e => e),
@ -220,18 +220,18 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
}); });
}); });
// @see https://github.com/GoogleChrome/puppeteer/issues/3865 // @see https://github.com/GoogleChrome/puppeteer/issues/3865
it.skip(FFOX)('should not throw when there are console messages in detached iframes', async({page, server}) => { it('should not throw when there are console messages in detached iframes', async({page, server}) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
await page.evaluate(async() => { await page.evaluate(async() => {
// 1. Create a popup that Playwright is not connected to. // 1. Create a popup that Playwright is not connected to.
const win = window.open(window.location.href, 'Title', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top=0,left=0'); const win = window.open(window.location.href, 'Title', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top=0,left=0');
while (window.document.readyState !== 'complete') if (window.document.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100)); await new Promise(f => window.addEventListener('load', f));
// 2. In this popup, create an iframe that console.logs a message. // 2. In this popup, create an iframe that console.logs a message.
win.document.body.innerHTML = `<iframe src='/consolelog.html'></iframe>`; win.document.body.innerHTML = `<iframe src='/consolelog.html'></iframe>`;
const frame = win.document.querySelector('iframe'); const frame = win.document.querySelector('iframe');
while (frame.contentDocument.readyState !== 'complete') if (!frame.contentDocument || frame.contentDocument.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100)); await new Promise(f => frame.addEventListener('load', f));
// 3. After that, remove the iframe. // 3. After that, remove the iframe.
frame.remove(); frame.remove();
}); });

View file

@ -96,7 +96,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false); expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close(); await context.close();
}); });
it.skip(FFOX)('should work with clicking target=_blank', async({newContext, server}) => { it('should work with clicking target=_blank', async({newContext, server}) => {
const context = await newContext(); const context = await newContext();
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
@ -109,7 +109,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(true); expect(await popup.evaluate(() => !!window.opener)).toBe(true);
await context.close(); await context.close();
}); });
it.skip(FFOX)('should work with fake-clicking target=_blank and rel=noopener', async({newContext, server}) => { it('should work with fake-clicking target=_blank and rel=noopener', async({newContext, server}) => {
const context = await newContext(); const context = await newContext();
const page = await context.newPage(); const page = await context.newPage();
// TODO: FFOX sends events for "one-style.html" request to both pages. // TODO: FFOX sends events for "one-style.html" request to both pages.
@ -125,7 +125,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false); expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close(); await context.close();
}); });
it.skip(FFOX)('should work with clicking target=_blank and rel=noopener', async({newContext, server}) => { it('should work with clicking target=_blank and rel=noopener', async({newContext, server}) => {
const context = await newContext(); const context = await newContext();
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
@ -138,7 +138,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false); expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close(); await context.close();
}); });
it.skip(FFOX)('should not treat navigations as new popups', async({newContext, server}) => { it('should not treat navigations as new popups', async({newContext, server}) => {
const context = await newContext(); const context = await newContext();
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);

View file

@ -181,8 +181,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const screenshot = await page.screenshot(); const screenshot = await page.screenshot();
expect(screenshot).toBeGolden('screenshot-webgl.png'); expect(screenshot).toBeGolden('screenshot-webgl.png');
}); });
// firefox is flaky it('should work while navigating', async({page, server}) => {
it.skip(FFOX)('should work while navigating', async({page, server}) => {
await page.setViewportSize({width: 500, height: 500}); await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/redirectloop1.html'); await page.goto(server.PREFIX + '/redirectloop1.html');
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {

6
test/types.d.ts vendored
View file

@ -24,7 +24,7 @@ interface Expect<T> {
type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction}; type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction};
type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>}; type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};
type TestRunner<STATE> = { type TestRunner<STATE> = {
describe: DescribeFunction; describe: DescribeFunction;
@ -94,10 +94,10 @@ interface TestServer {
waitForRequest(path: string): Promise<IncomingMessage>; waitForRequest(path: string): Promise<IncomingMessage>;
reset(); reset();
serveFile(request: IncomingMessage, response: ServerResponse, pathName: string); serveFile(request: IncomingMessage, response: ServerResponse, pathName: string);
PORT: number; PORT: number;
PREFIX: string; PREFIX: string;
CROSS_PROCESS_PREFIX: string; CROSS_PROCESS_PREFIX: string;
EMPTY_PAGE: string; EMPTY_PAGE: string;
} }