feat: start downloading firefox-stable channel (#6177)
This patch adds support for downloading and running Playwright with firefox-stable channel. References #5993
This commit is contained in:
parent
033bc9bfcc
commit
23dfaf9e9b
80
.github/workflows/tests.yml
vendored
80
.github/workflows/tests.yml
vendored
|
|
@ -316,6 +316,86 @@ jobs:
|
|||
name: chrome-stable-mac-test-results
|
||||
path: test-results
|
||||
|
||||
firefox_stable_linux:
|
||||
name: "Firefox Stable (Linux)"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 10
|
||||
- run: npm ci
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install-deps firefox
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
||||
# Wrap `npm run` in a subshell to redirect STDERR to file.
|
||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "npm run ftest"
|
||||
env:
|
||||
PWTEST_CHANNEL: "firefox-stable"
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
if: always()
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: firefox-stable-linux-test-results
|
||||
path: test-results
|
||||
|
||||
firefox_stable_win:
|
||||
name: "Firefox Stable (Win)"
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Install Media Pack
|
||||
shell: powershell
|
||||
run: Install-WindowsFeature Server-Media-Foundation
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 10
|
||||
- run: npm ci
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
- run: npm run ftest
|
||||
shell: bash
|
||||
env:
|
||||
PWTEST_CHANNEL: "firefox-stable"
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
if: always()
|
||||
shell: bash
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: firefox-stable-win-test-results
|
||||
path: test-results
|
||||
|
||||
firefox_stable_mac:
|
||||
name: "Firefox Stable (Mac)"
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 10
|
||||
- run: npm ci
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
- run: npm run ftest
|
||||
env:
|
||||
PWTEST_CHANNEL: "firefox-stable"
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
if: always()
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: firefox-stable-mac-test-results
|
||||
path: test-results
|
||||
|
||||
edge_stable_win:
|
||||
name: "Edge Stable (Win)"
|
||||
runs-on: windows-latest
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@
|
|||
"revision": "1245",
|
||||
"installByDefault": true
|
||||
},
|
||||
{
|
||||
"name": "firefox-stable",
|
||||
"revision": "1242",
|
||||
"installByDefault": false
|
||||
},
|
||||
{
|
||||
"name": "webkit",
|
||||
"revision": "1463",
|
||||
|
|
|
|||
|
|
@ -84,18 +84,18 @@ program
|
|||
program
|
||||
.command('install [browserType...]')
|
||||
.description('ensure browsers necessary for this version of Playwright are installed')
|
||||
.action(async function(browserType) {
|
||||
.action(async function(browserTypes) {
|
||||
try {
|
||||
const allBrowsers = new Set(allBrowserNames);
|
||||
for (const type of browserType) {
|
||||
if (!allBrowsers.has(type)) {
|
||||
console.log(`Invalid browser name: '${type}'. Expecting one of: ${allBrowserNames.map(name => `'${name}'`).join(', ')}`);
|
||||
for (const browserType of browserTypes) {
|
||||
if (!allBrowsers.has(browserType)) {
|
||||
console.log(`Invalid browser name: '${browserType}'. Expecting one of: ${allBrowserNames.map(name => `'${name}'`).join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
if (browserType.length && browserType.includes('chromium'))
|
||||
browserType = browserType.concat('ffmpeg');
|
||||
await installBrowsers(browserType.length ? browserType : undefined);
|
||||
if (browserTypes.length && browserTypes.includes('chromium'))
|
||||
browserTypes = browserTypes.concat('ffmpeg');
|
||||
await installBrowsers(browserTypes.length ? browserTypes : undefined);
|
||||
} catch (e) {
|
||||
console.log(`Failed to install browsers\n${e}`);
|
||||
process.exit(1);
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export interface BrowserTypeChannel extends Channel {
|
|||
connectOverCDP(params: BrowserTypeConnectOverCDPParams, metadata?: Metadata): Promise<BrowserTypeConnectOverCDPResult>;
|
||||
}
|
||||
export type BrowserTypeLaunchParams = {
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary' | 'firefox-stable',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
|
|
@ -232,7 +232,7 @@ export type BrowserTypeLaunchParams = {
|
|||
slowMo?: number,
|
||||
};
|
||||
export type BrowserTypeLaunchOptions = {
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary' | 'firefox-stable',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
|
|
@ -259,7 +259,7 @@ export type BrowserTypeLaunchResult = {
|
|||
browser: BrowserChannel,
|
||||
};
|
||||
export type BrowserTypeLaunchPersistentContextParams = {
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary' | 'firefox-stable',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
|
|
@ -329,7 +329,7 @@ export type BrowserTypeLaunchPersistentContextParams = {
|
|||
slowMo?: number,
|
||||
};
|
||||
export type BrowserTypeLaunchPersistentContextOptions = {
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary' | 'firefox-stable',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ LaunchOptions:
|
|||
- msedge-beta
|
||||
- msedge-dev
|
||||
- msedge-canary
|
||||
- firefox-stable
|
||||
executablePath: string?
|
||||
args:
|
||||
type: array?
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||
contentScript: tOptional(tBoolean),
|
||||
});
|
||||
scheme.BrowserTypeLaunchParams = tObject({
|
||||
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary'])),
|
||||
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary', 'firefox-stable'])),
|
||||
executablePath: tOptional(tString),
|
||||
args: tOptional(tArray(tString)),
|
||||
ignoreAllDefaultArgs: tOptional(tBoolean),
|
||||
|
|
@ -178,7 +178,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||
slowMo: tOptional(tNumber),
|
||||
});
|
||||
scheme.BrowserTypeLaunchPersistentContextParams = tObject({
|
||||
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary'])),
|
||||
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary', 'firefox-stable'])),
|
||||
executablePath: tOptional(tString),
|
||||
args: tOptional(tArray(tString)),
|
||||
ignoreAllDefaultArgs: tOptional(tBoolean),
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
import * as os from 'os';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { assert } from '../../utils/utils';
|
||||
import { FFBrowser } from './ffBrowser';
|
||||
import { kBrowserCloseMessageId } from './ffConnection';
|
||||
import { BrowserType } from '../browserType';
|
||||
|
|
@ -31,6 +32,18 @@ export class Firefox extends BrowserType {
|
|||
super('firefox', playwrightOptions);
|
||||
}
|
||||
|
||||
executablePath(channel?: types.BrowserChannel): string {
|
||||
if (channel) {
|
||||
let executablePath = undefined;
|
||||
if ((channel as any) === 'firefox-stable')
|
||||
executablePath = this._registry.executablePath('firefox-stable');
|
||||
assert(executablePath, `unsupported firefox channel "${channel}"`);
|
||||
assert(fs.existsSync(executablePath), `"${channel}" channel is not installed. Try running 'npx playwright install ${channel}'`);
|
||||
return executablePath;
|
||||
}
|
||||
return super.executablePath(channel);
|
||||
}
|
||||
|
||||
_connectToTransport(transport: ConnectionTransport, options: BrowserOptions): Promise<FFBrowser> {
|
||||
return FFBrowser.connect(transport, options);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ export type BrowserContextOptions = {
|
|||
|
||||
export type EnvArray = { name: string, value: string }[];
|
||||
|
||||
export type BrowserChannel = 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary';
|
||||
export type BrowserChannel = 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary' | 'firefox-stable';
|
||||
|
||||
type LaunchOptionsBase = {
|
||||
channel?: BrowserChannel,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const DL_OPEN_LIBRARIES = {
|
|||
'webkit': ['libGLESv2.so.2', 'libx264.so'],
|
||||
'webkit-technology-preview': ['libGLESv2.so.2', 'libx264.so'],
|
||||
'firefox': [],
|
||||
'firefox-stable': [],
|
||||
'clank': [],
|
||||
'ffmpeg': [],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import * as util from 'util';
|
|||
import { getUbuntuVersionSync } from './ubuntuVersion';
|
||||
import { assert, getFromENV } from './utils';
|
||||
|
||||
export type BrowserName = 'chromium'|'webkit'|'firefox'|'ffmpeg'|'webkit-technology-preview';
|
||||
export const allBrowserNames: BrowserName[] = ['chromium', 'webkit', 'firefox', 'ffmpeg', 'webkit-technology-preview'];
|
||||
export type BrowserName = 'chromium'|'webkit'|'firefox'|'firefox-stable'|'ffmpeg'|'webkit-technology-preview';
|
||||
export const allBrowserNames: BrowserName[] = ['chromium', 'webkit', 'firefox', 'ffmpeg', 'webkit-technology-preview', 'firefox-stable'];
|
||||
|
||||
const PACKAGE_PATH = path.join(__dirname, '..', '..');
|
||||
|
||||
|
|
@ -58,6 +58,17 @@ const EXECUTABLE_PATHS = {
|
|||
'win32': ['firefox', 'firefox.exe'],
|
||||
'win64': ['firefox', 'firefox.exe'],
|
||||
},
|
||||
'firefox-stable': {
|
||||
'ubuntu18.04': ['firefox', 'firefox'],
|
||||
'ubuntu20.04': ['firefox', 'firefox'],
|
||||
'mac10.13': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
|
||||
'mac10.14': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
|
||||
'mac10.15': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
|
||||
'mac11': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
|
||||
'mac11-arm64': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
|
||||
'win32': ['firefox', 'firefox.exe'],
|
||||
'win64': ['firefox', 'firefox.exe'],
|
||||
},
|
||||
'webkit': {
|
||||
'ubuntu18.04': ['pw_run.sh'],
|
||||
'ubuntu20.04': ['pw_run.sh'],
|
||||
|
|
@ -116,6 +127,17 @@ const DOWNLOAD_URLS = {
|
|||
'win32': '%s/builds/firefox/%s/firefox-win32.zip',
|
||||
'win64': '%s/builds/firefox/%s/firefox-win64.zip',
|
||||
},
|
||||
'firefox-stable': {
|
||||
'ubuntu18.04': '%s/builds/firefox-stable/%s/firefox-stable-ubuntu-18.04.zip',
|
||||
'ubuntu20.04': '%s/builds/firefox-stable/%s/firefox-stable-ubuntu-20.04.zip',
|
||||
'mac10.13': '%s/builds/firefox-stable/%s/firefox-stable-mac-10.14.zip',
|
||||
'mac10.14': '%s/builds/firefox-stable/%s/firefox-stable-mac-10.14.zip',
|
||||
'mac10.15': '%s/builds/firefox-stable/%s/firefox-stable-mac-10.14.zip',
|
||||
'mac11': '%s/builds/firefox-stable/%s/firefox-stable-mac-10.14.zip',
|
||||
'mac11-arm64': '%s/builds/firefox-stable/%s/firefox-stable-mac-11.0-arm64.zip',
|
||||
'win32': '%s/builds/firefox-stable/%s/firefox-stable-win32.zip',
|
||||
'win64': '%s/builds/firefox-stable/%s/firefox-stable-win64.zip',
|
||||
},
|
||||
'webkit': {
|
||||
'ubuntu18.04': '%s/builds/webkit/%s/webkit-ubuntu-18.04.zip',
|
||||
'ubuntu20.04': '%s/builds/webkit/%s/webkit-ubuntu-20.04.zip',
|
||||
|
|
@ -310,6 +332,7 @@ export class Registry {
|
|||
const envDownloadHost: { [key: string]: string } = {
|
||||
'chromium': 'PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST',
|
||||
'firefox': 'PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST',
|
||||
'firefox-stable': 'PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST',
|
||||
'webkit': 'PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST',
|
||||
'webkit-technology-preview': 'PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST',
|
||||
'ffmpeg': 'PLAYWRIGHT_FFMPEG_DOWNLOAD_HOST',
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ it('should run beforeunload if asked for', async ({context, server, isChromium,
|
|||
else if (isWebKit)
|
||||
expect(dialog.message()).toBe('Leave?');
|
||||
else
|
||||
expect(dialog.message()).toBe('This page is asking you to confirm that you want to leave — information you’ve entered may not be saved.');
|
||||
expect(dialog.message()).toContain('This page is asking you to confirm that you want to leave');
|
||||
await Promise.all([
|
||||
dialog.accept(),
|
||||
newPage.waitForEvent('close'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue