Open warpdesign opened 2 years ago
Indeed.
Same problem here with cv.findByRole()
etc
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 cy.origin
. I wonder if the same problem exists in cy.session
.
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.
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:
I just read in the release notes for @cypress/webpack-preprocessor@5.15.0
that you can directly use import()
/require()
without Cypress.require()
Features Enable requiring cy.origin dependencies with require() and import() (https://github.com/cypress-io/cypress/issues/24294) (1b29ce7)
Still an issue with Cypress 10.11 :cry:
When I use:
Cypress.require("../../support/myCustomCommands")
I see:
Cypress.require is not a function
When I use:
require("../../support/myCustomCommands")
I see:
webpack_require is not defined
I'm using Cypress 9.7.0. What am I missing?
When I use:
Cypress.require("../../support/myCustomCommands")
I see:
Cypress.require is not a function
When I use:
require("../../support/myCustomCommands")
I see:
webpack_require is not defined
I'm using Cypress 9.7.0. What am I missing?
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 cy.url
command or cy.log
appear to do anything. I purposefully spelled google wrong in the validation, but the test passes, and the cy.log results don't show up anywhere that I can find.
cy.origin('https://www.google.com', () => { cy.url({ timeout: 60000 }).should('contain', 'gogle.com') cy.log('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%') })
When I use:
Cypress.require("../../support/myCustomCommands")
I see:
Cypress.require is not a function
When I use:
require("../../support/myCustomCommands")
I see:
webpack_require is not defined
I'm using Cypress 9.7.0. What am I missing?
Same problem on Cypress 12.1.0
and "@cypress/webpack-preprocessor": "^5.16.0"
When I use:
Cypress.require("../../support/myCustomCommands")
I see:
Cypress.require is not a function
When I use:
require("../../support/myCustomCommands")
I see:
webpack_require is not defined
I'm using Cypress 9.7.0. What am I missing?
Same problem on
Cypress 12.1.0
and"@cypress/webpack-preprocessor": "^5.16.0"
Adding experimentalOriginDependencies: true
to the e2e config in cypress.config.json
fixed this for me
(cypress: ^12.1.0
, @cypress/webpack-preprocessor: ^5.16.1
, webpack: ^5.75.0
)
Cypress origin and custom commands doesn't work with TypeScript ?
cy.origin(
Cypress.env('BASE_URL_SHOP'), () => {
Cypress.require('../support/commands')
cy.checkIfLinksAreDeadOnPage('/')
}
)
cy.origin() failed to run the callback function due to the following error:
Processing the origin callback errored:
Error: Cannot find module 'typescript'
Require stack:
- /Users/X/Library/Caches/Cypress/12.7.0/Cypress.app/Contents/Resources/app/packages/server/lib/cross-origin/process-callback.ts
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at n._resolveFilename (node:electron/js2c/browser_init:249:1105)
at PackherdModuleLoader._tryResolveFilename (evalmachine.<anonymous>:1:735006)
at PackherdModuleLoader._resolvePaths (evalmachine.<anonymous>:1:731827)
at PackherdModuleLoader.tryResolve (evalmachine.<anonymous>:1:727083)
at resolve (evalmachine.<anonymous>:1:741891)
at Function.resolve (evalmachine.<anonymous>:1:752340)
at customRequire.resolve (<embedded>:5233:1354109)
at _ (<embedded>:5174:22380)
at <embedded>:5213:67851
at a.handle_request (<embedded>:3012:1038)
at i (<embedded>:3027:1285)
at <embedded>:2627:2101
at n (<embedded>:2608:1794)
at p (<embedded>:2608:1813)
at IncomingMessage.f (<embedded>:2608:2273)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Note: I'm using Lerna with PNPM for a monorepository architecture. Could this be a problem?
This is the package.json
of the e2e tests package:
{
"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 https://github.com/cypress-io/cypress/issues/25885 should be fixed with next cypress release (in 4 days)
Still an issue for me
cy.origin("https://creditcube.qa.creditsense.ai/", () => { const _ = Cypress.require("../../support/commands"); cy.visit("/"); });
ERROR process is not defined
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. This error occurred while creating the session. Because the session setup failed, we failed the test.
I am also getting process is not defined error.. I have experimentalOriginDependencies set to true in cypress config file. Within origin I am using custom command for login(enter username, password, click login button).. Variables are passed in using the args option. Cypress version is 12.17.4 Is this issue going to be fixed soon or it is fixed in some version above the one I am using (haven't found anything related to the issue in change log)?
ERROR process is not defined
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: