question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

browser with test GUI should save size

See original GitHub issue

Current behavior:

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
}

Desired behavior:

It should save the browser dimensions so it could use it to open the next time

How to reproduce:

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

Test code:

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);
    });
});

Additional Info (images, stack traces, etc)

  • Operating System: Windows 10 & Ubuntu 14.04
  • Cypress Version: 2.1.0 beta
  • Browser Version: Chrome 65

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
mattcarlottacommented, Apr 17, 2020

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;
    }
  });
};
4reactions
mtc3bmtc3bcommented, Dec 23, 2019

As a workaround, you can send a window size to Chrome via plugins/index.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;
        }
    });
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium running tests in Chrome with larger default UI size
When I open a browser manually the the text/image sizes are all normal. If I kill the test and then check the "text...
Read more >
GUI and Headless Browser Testing - Travis CI Docs
This guide covers headless GUI & browser testing using tools provided by the ... If you need to set the screen size and...
Read more >
Responsive Design Mode - Firefox Source Docs - Mozilla
Responsive Design Mode gives you a simple way to simulate these factors, to test how your website will look and behave on different...
Read more >
GUI Testing – UI Test Cases (Examples) - Guru99
Check all the GUI elements for size, position, width, length, and acceptance of characters or numbers. For instance, you must be able to...
Read more >
Image Comparison (Visual Regression Testing) Service
This module is there to compare visuals of what you're user would see. A resized Chrome or Safari is not equal to what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found