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
69
Teaching Through Code Review
derekb
0
94
Add Location-Based Searching to Your Site with Elasticsearch
derekb
0
27
Add Location-based Searching to Your PHP App with Elasticsearch
derekb
1
300
Map, Filter, and Reduce in PHP
derekb
0
650
You Version Your Code, Why Not Your Database?
derekb
0
54
Taming Your Data with Elasticsearch - PHP Benelux
derekb
1
430
What Raising 3 Kids Taught Me About Working With Users
derekb
0
340
Other Decks in Programming
See All in Programming
Beyond ORM
77web
7
860
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
42 best practices for Symfony, a decade later
tucksaun
1
180
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
php-conference-japan-2024
tasuku43
0
300
Jakarta EE meets AI
ivargrimstad
0
250
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
良いユニットテストを書こう
mototakatsu
8
2.5k
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
780
情報漏洩させないための設計
kubotak
2
220
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Docker and Python
trallard
42
3.1k
The Pragmatic Product Professional
lauravandoore
32
6.3k
KATA
mclloyd
29
14k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Facilitating Awesome Meetings
lara
50
6.1k
A designer walks into a library…
pauljervisheath
204
24k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
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