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' });
const navigated = page.goto(server.EMPTY_PAGE);
for (let i = 0; i < 9; i++) {
page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] });
await new Promise(f => setTimeout(f, 1));
await Promise.all([
page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] }),
new Promise(f => setTimeout(f, 1)),
]);
}
await navigated;
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.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.evaluate(async () => {
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}) => {
await page.goto(server.PREFIX + '/frames/one-frame.html');
const frame = page.frames()[1];
const requestPromise = new Promise(resolve => page.route(server.PREFIX + '/one-style.css',resolve));
await frame.goto(server.PREFIX + '/one-style.html', {waitUntil: 'domcontentloaded'});
const request = await requestPromise;

View File

@ -76,7 +76,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
await newPage.close();
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 results = await Promise.all([
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
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.evaluate(async() => {
// 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');
while (window.document.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100));
if (window.document.readyState !== 'complete')
await new Promise(f => window.addEventListener('load', f));
// 2. In this popup, create an iframe that console.logs a message.
win.document.body.innerHTML = `<iframe src='/consolelog.html'></iframe>`;
const frame = win.document.querySelector('iframe');
while (frame.contentDocument.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100));
if (!frame.contentDocument || frame.contentDocument.readyState !== 'complete')
await new Promise(f => frame.addEventListener('load', f));
// 3. After that, remove the iframe.
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);
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 page = await context.newPage();
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);
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 page = await context.newPage();
// 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);
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 page = await context.newPage();
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);
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 page = await context.newPage();
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();
expect(screenshot).toBeGolden('screenshot-webgl.png');
});
// firefox is flaky
it.skip(FFOX)('should work while navigating', async({page, server}) => {
it('should work while navigating', async({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/redirectloop1.html');
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 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> = {
describe: DescribeFunction;
@ -94,10 +94,10 @@ interface TestServer {
waitForRequest(path: string): Promise<IncomingMessage>;
reset();
serveFile(request: IncomingMessage, response: ServerResponse, pathName: string);
PORT: number;
PREFIX: string;
CROSS_PROCESS_PREFIX: string;
EMPTY_PAGE: string;
}