sealights-cucumber-plugin
v2.0.97
Published
Cucumber integration for sealights
Downloads
2,487
Readme
sealights-cucumber-plugin
This is the sealights plugin for Cucumber.js.
Install
npm install sealights-cucumber-plugin
Usage
Pass path-to-plugin
as require
option of cucumber command
npx cucumber-js ./features ... --require <path-to-plugin>
Or set it in config file
// cucumber.js
module.exports = {
default: {
...
require: [
'./features/support/*',
'<path-to-plugin>',
]
}
};
Note: Usage of --require
option override default definition of path to step definitions.
Pass it explicitly if you don't do it yet. Example:
npx cucumber-js ./features --require ./src/steps/*.steps.ts --require <path-to-plugin>
Resolve path to plugin
Resolve path to plugin dynamically
CommonJs
const pathToPlugin = require.resolve('sealights-cucumber-plugin');
ESM
import url from 'node:url';
const pluginUrl = import.meta.resolve('sealights-cucumber-plugin');
const pathToPlugin = url.fileURLToPath(new URL(pluginUrl));
Resolve in CLI
Execution of next command allow to resolve path in CLI if node available on machine
Unix:
SL_PACKAGE=$(node -p "require.resolve('sealights-cucumber-plugin')")
PowerShell:
$Env:SL_PACKAGE = node -p "require.resolve('sealights-cucumber-plugin')"
If any of this option don't work for you can use static path to plugin
./node_modules/sealight-cucumber/plugin/tsOutputs/lib/cucumber-integration.js
But it is not recommended and it can be changed.
Usage in protractor.conf or wdio.conf
Pass path-to-plugin
as require
option of cucumber command
cucumberOpts: {
require: [
'./src/steps/*.steps.ts',
'<path-to-plugin>'
]
},
Passing parameters
Passing parameters to plugin via config file
Create a file sl.conf
and fill it with config in JSON format
{
tokenfile: <path/to/token-file>,
buildsessionidfile: <path/to/buildSessionId-file>,
testStage: e2e,
}
Passing parameters to reporter via CLI
!!! Not recommended. This case won`t work in the latest version of cucumber, use file config instead
From the command line add sealights parameters with --sl-
prefix
npx cucumber-js ./features --sl-tokenfile <path/to/token-file> --sl-buildsessionidfile <path/to/buildSessionId-file> --sl-testStage e2e
Supported parameters
- token - Sealights token
- tokenFile - Path to file contains the Sealights token
- buildSessionId - Sealights build session id
- buildSessionIdFile - Path to file contains the Sealights build session id
- testStage - Test stage current tests are relates to
- labId - Pre-defined Sealights lab-id (optional)
- proxy - Proxy server (optional)
Author
Sealights