BackstopJS
BackstopJS copied to clipboard
Can you use `removeSelectors` globally?
Or does it need to be per scenario?
For example, I'd like to remove a div using the removeSelectors
option but would like to add that reference once instead of 50+ times for each scenario
I've got a similar question for the delay
property as well, can that be applied once at a global level?
You can use a JS file as config which exports the config object. I'm using it for setting default values, for example misMatchThreshold and delay. You can use arguments too from process.argv to set parameters dynamically (eg. credentials).
The sketch of my file:
// declarative, static config
const config = require('./backstop.json');
const defaultScenarioConfig = {
...
};
config.scenarios = config.scenarios.map(scenario => {
return Object.assign({}, defaultScenarioConfig, scenario);
});
module.exports = config;
You can pass config with a parameter:
backstop test --config=backstop-config.js
I created a general feature request for this: https://github.com/garris/BackstopJS/issues/1432 So perhaps this particular issue can be closed and people could vote on the general issue?