From 80da0f7b692464645423a439ddad46a1f7ff1403 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 12 Nov 2021 00:00:13 -0800 Subject: [PATCH] test: test gardening (#10258) --- tests/browsertype-launch-selenium.spec.ts | 7 ++++++- tests/page/interception.spec.ts | 3 ++- tests/page/page-network-response.spec.ts | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/browsertype-launch-selenium.spec.ts b/tests/browsertype-launch-selenium.spec.ts index f7a405d8a7..655b59a52c 100644 --- a/tests/browsertype-launch-selenium.spec.ts +++ b/tests/browsertype-launch-selenium.spec.ts @@ -19,6 +19,7 @@ import type { TestInfo } from '@playwright/test'; import path from 'path'; import fs from 'fs'; import { start } from '../packages/playwright-core/lib/outofprocess'; +import { spawnSync } from 'child_process'; const chromeDriver = require('chromedriver').path; const brokenDriver = path.join(__dirname, 'assets', 'selenium-grid', 'broken-selenium-driver.js'); @@ -34,7 +35,11 @@ function writeSeleniumConfig(testInfo: TestInfo, port: number) { } test.skip(({ mode }) => mode !== 'default', 'Using test hooks'); -test.skip(() => !!process.env.INSIDE_DOCKER, 'Docker image does not have Java'); +test.skip(() => { + // Skip if Java is not installed. + const { status, error } = spawnSync('java', ['-version']); + return !!error || status !== 0; +}); test.slow(); test('selenium grid 3.141.59 standalone chromium', async ({ browserName, childProcess, waitForPort, browserType }, testInfo) => { diff --git a/tests/page/interception.spec.ts b/tests/page/interception.spec.ts index 170d159b6d..f229d93c3a 100644 --- a/tests/page/interception.spec.ts +++ b/tests/page/interception.spec.ts @@ -105,9 +105,10 @@ it('should intercept network activity from worker', async function({ page, serve expect(msg.text()).toBe('intercepted'); }); -it('should intercept network activity from worker 2', async function({ page, server, isElectron, isAndroid, browserName }) { +it('should intercept network activity from worker 2', async function({ page, server, isElectron, isAndroid, browserName, browserMajorVersion }) { it.skip(isAndroid); it.fixme(isElectron); + it.fixme(browserName === 'chromium' && browserMajorVersion === 97, '@see https://github.com/microsoft/playwright/issues/10048'); const url = server.PREFIX + '/worker/worker.js'; await page.route(url, route => { diff --git a/tests/page/page-network-response.spec.ts b/tests/page/page-network-response.spec.ts index 20893b54b3..170600ac53 100644 --- a/tests/page/page-network-response.spec.ts +++ b/tests/page/page-network-response.spec.ts @@ -268,12 +268,15 @@ it('should behave the same way for headers and allHeaders', async ({ page, serve expect(allHeaders['name-b']).toEqual('v4'); }); -it('should provide a Response with a file URL', async ({ page, asset, isAndroid, browserName }) => { +it('should provide a Response with a file URL', async ({ page, asset, isAndroid, isElectron, isWindows, browserName }) => { it.skip(isAndroid, 'No files on Android'); it.fixme(browserName === 'firefox', 'Firefox does return null for file:// URLs'); const fileurl = url.pathToFileURL(asset('frames/two-frames.html')).href; const response = await page.goto(fileurl); - expect(response.status()).toBe(0); + if (isElectron || (browserName === 'webkit' && isWindows)) + expect(response.status()).toBe(200); + else + expect(response.status()).toBe(0); expect(response.ok()).toBe(true); });