Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

[terra-functional-testing] Run tests in all browsers provided by the BROWSERS env variable. #688

Merged
merged 3 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/terra-functional-testing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Fixed
* Run tests in all browsers provided by the `BROWSERS` env variable.

## 2.0.0 - (July 16, 2021)

* Breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const cli = {

// Split the list of BROWSERS into an array if it is set in the string form like 'chrome,firefox,ie'.
if (browsers.includes(',')) {
// There could be empty spaces between each browser name. For example: 'chrome, firefox, ie'.
// Remove all empty spaces in each browser name to avoid adding them with the empty space. For example: [' firefox', ' ie'].
browsers = browsers.replace(/ /g, '');
return browsers.split(',');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ describe('index', () => {
expect(helpOutput).toMatchSnapshot();
});

it('should correctly parse BROWSERS env variable when there are empty spaces', async () => {
process.env.BROWSERS = '[chrome, firefox, ie]';
const parser = yargs.command(command).scriptName('terra');
const options = await new Promise((resolve) => {
parser.parse('wdio', (_err, _argv) => {
resolve(_argv);
});
});

expect(options.browsers).toEqual(['chrome', 'firefox', 'ie']);
});

it('should correctly parse BROWSERS env variable when there are no empty spaces', async () => {
process.env.BROWSERS = '[chrome,firefox,ie]';
const parser = yargs.command(command).scriptName('terra');
const options = await new Promise((resolve) => {
parser.parse('wdio', (_err, _argv) => {
resolve(_argv);
});
});

expect(options.browsers).toEqual(['chrome', 'firefox', 'ie']);
});

it('should invoke the test runner with the default command line arguments', async () => {
const { handler } = command;

Expand Down