using the tests GUI, every time I click Run All Tests button (or each file individually) the tests GUI window always open maximized.
my state.json on Windows (screen res: 3440x1440) is
{
"showedOnBoardingModal": true,
"appWidth": 800,
"appHeight": 545,
"appX": 2602,
"appY": 709
}
on Ubuntu is as
{
"showedOnBoardingModal": true,
"appWidth": 800,
"appHeight": 1113,
"appX": 565,
"appY": 54,
"reporterWidth": 259
}
It should save the browser dimensions so it could use it to open the next time
on Windows
I've simply added cypress to my project through npm and run it locally
npm i --save-dev cypress
./node_modules/.bin/cypress open
and then click "run all tests" button
const clientUrl = 'https://www.billigvvs.dk/';
describe('BilligVVS - Signup', () => {
beforeEach(() => {
cy.viewport('macbook-15');
cy.visit(`${clientUrl}#sc-test`);
});
it('campaign loads after 60sec', () => {
cy.getCookies();
cy.wait(20 * 1000);
cy.get('sign-up').should('have.value', 'abc'); // error-here
expect(true).to.equal(true);
});
});
On ubuntu my screen resolution is 1920x1200
Could you explain why this is an issue for you? I'd like to understand better what you're trying to accomplish.
The viewport of the application under test is configurable in the configuration. It will render at that size always if set in your cypress.json
@jennifer-shehane
the issue is that every time I run tests from the "test tree-file small window" the test just opens as maximized, and having a 34'' screen makes no sense to occupy the hole screen...
from Gitter, I've found out that the state.json were missing browserWidth and browserHeight so it opens the window with those restrictions.
this is nothing to do with the test viewport.
Yes, sorry I just saw the thread in gitter where @chrisbreiding was suspecting it may be a Windows issue: https://gitter.im/cypress-io/cypress?at=5ab5100635dd17022e9163ec
Still failing - Windows 10, Cypress 3.1.5
Is there any progress / quickfix for this issue? Having browser maximized on every test start messes with my others carefully positioned windows and I have to resize it every single time.
Any news on this? Drives me crazy on my wide screen monitor.
As a workaround, you can send a window size to Chrome via plugins/index.js:
```js
module.exports = on => {
on('before:browser:launch', (browser = {}, args) => {
if (browser.name === 'chrome' || browser.name === 'chromium' || browser.name === 'canary') {
args.push('--window-size=1000,1200');
return args;
}
});
};
````
Thank you so much for your workaround, @mtc3bmtc3b.
This was really driving me nuts... :)
The @mtc3bmtc3b solution works great, but unfortunately throws a deprecation warning because the API has changed. Here's an updated solution:
module.exports = on => {
on("before:browser:launch", (browser, launchOptions) => {
if (browser.name === 'chrome' || browser.name === 'chromium' || browser.name === 'canary') {
launchOptions.args.push("--window-size=1800,1100");
return launchOptions;
}
});
};
In my case I am trying to do screen recording (on an ultrawide) so I have all my windows just so and this definitely throws it all off (have to pause, resize, reposition). 馃憤
Is there any hope of progress on this? It really makes using Cypress a pain. (People who maximize their browsers are evil!) The workaround given isn't appropriate in a shared codebase where users have different size displays and might not want their Cypress window the same dimensions as mine.
Most helpful comment
The @mtc3bmtc3b solution works great, but unfortunately throws a deprecation warning because the API has changed. Here's an updated solution: