I have an Angular application. In Angular unit tests (karma / jasmine) I can access component instances and directives via ComponentFixture / DebugElement.
Is that somehow also possible when running an e2e test via Protractor?
getDebugNode(domElement) can be used to get debug element inside the application, because it should be imported from @angular/core.
ng.probe(domElement) is global and can be used to get debug element outside the application.
Component instance is available on debug element as debugElement.componentInstance. As for directive instances and other providers, debugElement.injector(SomeClass) can be used to access them, as explained in this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With