Hi I am having some trouble getting a basic protractor test to work.
My setup:
You can define the desired screen resolution through your protractor configuration file (e.g. protractor.conf.js
or config.js
) for consistent test behavior.
exports.config = {
specs: [
// ...
],
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--window-size=1600,900',
'--headless'
]
}
}
// ...
}
window-size
argument will launch Chrome with a 1600 by 900 window.headless
will launch headless Chrome, allowing you to have your tests run with the specified window size (1600 by 900) even if your screen resolution is lower than that.You may want to have two configurations, one for developers (without headless mode) who always have a high resolution screen and one for build servers (headless mode) where screen resolution is sometimes a mystery and could be lower than what your application / test is designed for. Protractor configuration file are javascript and can be extended to avoid code duplication.