Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Insights on Protractor testing
Search
Deyan Totev
September 13, 2015
Programming
0
98
Insights on Protractor testing
Learn some basic recommendations about the e2e testing framework - Protractor
Deyan Totev
September 13, 2015
Tweet
Share
More Decks by Deyan Totev
See All by Deyan Totev
Welcome to NPM Search 2.0
peeping4dsun
0
55
Other Decks in Programming
See All in Programming
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
570
MUSUBIXとは
nahisaho
0
130
Patterns of Patterns
denyspoltorak
0
1.4k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
230
CSC307 Lecture 01
javiergs
PRO
0
690
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.3k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
AtCoder Conference 2025
shindannin
0
1.1k
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
Featured
See All Featured
Designing Experiences People Love
moore
144
24k
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
From π to Pie charts
rasagy
0
120
The Invisible Side of Design
smashingmag
302
51k
Paper Plane (Part 1)
katiecoart
PRO
0
4.2k
30 Presentation Tips
portentint
PRO
1
220
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Prompt Engineering for Job Search
mfonobong
0
160
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Transcript
by Dejan Toteff How to build faster e2e tests with
Protractor
• E2E testing framework • Developed by Google • Created
especially for Angular applications • Can be used with non Angular sites as well What is Protractor?
None
• Continuous integration • Integration tests • Test Driven Development
Why we need E2E tests?
• 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?
• Well-documented • Integrated with headless and regular browsers •
Easy to set up • Very powerful API What are the pros of Protractor?
• 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?
Time for some example code
• Make a habit to use element.all(by...). count() to be
sure that you create most suitable element selector. Protractor tips
• Expect false errors. To confirm an error, run the
tests under alternative OS Protractor tips
• Beware of the async nature of Protractor. • If
something doesn't work as expected go Protractor native, i.e. using .then() Protractor tips
• Don't abstract the code directly to the PageObject. Often
this abstraction lead to errors. Protractor tips
• Other possible issue is when the element is not
in the visible part of the browser’s screen. Protractor tips
• Avoid use of browser.sleep() right after browser.waitForAngular() Protractor tips
• 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
• Once you set the browser size, it persist in
your tests until the next browser. setSize() declaration Protractor tips
• Popups and animation can temporary disable Protractor. Protractor tips
• The behaviour of .then() method of Protractor’s .map(), .each(),
.filter() can be weird. Protractor tips
• One falsy selection can ruin all the tests. Protractor
is hard to debug mainly because in such occasions Protractor tips
• To make scroll down work, first you need to
focus the to the "window" by clicking on any element within the window. Protractor tips
• Make all your clicks statement either inside the tests,
or in the PageObject. Protractor tips
• https://github.com/lkrnac/primediser/tree/blog-2014-04-05- measuring-code-coverage-by-protractor • https://github.com/bennyhat/protractor-istanbul-plugin • http://lkrnac.net/blog/2014/04/measuring-code-coverage-by- protractor/ Walk the
extra mile
https://github. com/selfrefactor/Protractor-testing- patterns Shortlink: j.mp/endToEnd Most of slides of this
presentation are based on:
Thank you for your attention Protractor testing is actually easy