BackstopJS
BackstopJS copied to clipboard
Add filter to globally determine viewport
Some quick questions:
1: I am trying to test/add some functionality to createBitmaps.js to add something similar to "--filter" but instead do "--viewports" where I can specific labels of viewport configuration to run globally. I was already looking at the issue #577 and the addition of the custom array to scenarios is great, but I was curious if I could figure out how to add functionality on a smaller scale. However, I don't know how to test my code, like at all. I'm a novice in trying to implement changes in original code.
2: I was looking at lines 55-65 of createBitmaps.js to see how the filter argument is handled, and was wondering if a similar functionality could be implemented for viewports using similar code. For example:
if (config.args.viewports) { var viewports = []; config.arts.viewports.split(',').forEach(function (filteredTest){ each(configJSON.viewports, function (viewport) { if (regexTest(viewport.label, filteredTest)) { viewports.push(viewport); } }); }); configJSON.viewports = viewports; }
I'm not sure what else this would need or if the config.args.filter is defined somewhere else and I would need to add a definition for viewports as well.
Thanks in advance for any advice or help you can give me! I'm mostly just looking for how to test this on my own machine since after looking through the issues log it seems most people wouldn't need similar functionality.
I'm looking for a way to debug a scenario and only run one viewport at a time. This would be very useful (especially as a new user).
This isn't natively supported-- maybe just edit your viewports properties in the config? Comment out the ones you don't want while debugging?
You can optionally add a viewports property to your scenario -- that overrides the root level one in the config (just another way to do it)