Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Insights on Protractor testing

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for Deyan Totev Deyan Totev
September 13, 2015

Insights on Protractor testing

Learn some basic recommendations about the e2e testing framework - Protractor

Avatar for Deyan Totev

Deyan Totev

September 13, 2015
Tweet

More Decks by Deyan Totev

Other Decks in Programming

Transcript

  1. • E2E testing framework • Developed by Google • Created

    especially for Angular applications • Can be used with non Angular sites as well What is Protractor?
  2. • They are slow to write • Debugging is not

    a straightforward process • Short life cycle without update What are the main issues with writing e2e tests?
  3. • Well-documented • Integrated with headless and regular browsers •

    Easy to set up • Very powerful API What are the pros of Protractor?
  4. • It is not build for complex user interactions •

    Works at its best only with Chrome • It doesn’t work well with nested promises What are the cons of Protractor?
  5. • Make a habit to use element.all(by...). count() to be

    sure that you create most suitable element selector. Protractor tips
  6. • Expect false errors. To confirm an error, run the

    tests under alternative OS Protractor tips
  7. • Beware of the async nature of Protractor. • If

    something doesn't work as expected go Protractor native, i.e. using .then() Protractor tips
  8. • Don't abstract the code directly to the PageObject. Often

    this abstraction lead to errors. Protractor tips
  9. • Other possible issue is when the element is not

    in the visible part of the browser’s screen. Protractor tips
  10. • If you stumble on an error, that the element

    you are clicking on is not attached to the document, that means that this is not a testable scenario Protractor tips
  11. • Once you set the browser size, it persist in

    your tests until the next browser. setSize() declaration Protractor tips
  12. • One falsy selection can ruin all the tests. Protractor

    is hard to debug mainly because in such occasions Protractor tips
  13. • To make scroll down work, first you need to

    focus the to the "window" by clicking on any element within the window. Protractor tips
  14. • Make all your clicks statement either inside the tests,

    or in the PageObject. Protractor tips