mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Feat: Adding an optional browser config option to e2e test runner (#59076)
Adding an optional browser config option to e2e test runner
This commit is contained in:
parent
6f00bc5674
commit
24ce1a8a0b
@ -3,7 +3,7 @@ const execa = require('execa');
|
|||||||
const { resolve, sep } = require('path');
|
const { resolve, sep } = require('path');
|
||||||
const resolveBin = require('resolve-as-bin');
|
const resolveBin = require('resolve-as-bin');
|
||||||
|
|
||||||
const cypress = (commandName, { updateScreenshots }) => {
|
const cypress = (commandName, { updateScreenshots, browser }) => {
|
||||||
// Support running an unpublished dev build
|
// Support running an unpublished dev build
|
||||||
const dirname = __dirname.split(sep).pop();
|
const dirname = __dirname.split(sep).pop();
|
||||||
const projectPath = resolve(`${__dirname}${dirname === 'dist' ? '/..' : ''}`);
|
const projectPath = resolve(`${__dirname}${dirname === 'dist' ? '/..' : ''}`);
|
||||||
@ -16,6 +16,10 @@ const cypress = (commandName, { updateScreenshots }) => {
|
|||||||
|
|
||||||
const cypressOptions = [commandName, '--env', `${CWD},${UPDATE_SCREENSHOTS}`, `--project=${projectPath}`];
|
const cypressOptions = [commandName, '--env', `${CWD},${UPDATE_SCREENSHOTS}`, `--project=${projectPath}`];
|
||||||
|
|
||||||
|
if (browser) {
|
||||||
|
cypressOptions.push('--browser', browser);
|
||||||
|
}
|
||||||
|
|
||||||
const execaOptions = {
|
const execaOptions = {
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
@ -32,17 +36,21 @@ const cypress = (commandName, { updateScreenshots }) => {
|
|||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
const updateOption = '-u, --update-screenshots';
|
const updateOption = '-u, --update-screenshots';
|
||||||
const updateDescription = 'update expected screenshots';
|
const updateDescription = 'update expected screenshots';
|
||||||
|
const browserOption = '-b, --browser <browser>';
|
||||||
|
const browserDescription = 'specify which browser to use';
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('open')
|
.command('open')
|
||||||
.description('runs tests within the interactive GUI')
|
.description('runs tests within the interactive GUI')
|
||||||
.option(updateOption, updateDescription)
|
.option(updateOption, updateDescription)
|
||||||
|
.option(browserOption, browserDescription)
|
||||||
.action((options) => cypress('open', options));
|
.action((options) => cypress('open', options));
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('run')
|
.command('run')
|
||||||
.description('runs tests from the CLI without the GUI')
|
.description('runs tests from the CLI without the GUI')
|
||||||
.option(updateOption, updateDescription)
|
.option(updateOption, updateDescription)
|
||||||
|
.option(browserOption, browserDescription)
|
||||||
.action((options) => cypress('run', options));
|
.action((options) => cypress('run', options));
|
||||||
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user