CypressError: cy.mount()
#24400
-
I get CypressError: I have implemented a mount in component.ts in the support folder for the tests, pretty much copied from the Cypress documents for implementing component testing on angular. This is on an Nx v15 repo with Cypress 10.10 can anyone help? I'm not getting any hints from google searches. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 21 replies
-
Well, what does ur |
Beta Was this translation helpful? Give feedback.
-
import { Type } from '@angular/core' declare global { Cypress.Commands.add('mount', (component : string | Type, config) => { |
Beta Was this translation helpful? Give feedback.
-
Thanks, it looks like we're using Angular 14.2.1 |
Beta Was this translation helpful? Give feedback.
-
@lmiller Have you got any thoughts? We're at a point where we can move away from Storybook and use Cypress component tests for our project but that opportunity will close if much more time is invested in testing in Storybok. I'm really keen to do this as there are advantages to moving away from a reliance on Storybook, so I'd really like to work out what's going wrong here. |
Beta Was this translation helpful? Give feedback.
-
@lmiller1990 Thanks very much for your detailed response/investigation! I'm going to try out your suggestions today/tomorrow. Do you know when Cypress 11 is due out? |
Beta Was this translation helpful? Give feedback.
-
@lmiller1990 Thanks, will definitely keep an eye on that. |
Beta Was this translation helpful? Give feedback.
-
@lmiller1990 Was just looking and a new version of Nx has shipped : 15.2.3 I've created a new Nx angular project using latest and Cypress 11.2 is installed with it, but still get an error when I configure component testing. |
Beta Was this translation helpful? Give feedback.
-
@lmiller1990 I got it working. Thanks for your assistance. |
Beta Was this translation helpful? Give feedback.
@lmiller1990 I got it working. Thanks for your assistance.
If you don't mind, one more question. I've got simple angular components working but our components that use the bsdatepicker and bsdaterangepicker are failing to compile with an angular NG0301 error, they work fine on storybook but when I try and mount them on cypress I get that angular error. I've tried adding them as imports in the beforeEach section of the component test but I still get the same error. Do you know if there are problems with some imports?