-
Notifications
You must be signed in to change notification settings - Fork 153
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
Cypress commands don't work inside an origin block #221
Comments
Indeed. |
I have the same problem with cypress-testing-library and real-events |
HI, same issue here with cypress 10.4 Without this fix, the cy.origin() feature is totally unusable for my project... |
Hit the same issue on my first time out with |
This is a known limitation with cy.origin (that custom commands don't work). There is a workaround I was pointed to by Gleb which is to make another cy.origin block in the beforeEach block. This origin block would be pointed to the same origin that you are trying to use in your main test. You would setup your custom command in this first origin block and you will be able to use it within the origin block in your test. https://docs.cypress.io/api/commands/origin#Callback-restrictions |
Cypress 10.9 with Cypress.require('../support/myCustomCommands') does solve this issue for me |
Got the same issue using custom command in cy.origin() block. @luke-sensei solution helped. Note you should insert Cypress.require('../support/myCustomCommands') directly in cy.origin() block. |
Just an additional info:
|
Still an issue with Cypress 10.11 😢 |
When I use:
I see:
When I use:
I see:
I'm using Cypress 9.7.0. |
Upgrade Cypress to 10.9.0 and @cypress/webpack-preprocessor to 5.15.0. It worked for me. Thanks @luke-sensei :) |
I'm using 10.10 and it waits for the new page to load, but neither the
|
Same problem on |
Adding |
Cypress origin and custom commands doesn't work with TypeScript ? cy.origin(
Cypress.env('BASE_URL_SHOP'), () => {
Cypress.require('../support/commands')
cy.checkIfLinksAreDeadOnPage('/')
}
)
Note: I'm using Lerna with PNPM for a monorepository architecture. Could this be a problem? {
"name": "@my/e2e",
"description": "E2E tests",
"version": "0.0.0",
"private": true,
"sideEffects": false,
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run"
},
"dependencies": {
"cypress": "^12.7.0"
},
"devDependencies": {
"start-server-and-test": "^1.15.2",
"typescript": "^4.9.4"
}
} |
@XavierChevalier see cypress-io/cypress#25885 should be fixed with next cypress release (in 4 days) |
Still an issue for me ERROR Variables must either be defined within the cy.origin() command or passed in using the args option. |
I am also getting process is not defined error.. I have experimentalOriginDependencies set to true in cypress config file. ERROR Variables must either be defined within the cy.origin() command or passed in using the args option. Using require() or import() within the cy.origin() callback is not supported. Use Cypress.require() to include dependencies instead, but note that it currently requires enabling the experimentalOriginDependencies flag. |
Hi, I'm experiencing the same issue with "cypress": "^13.6.1". The commands .type('') and .click() are yelling the same error for me when they are situated inside of the cy.origin() block. experimentalOriginDependencies is set to true. |
cypress-testing-library
version: 7.0.6node
version: 14.17.5npm
(oryarn
) version: 6.14.15Relevant code or config
What you did:
cy.findByText
within acy.origin
callbackWhat happened:
The text was updated successfully, but these errors were encountered: