You can manage the resolution of your browser via cmd parameters. Since Chrome supports --window-size
parameter you can pass it to the .browsers method of your runner.
Please see the following example:
const createTestCafe = require('testcafe');
let testcafe = null;
createTestCafe('localhost', 1337, 1338)
.then(tc => {
testcafe = tc;
const runner = testcafe.createRunner();
return runner
.src('my-tests.js')
.browsers(['chrome --window-size=1000,500', 'chrome --window-size=500,200'])
.run();
})
.then(failedCount => {
console.log('Tests failed: ' + failedCount);
testcafe.close();
});
Here I run tests in two Chrome instances but with different window sizes
Please also refer to the following article https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#browsers to see different ways of using the .browsers
method