-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
New nx workspace doesn't support custom cypress commands #1609
Comments
I had this issue, too, after upgrading to nx 8.
And it works for me. |
I think it might be more of a documentation issue or just user error. Something broke with our typings.d.ts for custom commands during the migration, but moving the typings inside commands.ts eventually worked. Seems like Cypress custom commands and TypeScript don't play super well together at the moment. Feel free to close to reduce noise @FrozenPandaz! |
@FrozenPandaz after adding custom commands, for instance : |
@FrozenPandaz @bcabanes any update on this? |
I was going to open a related issue to this so I add my information in here. There should be a support file for custom commands typing or documentation in how to do it yourself. If you open
Something silly, but just to get the point. You get an expected Some pages recommends you to create a
and perhaps wire it with a EDIT: Following the official cypress recommendation: https://docs.cypress.io/guides/tooling/typescript-support.html#Transpiling-TypeScript-test-files VScode starts recognizing the command, the fact that it has parameters but when running the tests, it fails saying the method doesn't exist (but if you leave out the param, running the tests will fail saying that there was a parameter expected but got 0). So not even using the |
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
@FrozenPandaz @vsavkin I created a PR adding the capability and default examples. |
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
Not a big fan of that solution tho. I would love to have a separate d.ts file. To keep things simple, but I guess that would work as well. |
As @juristr mentions in another place, He found a solution: If inside
VScode will say, hey, there is a new command, I won't give you a red wiggle anymore when you use it. Now, running So you need to do two extra steps for a command. Create the type and import the file with the type where you use it. In a good world you only need to do the former and even better if it is in its own |
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
I am facing the same issue, I have manually entered my support file path which is like this My folder structure contains .d.ts files for interfaces and .ts files for custom commands Can some help me with this issue, I am actually stuck over here. |
Hi @prudhvidandamudi |
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
Hi @bcabanes |
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to nrwl#1609
This update the Cypress schematic to handle by default the `supportFile` option in `cypress.json` with an example for _custom commands_. Related to #1609
@FrozenPandaz can you please release this fix? |
With @nrwl/[email protected] the problem continuied to exist for me. Error Message
Solution
export {}
declare global {
namespace Cypress {
interface Chainable<Subject> {
login(email: string, password: string): void;
matchImageSnapshot(): Chainable<Subject>;
matchImageSnapshot(name: string): Chainable<Subject>;
matchImageSnapshot(options: any): Chainable<Subject>;
matchImageSnapshot(name: string, options: any): Chainable<Subject>;
}
}
} Version Info
|
I have this same issue. Is there a solution? only difference in my case is - I moved my entire test folder outside apps/. If i reference the cypress.json under apps in workspace.json the tests work fine, but if i reference client specific cypress.json in the standalone folder like below then my test fails after 4 min saying cannot fetch the supportFile. The same test work fine in watch mode. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Please make sure you have read the submission guidelines before posting an issue
Expected Behavior
Adding a custom Cypress command with the generated schematics should not cause an error when the tests run.
Current Behavior
The custom commands aren't registered to due
supportFile: false
in the cypress.json file.Failure Information (for bugs)
Adding the minimal steps to reproduce here:
ca136/cypress-nx-commands@d999139
Context
Please provide any relevant information about your setup:
Used nx 8.2.0
A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
see github repo above
Failure Logs
Either:
Or:
Other
Any other relevant information that will help us help you.
The text was updated successfully, but these errors were encountered: