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

cy.end() test from earlier versions fails against example.cypress.io/commands/misc #819

Closed
MikeMcC399 opened this issue Apr 2, 2024 · 2 comments · Fixed by #820
Closed
Labels

Comments

@MikeMcC399
Copy link
Collaborator

Issue

[email protected] causes scaffolded examples from [email protected] to fail the cy.end() test. This test was removed from this repo, however earlier versions of Cypress still use this test.

[email protected] which is published to https://example.cypress.io/ causes scaffolded tests set up from [email protected] through to [email protected] to fail in the spec cypress/e2e/2-advanced-examples/misc.cy.js.

The scaffolded test for .end() fails since .misc-table is no longer available on https://example.cypress.io/commands/misc

This is the failing test:

context('Misc', () => {
  beforeEach(() => {
    cy.visit('https://example.cypress.io/commands/misc')
  })
  it('.end() - end the command chain', () => {
    // https://on.cypress.io/end

    // cy.end is useful when you want to end a chain of commands
    // and force Cypress to re-query from the root element
    cy.get('.misc-table').within(() => {
      // ends the current chain and yields null
      cy.contains('Cheryl').click()
      //.end()

      // queries the entire table again
      cy.contains('Charles').click()
    })
  })
...

Steps to reproduce

Using cypress-example-kitchensink

On Ubuntu 22.04.4 LTS with Node.js 20.12.0 LTS

git clone --branch v2.0.5 https://github.com/cypress-io/cypress-example-kitchensink --depth 1 -- cy-example-2-0-5
cd cy-example-2-0-5
npm install
npm start

In a separate terminal window run Cypress tests with the earlier version 2.0.3:

git clone --branch v2.0.3 https://github.com/cypress-io/cypress-example-kitchensink --depth 1 -- cy-example-2-0-3
cd cy-example-2-0-3
npm install
npx cypress run --spec cypress/e2e/2-advanced-examples/misc.cy.js

Note failure

.end() - end the command chain

Using [email protected]

On Ubuntu 22.04.4 LTS with Node.js 20.12.0 LTS

mkdir cy-e2e-13-7-1
cd cy-e2e-13-7-1
git init
npm init -y
npm install [email protected] -D -E
npx cypress open --e2e --browser electron

Select "Continue"
Select "Scaffold example specs"
Select "Okay, I got it!"
Close Cypress Runner and Cypress Launchpad

npx cypress run --spec cypress/e2e/2-advanced-examples/misc.cy.js

Note failure

.end() - end the command chain

Log

  Misc
    1) .end() - end the command chain
    ✓ cy.exec() - execute a system command (314ms)
    ✓ cy.focused() - get the DOM element that has focus (361ms)
    ✓ cy.wrap() - wrap an object (125ms)
    Cypress.Screenshot
      ✓ cy.screenshot() - take a screenshot (861ms)
      ✓ Cypress.Screenshot.defaults() - change default config of screenshots (130ms)


  5 passing (8s)
  1 failing

  1) Misc
       .end() - end the command chain:
     AssertionError: Timed out retrying after 4000ms: Expected to find element: `.misc-table`, but never found it.
      at Context.eval (webpack://cypress-example-kitchensink/./cypress/e2e/2-advanced-examples/misc.cy.js:13:7)

Suggestion

Revert changes to

from PR #807 for backwards compatibility to scaffolded example specs which have been set up using Cypress 13.7.1 and earlier.

@jennifer-shehane
Copy link
Member

Yah I think we should just add the misc-table back so that people's older scaffolded tests won't fail: https://github.com/cypress-io/cypress-example-kitchensink/pull/807/files#diff-dd7cc5e700fcd9390c4cfe9035e9eea6f5608c8b0d4be38820d4217a2b14e9bcL87

@cypress-app-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 2.0.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants