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

Crash on empty document #4177

Closed
bahmutov opened this issue May 10, 2019 · 2 comments

Comments

2 participants
@bahmutov
Copy link
Collaborator

commented May 10, 2019

Cypress v3.2.0

test

it.only('works', () => {
  expect(1).to.equal(1)
  const doc = cy.state('document')
  doc.write('')
})

Hover over the assertion and see a crash in the console

Screen Shot 2019-05-10 at 11 43 06 AM

The code not being defensive enough because contents.find('html')[0] is undefined in this example

https://github.com/cypress-io/cypress/blob/develop/packages/runner/src/iframe/aut-iframe.js#L57

var htmlAttrs = _lodash.default.transform(contents.find('html')[0].attributes, function (memo, attr) {
        if (attr.specified) {
          memo[attr.name] = attr.value;
        }
      }, {});
@cypress-bot

This comment has been minimized.

Copy link

commented May 22, 2019

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

@cypress-bot

This comment has been minimized.

Copy link

commented May 23, 2019

Released in 3.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.