Background: My goal is to permutation all potential configurations of an Angular2 screen for a specified route and capture screenshots using Protractor from the following link: http://www.protractortest.org/#/debugging.
Problem: I am struggling to figure out how to access a directive (like ng-if, for example) during an end-to-end test.
- Is it feasible to reach the ng-if directive within an e2e test?
- If yes: Is there a method to alter the directive? By manipulation, I mean influencing the evaluation of the directive without altering the input that the directive relies on.
Potential solution approach: presented here is an instance of how I access the router in order to navigate to a specific route:
it('should get the router', () => {
browser.executeScript(() => {
const ng = window['ng'];
const root = document.getElementsByTagName('app-root')[0];
const router = ng.probe(root).injector.get(ng.coreTokens.Router);
const routes = router.config;
...
...
return [];
}).then(ret=> console.log(ret));
});
Considerations:
- Perhaps it might be possible to retrieve the ng-if directives somehow using ng.probe
I would appreciate any guidance or suggestions related to my query.