bahmutov / cypress-if

Easy conditional if-else logic for your Cypress tests when there is no other way
https://cypress.tips/courses/cypress-plugins
96 stars 12 forks source link

Cannot use the plugin with Cypress 12.20 #61

Closed oussbenma closed 1 year ago

oussbenma commented 1 year ago

When trying to use the plugin, I get the following error:

_> "CypressError

The following error originated from your test code, not from Cypress.

Cannot overwite the get query. Queries cannot be overwritten.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.Learn more node_modules/cypress-if/src/index.js:224:1 222 | }) 223 |

224 | Cypress.Commands.overwrite('get', function (get, selector, options) { | ^ 225 | // can we see the next command already? 226 | const cmd = cy.state('current') 227 | debug(cmd)"_

Steps to reproduce:

1- Add this package as a dev dependency npm i -D cypress-if 2- Include this package in your spec or support file import 'cypress-if'

My Cypress and Node Version:

Cypress package version: 12.2.0 Cypress binary version: 12.2.0 Electron version: 21.0.0 Bundled Node version: 16.16.0

oussbenma commented 1 year ago

Duplicate: https://github.com/bahmutov/cypress-if/issues/58