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

Commit

Permalink
Browse files Browse the repository at this point in the history
…r-js into main
  • Loading branch information
John Doherty committed Mar 1, 2021
2 parents 74c0e14 + 3a42a0b commit f3e5970
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ node ./node_modules/puppeteer-cucumber-js/index.js # path to the module within y
--version # outputs puppeteer-cucumber-js version number
--help # list puppeteer-cucumber-js options
--failFast # abort the run on first failure
--slowMo <n> # specified amount of milliseconds to slow down Puppeteer operations by. defaults to 10 ms
```

### Browser teardown strategy
Expand Down
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var config = {
browserTeardownStrategy: 'always',
timeout: 15000,
headless: false,
devTools: false
devTools: false,
slowMo: 10
};

folderCheck();
Expand All @@ -35,6 +36,7 @@ global.devTools = config.devTools;
global.userAgent = '';
global.disableLaunchReport = false;
global.noScreenshot = false;
global.slowMo = config.slowMo;

program
.version(pjson.version)
Expand All @@ -52,6 +54,7 @@ program
.option('--worldParameters <JSON>', 'JSON object to pass to cucumber-js world constructor. defaults to empty', config.worldParameters)
.option('--userAgent <string>', 'user agent string')
.option('--failFast', 'abort the run on first failure')
.option('--slowMo <number>', 'specified amount of milliseconds to slow down Puppeteer operations by. Defaults to ' + config.slowMo)
.parse(process.argv);

program.on('--help', function () {
Expand Down Expand Up @@ -117,8 +120,11 @@ global.disableLaunchReport = (program.disableLaunchReport);
// used with world.js to determine if a screenshot should be captured on error
global.noScreenshot = (program.noScreenshot);

// set the default timeout to 10 seconds if not already globally defined or passed via the command line
global.DEFAULT_TIMEOUT = global.DEFAULT_TIMEOUT || program.timeOut || 10 * 1000;
// set the default timeout if not passed via the command line
global.DEFAULT_TIMEOUT = program.timeOut || config.timeout;

// set the default slowMo if not passed via the command line
global.DEFAULT_SLOW_MO = program.slowMo || config.slowMo;

// used within world.js to import shared objects into the shared namespace
var sharedObjectsPath = path.resolve(config.sharedObjects);
Expand Down
2 changes: 1 addition & 1 deletion runtime/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = async function () {
product: browserName || 'chrome',
defaultViewport: null,
devtools: devTools === true,
slowMo: 10, // slow down by 10ms so we can view in headful mode
slowMo: global.DEFAULT_SLOW_MO, // slow down by specified ms so we can view in headful mode
args: [
`--window-size=${browserWidth},${browserHeight}`
]
Expand Down

0 comments on commit f3e5970

Please sign in to comment.