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
Cypress vs. Playwright
Search
Matija Marohnić
September 28, 2022
Programming
170
0
Share
Cypress vs. Playwright
Matija Marohnić
September 28, 2022
More Decks by Matija Marohnić
See All by Matija Marohnić
oxlint & oxfmt: linting and formatting from the future
silvenon
0
22
Goodbye jsdom/happy-dom, hello Vitest Browser Mode!
silvenon
0
12
Introduction to Remix
silvenon
0
150
Studying Strapi: an open source head headless CMS
silvenon
0
53
CSS Specificity
silvenon
0
51
Make your JavaScript projects more accessible to newcomers
silvenon
0
85
React Hooks
silvenon
0
90
PostCSS
silvenon
0
53
CSS Custom Properties
silvenon
0
51
Other Decks in Programming
See All in Programming
RSAが破られる前に知っておきたい 耐量子計算機暗号(PQC)入門 / Intro to PQC: Preparing for the Post-RSA Era
mackey0225
3
120
Nuxt Server Components
wattanx
0
250
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
220
存在論的プログラミング: 時間と存在を記述する
koriym
5
800
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
210
事業会社でのセキュリティ長期インターンについて
masachikaura
0
230
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
720
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
440
「速くなった気がする」をデータで疑う
senleaf24
0
150
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
110
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.6k
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
130
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
430
Designing for Timeless Needs
cassininazir
0
190
Mind Mapping
helmedeiros
PRO
1
140
What's in a price? How to price your products and services
michaelherold
247
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Why Our Code Smells
bkeepers
PRO
340
58k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
330
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
320
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
Transcript
Matija Marohnić Cypress vs. Playwright End-to-end testing showdown https://silvenon.com/blog/e2e-testing-with-cypress-vs-playwright
My experience with Cypress
Background • prior experience with tools like WebdriverIO • used
Cypress for a long time • friendlier API • approachable • but eventually mostly for critical functionality
Speed • 5 tests = 45s (locally) • compared to
my other optimizations it became uncomfortable • started writing less tests 💔
GUI 🤷
GUI
API • familiarity = jQuery 😔 • won’t look familiar
to any new developers
API • should = expect
API • wrap objects to make assertions • another round
of jQuery for everyone! 🍻
API • synchronous…? • commands are queued to be run
later
Meet Playwright 🎭
Background • new testing framework by Microsoft • haven’t used
it in any serious projects yet • only side projects
Supports WebKit • unlike Cypress, Playwright supports Safari • Safari’s
support table can be uncomfortable, so it’s really useful
Headless by default • seemed odd at fi rst •
turned out to be a great feature • less clutter, no dashboards or browsers • run headed only when you need to debug
Speed • 13 tests = 3s ⚡ • more than
2x as many tests = 15x faster • speed is no longer an issue • started testing every square inch of my blog
API • asynchronous, almost everything needs to be awaited
API • at fi rst repetitive and error-prone, mistakes aren’t
always obvious • but gives full control over execution order, more transparent
API • uses Jest’s expect library for assertions, so looks
more like a unit test • doesn’t need a Testing Library plugin, locators are powerful
VS Code extension 🤯 • killer feature • makes Playwright
really e ffi cient to use! • run a test just by clicking on it, and much more • a more balanced approach to GUI — stay in your text editor • 👨💻
…and so much more!
• I’m always excited to learn more about Playwright •
it makes me want to write more tests 🥳