Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test configuration object ignored for viewportHeight and viewportWidth #7631

Closed
maximilianschmid opened this issue Jun 9, 2020 · 3 comments · Fixed by #8006
Closed

Test configuration object ignored for viewportHeight and viewportWidth #7631

maximilianschmid opened this issue Jun 9, 2020 · 3 comments · Fixed by #8006
Assignees
Labels
type: bug v4.8.0 🐛 Issue present since 4.8.0

Comments

@maximilianschmid
Copy link

maximilianschmid commented Jun 9, 2020

Current behavior:

Testrunner browser window does not respect viewportWidth and viewportHeight configuration passed in via a configuration object to the test or suite function as the second argument.

Your test checks if config object get's the value, which it does.
4cfcae2#diff-8a1bc60bd20378ff06f1cd550ab21defR59

But the testrunner browser window does not get resized.

Screenshot 2020-06-09 at 09 37 24 (2)

Desired behavior:

Testrunner browser window should respect viewportWidth and viewportHeight passed in via a configuration object to the test or suite function as the second argument.

Test code to reproduce

describe('demo.planfred.com …', {
  viewportHeight: 800,
  viewportWidth: 400,
  baseUrl: 'https://demo.planfred.com/'
}, () => {
  it('test', () => {
    cy
      .visit('https://demo.planfred.com/')
  })
})

Versions

4.8.0

Should work in 4.8.0 according to feature issue #7167

@jennifer-shehane
Copy link
Member

Yes, I can confirm setting viewportHeight and viewportWidth is not actually changing the viewport size of the suite/test that it's passed to in 4.8.0.

The original PR is only checking that the Cypress.config().viewportHeight, etc values are correct, but there have been other instances where this value can be correct and actually have no effect on the behavior of the test.

The baseUrl is taking effect and working in the example below however.

describe('test', {
  viewportHeight: 200,
  viewportWidth: 400,
  baseUrl: 'https://example.cypress.io'
}, () => {
  it('test', () => {
    cy.visit('/').then(() => {
      expect(Cypress.config().viewportHeight).eq(200) // passes
      expect(Cypress.config().viewportWidth).eq(400)  // passes
    })
  })
})

Screen Shot 2020-06-09 at 2 32 35 PM copy

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Jun 9, 2020
@jennifer-shehane jennifer-shehane added v4.8.0 🐛 Issue present since 4.8.0 type: bug labels Jun 9, 2020
@jennifer-shehane jennifer-shehane changed the title Test configuration object ignored Test configuration object ignored for viewportHeight and viewportWidth Jul 16, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Jul 16, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 17, 2020

The code for this is done in cypress-io/cypress#8006, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jul 17, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 21, 2020

Released in 4.11.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.11.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jul 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug v4.8.0 🐛 Issue present since 4.8.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants