-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Viewport for scenarios #472
base: master
Are you sure you want to change the base?
Conversation
I believe I have a requirement for this functionality too. I'm working with display screens (think advertising display boards) and the URL parameters are actually tied to the possible viewport sizes. |
@garris , would you like to have a look at this PR? |
I see where you're going with this but I am concerned about this change. I think this could cause a regression with Unfortunately there are no tests around that yet. If you wanted to pursue this change you'd need to create some tests to ensure both these two issues are ok. Also, there is a lot of work going into the chrome-headless branch. You would need to add this change there also. In the past, for cases like this I usually recommend just creating multiple configs and running them from the command line or a runner script -- just create a config for each viewport. |
I see the need to add tests for getFilename() in genBitmaps.js. Using different config files for different view ports is good, however the challenge with that is maintaining two sets, and some times selector may be same for these different view ports in which case we will end up repeating same scenario. |
I'm still wondering how best to approach this.
For my current requirement this would be say 10 different configs, each with one scenario. This is because the URL and the viewport are coupled. Is it possible to combine the backstop results into a single report or would I have to work with 10 separate reports? Can you point to any example code where multiple configs have been employed? |
Pull latest garris master
…ults to CONCURRENCY_DEFAULT which is 10
Merge head fork with latest 3.0.26 to kiran-redhat backstopjs
Merge branch 'master' into acceptChromePath with v3.0.26
Merge Origin master
Merge latest 3.0.31
is there any update on this? This is something that in our project could really be useful |
Many apologies to everyone on this thread. This change was posted when I was overwhelmed with other work. If anyone wants to pick this up and test it we could work to bring it in. |
I also need this feature, how can I help this PR? |
As with @SengitU this would be incredibly useful for me too. Can I help at all? |
Ok. It has come to my attention that people really really want this update. Backstop has changed very significantly since the original pr for this. For anyone willing to refactor this for puppeteer I would gladly bring this in. We just need to have sufficient tests around it. Just to be clear about the api — if backstop finds a viewports array inside a scenario, that one would be used instead of the one at the root of the config. Does that work? |
@garris I've written a rough new implementation of this, will submit it shortly. Could I ask:
|
That’s great!
|
Hello, I've created a PR for this feature, feel free to share your comments. See #844 . |
Hey @garris
It's a great tool, appreciate your efforts on this.
I am testing with 8 viewports and the challenge I had is there are different selectors for different viewports(selector changes and different layout gets displayed based on viewport size). I have a one onReadyScript to navigate to that particular screen(where layout gets changed) then scenario has a selector to capture screen. It can't find the selector(as it is changed for mobile vieport) while looping through each viewport then takes no screenshot but displays the default "selectorNotFound_noun_164558_cc.png". With this PR, we can specify same onReadyScript file and have two scenarios with different selectors (one for laptop size & other for mobile size) so it won't show 'selector not found image".
Alternative to this would be using two onReadyScript scripts but we have to repeat the same code & selectors twice.
With this PR: Scenario will use it's viewports if exists. This is useful when testing responsive websites. For e.g. selector may change based on viewport's size for one or two scenarios in which case you don't want to create another config file.