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
Browser Automated Tests
Search
derek-b
April 09, 2018
Programming
1
320
Browser Automated Tests
Combine Headless Chrome with Mocha, Chai and Node to automatically test your web pages.
derek-b
April 09, 2018
Tweet
Share
More Decks by derek-b
See All by derek-b
What Raising 3 Kids Taught Me About Working with Users
derekb
0
41
Pardon the disruption: a user-first approach to software design
derekb
0
68
Teaching Through Code Review
derekb
0
94
Add Location-Based Searching to Your Site with Elasticsearch
derekb
0
26
Add Location-based Searching to Your PHP App with Elasticsearch
derekb
1
300
Map, Filter, and Reduce in PHP
derekb
0
640
You Version Your Code, Why Not Your Database?
derekb
0
54
Taming Your Data with Elasticsearch - PHP Benelux
derekb
1
420
What Raising 3 Kids Taught Me About Working With Users
derekb
0
330
Other Decks in Programming
See All in Programming
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
230
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
CSC509 Lecture 12
javiergs
PRO
0
160
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
受け取る人から提供する人になるということ
little_rubyist
0
250
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Jakarta EE meets AI
ivargrimstad
0
600
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Optimising Largest Contentful Paint
csswizardry
33
2.9k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
RailsConf 2023
tenderlove
29
900
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Gamification - CAS2011
davidbonilla
80
5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
Browser Automated Tests Derek Binkley @DerekB_WI
Derek Binkley @DerekB_WI Designer? Developer? Other?
What is It?
Derek Binkley @DerekB_WI Testing Tools • Text based • Page
recorder • Selenium WebDriver • Browser Emulator
Derek Binkley @DerekB_WI Headless Chrome • June 2017 • Full
browser • Chrome Dev Tools • No GUI
Is Anybody There?
Derek Binkley @DerekB_WI Why? • Reliability • Dependability • Sleep
better after an update
What do we need? Node Chrome Puppeteer Mocha Chai
Derek Binkley @DerekB_WI Install • npm init • npm i
—save mocha chai • npm i --save puppeteer • Add test script to package.json
Derek Binkley @DerekB_WI Setup Command package.json
Examples
Derek Binkley @DerekB_WI Basics • Test Defined as JavaScript •
Full Access to DOM • Assertions using Chai
Derek Binkley @DerekB_WI First Test
Derek Binkley @DerekB_WI First Test
Derek Binkley @DerekB_WI Test Search
Derek Binkley @DerekB_WI Test Search
Derek Binkley @DerekB_WI Test Failed
Derek Binkley @DerekB_WI Test Failed
Derek Binkley @DerekB_WI Screenshots
Derek Binkley @DerekB_WI Screenshots
Derek Binkley @DerekB_WI Interactive Test
Derek Binkley @DerekB_WI Interactive Test
Derek Binkley @DerekB_WI Reacting to Changes • Changing link names
• Changing server builds • Partners changing integrations • New branding
Derek Binkley @DerekB_WI Thanks • @DerekB_WI • http:/ /derekb-wi.com
Derek Binkley @DerekB_WI Resources • https:/ /developers.google.com/web/updates/2017/06/ headless-karma-mocha-chai • https:/
/medium.com/@ankit_m/ui-testing-with- puppeteer-and-mocha-part-1-getting-started- b141b2f9e21 • https:/ /github.com/GoogleChrome/puppeteer • https:/ /github.com/checkly/puppeteer-examples