-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Custom Command is not a function #25348
Comments
@yurakhomitsky thanks for the example project. I see in your Cypress configuration that you have e2e: {
baseUrl: 'http://localhost:4200',
supportFile: false
} Setting this option to If you remove |
I'm going to route this to the tools team to see if we should remove |
I don't have "supportFile: false" in my e2e but still my custom commands are not working. |
Hi @Amit-P , sorry you're having trouble. This issue has been closed for some time. If you're experiencing an issue that you believe is a Cypress bug I would recommend you open a new issue and provide all the requested information including a reproducible example (ideally a Since this sort of issue is usually a configuration or setup issue (rather than a bug in Cypress) you may want to reach out on Discord for help. |
having supportFile correctly set, custom commands don't work in 12.17.4 anymore. |
@vecernik please open a new issue with a reproducible example and the Cypress team will be happy to investigate. |
@vecernik dang! Same here. Did you fix it? |
@yuritoledo Only downgrading back to 12.17.3 helped to get custom commands working. |
The solution is described here: #27641 |
"sideEffects": [ "libs/shared/src/e2e/*.ts" ] |
Workaround above works in my case I had "sideEffects" set to |
Current behavior
I was following along with the installation instructions from cypress/schematic for "ng new" project
Then I decided to add a custom command however cypress throws the error: "cy.login is not a function"
To add a custom command I wrote the following code in the
commands.ts
fileCypress.Commands.add("login", () => { cy.log('login...') })
Added it to the namespace
declare namespace Cypress { interface Chainable<Subject = any> { login(): any; } }
Uncommented this line
import './commands';
in thee2e.ts
fileUsed
cy.login()
in thespec.cy.ts
fileDesired behavior
Cypress should not throw the error "cy.login is not a function"
Test code to reproduce
https://github.com/yurakhomitsky/cypress-angular-schematic-issue
Cypress Version
12.2.0
Node version
16.15.0
Operating System
macOS 13.0.1
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: