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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Grafana:建立系統全知視角的捷徑
blueswen
0
330
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
230
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
AI時代の認知負荷との向き合い方
optfit
0
160
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.9k
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
280
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
190
Fragmented Architectures
denyspoltorak
0
150
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
A better future with KSS
kneath
240
18k
Abbi's Birthday
coloredviolet
1
4.7k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
200
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
710
YesSQL, Process and Tooling at Scale
rocio
174
15k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
エンジニアに許された特別な時間の終わり
watany
106
230k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Exploring anti-patterns in Rails
aemeredith
2
250
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
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