DEV Community

Discussion on: Accessing angular components methods from within Cypress

Collapse
 
brunoelo profile image
Emeka Elo-Chukwuma

I'm getting the error angular.getComponent is not a function

Collapse
 
ezeqduarte profile image
Ezequiel Duarte

I had the same issue, and I solved it as follows:

cy.window()
cy.wait(500)
cy.window().then((win) => {
angular = (win as any).ng;
})

Collapse
 
julianobrasil profile image
Juliano

Hummmm... Which angular version are you using? If you compile to production, angular object is not there. I wonder if ivy's compilation, being default to production, is the culprit.