Closed jcraggs closed 4 years ago
Hi -- sorry for the late response! Unfortunately, ember-backstop
doesn't allow setting viewports like this because the viewport also relies on Testem's settings. You would have to change the viewport settings in your ember test env and then pass that viewport state in your backstop(assert, { scenario: { viewports: ... } });
Thanks for this Garris, its now working after passing in the viewport state. Also removed the individual objects from the backstop.js viewports array as going forward I will define the specific screen size I want testing on each call of the backstop(assert ...).
For others benefit, essentially I had to call the await backstop for each screen size I wanted to test e.g. to test two screen sizes:
await backstop(assert, {
scenario: {
"viewports": [
{
"label": 'webview',
"width": 1440,
"height": 900
}
]
}
});
await backstop(assert, {
scenario: {
"viewports": [
{
"label": 'zebraDeviceView',
"width": 360,
"height": 570
}
]
}
});
For cleaner code you can also import those viewport objects from a separately defined js file e.g.:
So now the test module file has this:
import viewports from '../viewports';
...
await backstop(assert, { scenario: viewports.webview })
await backstop(assert, { scenario: viewports.zebraDeviceView })
in a new viewports.js file you'll need this:
export default {
webview: {
"viewports": [
{
"label": 'webview',
"width": 1440,
"height": 900
}
]
},
zebraDeviceView: {
"viewports": [
{
"label": 'zebraDeviceView',
"width": 360,
"height": 570
}
]
}
};
First off, this is really cool and easy to use software, great work!
The only issue I'm having is that I've assigned two viewport sizes in the backstop.js file but the tests undertaken by backstop only test both of the view sizes for one my test functions. The rest of the tests after the first one just look at the first viewport size in the array.
I call "await backstop(assert)" 4 times, but only once in each test function in the test file.
What am I doing wrong?
The sanitised output from the html_report config.js is that I have 5 tests (instead of the expected 8):
Backstop.js file with the two viewports defined: