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

Fix issue where command is never fully ended and following assertions are displayed incorrectly #7734

Merged
merged 4 commits into from
Jun 17, 2020

Conversation

panzarino
Copy link
Contributor

@panzarino panzarino commented Jun 17, 2020

User facing changelog

Fixes an issue where an assertion log would be displayed as a child while really a parent if no commands were issued in the beforeEach loop.

Additional details

Fixes an internal issue where commands would not be properly closed after executing.

How has the user experience changed?

Notice green dash to the left of "assert"

Before:

84856479-d06fd780-b034-11ea-8dd3-6e9b98ea7eb8

After:

Screen Shot 2020-06-17 at 1 00 29 AM

PR Tasks

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?

… a command and the previous command in a hook was a cy.then
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 17, 2020

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jun 17, 2020



Test summary

7644 0 119 0


Run details

Project cypress
Status Passed
Commit f6e8e1c
Started Jun 17, 2020 3:00 PM
Ended Jun 17, 2020 3:09 PM
Duration 08:58 💡
OS Linux Debian - 10.1
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@panzarino panzarino marked this pull request as ready for review June 17, 2020 04:58
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't recreate this issue in 4.8.0 or the develop branch. Are you sure this wasn't introduced in #7356 itself? Can you provide the repro example for the original issue?

I tried using before hooks, tried moving the before hook around the suites...

Below is what I'm seeing in develop branch.

context('closing commands', () => {
  beforeEach(function () {
  })

  it('properly closes commands', () => {
    expect(true).to.be.true
  })
})

Screen Shot 2020-06-17 at 1 55 10 PM

context('closing commands', () => {
  beforeEach(function () {
    cy.visit('index.html')
  })

  it('properly closes commands', () => {
    expect(true).to.be.true
  })
})

Screen Shot 2020-06-17 at 1 52 52 PM

@panzarino
Copy link
Contributor Author

panzarino commented Jun 17, 2020

@jennifer-shehane I may have described the actual cause of the issue incorrectly. I've since updated the original issue with what I believe to be the actual cause of the bug.

I also realized that this issue was only occuring when I put an .only on the test (due to other commands executing in between, making .then not the last command run). I've moved it to be the first test in cy_spec.js which seemed to accurately test for the error, and now if run without the changes, the test should fail.

Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Saibamen
Copy link
Contributor

What this green dash means?

@jennifer-shehane
Copy link
Member

@Saibamen It is used to indicate that the command is a 'child' command, that there is a parent above it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An assertion log will be inserted as a child when outside of a parent command
4 participants