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

Commit

Permalink
Allow maxInstances
Browse files Browse the repository at this point in the history
  • Loading branch information
saket2403 committed Nov 29, 2023
1 parent c2de29b commit e05f138
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
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
7 changes: 4 additions & 3 deletions packages/terra-functional-testing/src/config/capabilities.js
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);
const maxInstancesIndex = args.indexOf('--maxInstances');
const maxInstances = maxInstancesIndex !== -1 ? parseInt(args[maxInstancesIndex + 1], 10) : 1;

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

0 comments on commit e05f138

Please sign in to comment.