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 resolveBin = require('resolve-as-bin');
|
||||
|
||||
const cypress = (commandName, { updateScreenshots }) => {
|
||||
const cypress = (commandName, { updateScreenshots, browser }) => {
|
||||
// Support running an unpublished dev build
|
||||
const dirname = __dirname.split(sep).pop();
|
||||
const projectPath = resolve(`${__dirname}${dirname === 'dist' ? '/..' : ''}`);
|
||||
@ -16,6 +16,10 @@ const cypress = (commandName, { updateScreenshots }) => {
|
||||
|
||||
const cypressOptions = [commandName, '--env', `${CWD},${UPDATE_SCREENSHOTS}`, `--project=${projectPath}`];
|
||||
|
||||
if (browser) {
|
||||
cypressOptions.push('--browser', browser);
|
||||
}
|
||||
|
||||
const execaOptions = {
|
||||
cwd: __dirname,
|
||||
stdio: 'inherit',
|
||||
@ -32,17 +36,21 @@ const cypress = (commandName, { updateScreenshots }) => {
|
||||
module.exports = () => {
|
||||
const updateOption = '-u, --update-screenshots';
|
||||
const updateDescription = 'update expected screenshots';
|
||||
const browserOption = '-b, --browser <browser>';
|
||||
const browserDescription = 'specify which browser to use';
|
||||
|
||||
program
|
||||
.command('open')
|
||||
.description('runs tests within the interactive GUI')
|
||||
.option(updateOption, updateDescription)
|
||||
.option(browserOption, browserDescription)
|
||||
.action((options) => cypress('open', options));
|
||||
|
||||
program
|
||||
.command('run')
|
||||
.description('runs tests from the CLI without the GUI')
|
||||
.option(updateOption, updateDescription)
|
||||
.option(browserOption, browserDescription)
|
||||
.action((options) => cypress('run', options));
|
||||
|
||||
program.parse(process.argv);
|
||||
|
Loading…
Reference in New Issue
Block a user