BackstopJS icon indicating copy to clipboard operation
BackstopJS copied to clipboard

Can you use `removeSelectors` globally?

Open line47 opened this issue 5 years ago • 3 comments

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

line47 avatar Sep 03 '19 14:09 line47

I've got a similar question for the delay property as well, can that be applied once at a global level?

line47 avatar Sep 03 '19 15:09 line47

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

6uliver avatar Oct 28 '19 10:10 6uliver

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?

JPustkuchen avatar Aug 10 '22 05:08 JPustkuchen