The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

khtan (68) [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 (53) [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 (68) [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 (53) [Avatar] Offline
{add,clear,remove}MockModule are for AngularJS, not for Angular 2 or above.