1

If we have E2E test cases written for an Angular2+ application using protactor, if we migrate the Angular2+ application to React, how difficult it will be to migrate those E2E test cases to work against the React application (after migration)?

  • If you've used sensible (i.e. not Angular-specific) selectors, it should just be a case of pointing Protractor at the new app and disabling its Angular synchronisation: browser.waitForAngularEnabled(false). Have you tried anything? What happened? – jonrsharpe Jul 15 at 6:28
  • Got it, I am trying to find if it is feasible to migrate those test cases, if anybody has any such experience. – Kiran Jul 15 at 6:49
0

If your tests were written correctly - then you'll have to replace your infrastructure layer with another module that would support React. You can estimate that task depending on the size and complexity of your existing module.

By "correctly" I mean the architectural separation between test definition layer and test adaptation/infrastructure (Protractor) layer.

Another point that you need to consider - is rewriting the angular specific locators (finding elements by ng-something), to more generic, that would suit the React UI as well.

In other words, as long as your test code/page objects do not contain plain calls to Protractor, and you are accessing it via your custom wrapper - you would only have to replace the content of the wrapper, without affecting the client code.

| improve this answer | |
  • Thank you for your reply, will you be able to elaborate a little on your last para? – Kiran Jul 15 at 7:20
  • 1
    Protractor can drive any website, you wouldn't necessarily need to swap it out entirely to test a React site. – jonrsharpe Jul 15 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.