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

[terra-functional-testing] Allow consumers to set maxInstances while executing WDIO. #837

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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

* Changed
* Allow consumers to set maxInstances while executing wdio scripts.

## 4.4.0 - (September 26, 2023)

* Changed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* This file contains the capability configurations for each supported browser.
*/
const getMaxInstances = require('./utils/getMaxInstances');

module.exports = {
chrome: {
browserName: 'chrome',
maxInstances: 1,
maxInstances: getMaxInstances(),
'goog:chromeOptions': {
/**
* Run in headless mode because Chrome 69+ cannot be resized to the tiny viewport due to a omnibox size change
Expand All @@ -19,7 +20,7 @@ module.exports = {
},
firefox: {
browserName: 'firefox',
maxInstances: 1,
maxInstances: getMaxInstances(),
'moz:firefoxOptions': {
prefs: {
'dom.disable_beforeunload': false,
Expand All @@ -28,7 +29,7 @@ module.exports = {
},
ie: {
browserName: 'internet explorer',
maxInstances: 1,
maxInstances: getMaxInstances(),
'se:ieOptions': {
javascriptEnabled: true,
locationContextEnabled: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = () => {
const args = process.argv.slice(2);
saket2403 marked this conversation as resolved.
Show resolved Hide resolved
const maxInstancesIndex = args.indexOf('--maxInstances');
const maxInstances = maxInstancesIndex !== -1 ? parseInt(args[maxInstancesIndex + 1], 10) : 1;
saket2403 marked this conversation as resolved.
Show resolved Hide resolved

return maxInstances;
};
11 changes: 11 additions & 0 deletions packages/terra-functional-testing/src/terra-cli/wdio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ const cli = {
return ['en'];
},
},
maxInstances: {
type: 'number',
describe: 'The number of tests running concurrently.',
default: () => {
if (process.env.MAX_INSTANCES) {
return [process.env.MAX_INSTANCES];
}

return 1;
},
},
screenshotUrl: {
type: 'string',
describe: 'The url to the registry that stores the screenshots',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Options:
[boolean] [default: false]
--locales A list of language locales for the test
run. [array] [default: (_default)]
--maxInstances The number of tests running
concurrently.
[number] [default: (_default)]
--screenshotUrl The url to the registry that stores the
screenshots
[string] [default: (_default)]
Expand Down
Loading