khtan (65) [Avatar] Offline

The book has 2 parts : 1) unit testing with Karma and Jasmine and 2) e2e testing with Protractor

Can e2e tests in Protractor make use of Angular's access to the components or is Protractor restricted
to the DOM tree and its elements?

The reason I asked is whether any unit tests and helper code written for unit testing can be leveraged
for e2e testing? Is this a matter of test design or are the Karma/Jasmine and Protractor using totally
different technologies and there is no commonality in code reuse. At first study, the answer is no, but
your explanation might be better than mine.

Jesse Palmer (45) [Avatar] Offline
As far as I know, the unit tests and end-to-end tests are completely separate. That isn't to say that there isn't a way to reuse code between the two, I just haven't seen it.
khtan (65) [Avatar] Offline
Thanks, I am inclined to agree with you.

However, I just found the functions {add,clear,remove}MockModule in the Protractor API docs ( that seems to suggest that mocking classes could be loaded into e2e tests by Protractor. Do you have ideas regarding their usage?
Jesse Palmer (45) [Avatar] Offline
{add,clear,remove}MockModule are for AngularJS, not for Angular 2 or above.