Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Example test not compatible with Cypress 12 #14

Closed
MikeMcC399 opened this issue Feb 7, 2023 · 4 comments
Closed

Example test not compatible with Cypress 12 #14

MikeMcC399 opened this issue Feb 7, 2023 · 4 comments

Comments

@MikeMcC399
Copy link

Problem description

After upgrading to Cypress 12.5.1 out of 28 tests in total, 20 pass and 8 fail.

  TodoMVC
    √ adds 2 todos (596ms)
    No Todos
      √ should hide #main and #footer (67ms)
    New Todo
      √ should allow me to add todo items (742ms)
      √ adds items (714ms)
      √ should clear text input field when an item is added (433ms)
      √ should append new items to the bottom of the list (989ms)
      √ should show #main and #footer when items added (376ms)
    Mark all as completed
      √ should allow me to mark all items as completed (1042ms)
      √ should allow me to clear the complete state of all items (1133ms)
      √ complete all checkbox should update state when items are completed / cleared (1208ms)
    Item
      1) should allow me to mark items as complete
      2) should allow me to un-mark items as complete
      √ should allow me to edit an item (1479ms)
    Editing
      √ should hide other controls when editing (1074ms)
      √ should save edits on blur (1406ms)
      √ should trim entered text (1555ms)
      √ should remove the item if an empty text string was entered (1175ms)
      √ should cancel edits on escape (1224ms)
    Counter
      √ should display the current number of todo items (582ms)
    Clear completed button
      √ should display the correct text (1041ms)
      3) should remove completed items when clicked
      √ should be hidden when there are no items that are completed (1122ms)
    Persistence
      4) should persist its data
    Routing
      5) should allow me to display active items
      6) should respect the back button
      7) should allow me to display completed items
      8) should allow me to display all items
      √ should highlight the currently applied filter (1518ms)

(Using Cypress 11.2.0 the tests report 28 pass and 0 fail.)

Steps to reproduce

Edit package.json and change
"cypress": "^7.0.0" to
"cypress": "^12.0.0"

Execute

yarn install
npm run build
npm start

In a separate terminal window execute

npx cypress open

Take defaults for migration to Cypress 12.
Select E2E Testing
Select Electron
Start E2E Testing in Electron
Select app.spec.js to run
Note test run results 20 pass, 8 fail.

Repeat the above using "cypress": "^11.0.0" instead and note that all 28 tests pass.

Expectation

It should be possible to use the test in the latest current major version of Cypress 12.x.

@MikeMcC399
Copy link
Author

MikeMcC399 commented Feb 7, 2023

image

from isolated test for troubleshooting:

  context.only('Item', function () {
    // New commands used here:
    // - cy.clear    https://on.cypress.io/api/clear

    it.only('should allow me to mark items as complete', function () {
      // we are aliasing the return value of
      // our custom command 'createTodo'
      //
      // the return value is the <li> in the <ul.todos-list>
      cy.createTodo(TODO_ITEM_ONE).as('firstTodo')
      cy.createTodo(TODO_ITEM_TWO).as('secondTodo')

      cy.get('@firstTodo')
      .find('.toggle')
      .check()

      cy.get('@firstTodo').should('have.class', 'completed')

      cy.get('@secondTodo').should('not.have.class', 'completed')
      cy.get('@secondTodo')
      .find('.toggle')
      .check()

      cy.get('@firstTodo').should('have.class', 'completed')
      cy.get('@secondTodo').should('have.class', 'completed')
    })

The above works without problems on Cypress 11 and fails to work on Cypress 12.

@MikeMcC399
Copy link
Author

The Cypress 12.0 Migration Guide includes a section Behavior Changes in Alias Resolution which says:

"Cypress always re-queries aliases when they are referenced. This can result in certain tests that used to pass could start to fail."

This may be the reason for the failure.

@MikeMcC399
Copy link
Author

According to information from @nagash77 the repository

has been replaced by

@MikeMcC399 MikeMcC399 closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2023
@MikeMcC399
Copy link
Author

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

No branches or pull requests

1 participant