7

We have extensive Python-based application, with many E2e tests (and of course unit tests), all in Python).

We started e2e test in FitNesse (Selenium1, with Python fixtures) many years ago. Recently we developed internal webdriver (Selenium2) based tests framework, with pageobjects and other best practices (with Jenkins as runner), using Python as main language for e2e test (as is for core application). Test flakiness decreased, writing test is more flexible, we like webdriver based e2e tests a lot, happy campers.

Developers are adding Angular layer on top (with backend still in Python) on some pages (most pages are in Jinja). Angular pages will use Karma/jasmine for unit tests (written in JavaScript). So far so good, following best practices as practical.

Developers suggest very strongly that we (QA) should write e2e tests in Protractor/Jasmine/JavaScript. We are a bit reluctant, because we invested lots of effort to FitNesse and webdriver tests (hundreds of running tests) and would prefer Python over JavaScript. Python is, and will remain, our main development language, and we want to avoid duplication existing Python/pageobject framework in JavaScript/Jasmine.

We:

  • would like keep FitNesse for a while (too many tests, will take long time to reimplement them all, and will esier to move Fitnesse tests to webdriver then to jasnime),
  • like Python/Webdriver a lot (very productive environment, easy to develop web page automation tasks for production needs way beyond e2e testing),
  • would like to avoid adding third incompatible language (jasmine/javascript) for e2e testing.

I understand that protractor may know more about Angular properties of the page elements, but is the pain of switching Python->Javascript worth it?

My questions (all related, same question from different POVs):

  • Is Protractor so much more superior to plain Webdriver (even if Protractor is layer on top of Webdriver), that it is worth to switch to e2e tests in Protractor, abandoning our python pageobject code?
  • Does Protractor have some superior abilities for Angular e2e testing which are not easy to reimplement by adding good locators alongside those generated by Angular?
  • Or does it make sense to have two parallel e2e testing frameworks, Protractor/JavaScript for Angular-based pages, and Webdriver/Python for 80% of the pages which are non-Angular?
  • Or Webdriver is just fine (after adding some locators) so we will not miss much, and will be happy in plain webdriver in Python?
  • Is there some open-source project which simulates Protractor capabilities, but uses (mostly) Python? Is it even possible?

I found Can angularjs apps automated with selenium? if yes, why should we use protractor? on SE but we have strong preference for Python as main language (which Comment suggest might be OK, giving me hope).

I know that answer is always "it depends what you prefer", but would like to know what hidden obstacles and traps we might encounter on either path, from people who been there done that.

EDIT, much later: I learned that newer version on Angular (2+) abandoned the support for angular-specific locators (model/binding/scope) and support only standard locators (id/name/css class etc). With the only advantage of Protractor over Python/Webdriver gone, I see no reason to move to different (and inferior, IMHO) language and abandon all our investment in Python.

2

1 Answer 1

3

I am currently working on an angular app with python/selenium e2e tests. The main difference is that protractor offers not just selection logic (model, binding, etc.) but also implicitly waits for angular page load, url changes, model updates.

To make up for these missing pieces. We had to have a fair amount of explicit waits.

I have not used it personally, but it may be worth looking at pytractor, which is a python adaptation of protractor. It does not seem to be actively maintained at this point though.

2
  • I see, smarter waits. Makes sense. I wonder if this can be handled with cooperation from developers by enabling/disabling/hiding/unhiding some some page elements. Sep 2, 2015 at 14:46
  • see now there is pytractor and they are catching up and making new releases. I personlly would love to start contributing to pytractor for code development. Hey there is a new release recently. check out.
    – user16532
    Feb 5, 2016 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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