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

After all hook is masking syntax errors #5681

Open
Machiaweliczny opened this issue Nov 13, 2019 · 1 comment
Open

After all hook is masking syntax errors #5681

Machiaweliczny opened this issue Nov 13, 2019 · 1 comment

Comments

@Machiaweliczny
Copy link

@Machiaweliczny Machiaweliczny commented Nov 13, 2019

Current behavior:

With code like this:

  before(() => {
     notExistingFunction() // syntax error
   })
  after(() => {
    cy.get('foo').type('bar');
  })

Cypress reports:

CypressError: cy.type() failed because it requires a DOM element.

The subject received was:

  > undefined

The previous command that ran was:

  > cy.get()

Because this error occurred during a 'after all' hook we are skipping the remaining tests in the current suite

Desired behavior:

The one that is happening when you remove after hook, so:

ReferenceError: notExistingFunction is not defined

Because this error occurred during a 'before all' hook we are skipping the remaining tests in the current suite: 

Steps to reproduce: (app code and test code)

Above - it think it also mask errors in tests as well (it)

Versions

Cypress 3.6.1 (bug is at least since 3.4)
MacOS Mojave
Chrome Version 78.0.3904.87 (Official Build) (64-bit)

@jennifer-shehane

This comment has been minimized.

Copy link
Member

@jennifer-shehane jennifer-shehane commented Jan 3, 2020

This is similar if not the same as this issue #4062

I can reproduce this in 3.8.1 of Cypress

before(() => {
  notExistingFunction() // syntax error
})

after(() => {
  cy.get('.action-email').type('fake@email.com')
})

it('.find after .wrap', () => {
  cy.visit('https://example.cypress.io/commands/actions')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.