Download browser at start of test
This commit is contained in:
@@ -7,8 +7,6 @@ jobs:
|
|||||||
- job: Linux
|
- job: Linux
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-16.04'
|
vmImage: 'ubuntu-16.04'
|
||||||
variables:
|
|
||||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
@@ -42,8 +40,6 @@ jobs:
|
|||||||
- job: macOS
|
- job: macOS
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'xcode9-macos10.13'
|
vmImage: 'xcode9-macos10.13'
|
||||||
variables:
|
|
||||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
@@ -64,8 +60,6 @@ jobs:
|
|||||||
- job: Windows
|
- job: Windows
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'vs2017-win2016'
|
vmImage: 'vs2017-win2016'
|
||||||
variables:
|
|
||||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
@@ -139,8 +133,6 @@ jobs:
|
|||||||
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true')))
|
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true')))
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-16.04'
|
vmImage: 'ubuntu-16.04'
|
||||||
variables:
|
|
||||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2020 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
const playwright = require('playwright-core');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
// Default to chromium
|
||||||
|
let browserType = playwright['chromium'];
|
||||||
|
const index = process.argv.indexOf('--browser');
|
||||||
|
if (index !== -1 && process.argv.length > index + 1 && typeof process.argv[index + 1] === 'string') {
|
||||||
|
const string = process.argv[index + 1];
|
||||||
|
if (string === 'firefox' || string === 'webkit') {
|
||||||
|
browserType = playwright[string];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const exists = fs.existsSync(browserType.executablePath());
|
||||||
|
if (!exists) {
|
||||||
|
console.log(`Downloading ${browserType.name()}`);
|
||||||
|
browserType.downloadBrowserIfNeeded().then(() => process.exit(0));
|
||||||
|
}
|
||||||
@@ -18,6 +18,9 @@
|
|||||||
"test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 10000",
|
"test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 10000",
|
||||||
"test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 10000",
|
"test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 10000",
|
||||||
"test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 10000",
|
"test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 10000",
|
||||||
|
"pretest-api-chromium": "node ./bin/download_browser.js --browser chromium",
|
||||||
|
"pretest-api-firefox": "node ./bin/download_browser.js --browser firefox",
|
||||||
|
"pretest-api-webkit": "node ./bin/download_browser.js --browser webkit",
|
||||||
"test-unit": "node ./bin/test.js",
|
"test-unit": "node ./bin/test.js",
|
||||||
"test-unit-coverage": "node ./bin/test.js --coverage",
|
"test-unit-coverage": "node ./bin/test.js --coverage",
|
||||||
"build": "tsc -b ./tsconfig.all.json",
|
"build": "tsc -b ./tsconfig.all.json",
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export async function getBrowserType(): Promise<playwright.BrowserType> {
|
|||||||
let browserType: playwright.BrowserType = playwright['chromium'];
|
let browserType: playwright.BrowserType = playwright['chromium'];
|
||||||
|
|
||||||
const index = process.argv.indexOf('--browser');
|
const index = process.argv.indexOf('--browser');
|
||||||
if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') {
|
if (index !== -1 && process.argv.length > index + 1 && typeof process.argv[index + 1] === 'string') {
|
||||||
const string = process.argv[index + 1];
|
const string = process.argv[index + 1];
|
||||||
if (string === 'firefox' || string === 'webkit') {
|
if (string === 'firefox' || string === 'webkit') {
|
||||||
browserType = playwright[string];
|
browserType = playwright[string];
|
||||||
|
|||||||
Reference in New Issue
Block a user