Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Playwrightの紹介
Search
Yohei Iino
April 08, 2023
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Playwrightの紹介
Playwrightの紹介
Yohei Iino
April 08, 2023
More Decks by Yohei Iino
See All by Yohei Iino
1年半放置したExpo製アプリを最新化してみた
wheatandcat
0
120
作成中のFlutterアプリの中間発表
wheatandcat
0
97
最近読んだ技術書を簡単紹介
wheatandcat
0
120
ユニバーサルリンク/アプリリンクを使ってQRコードでゲストログインできるようにする
wheatandcat
0
390
Firebase App Checkを実装したので紹介
wheatandcat
0
350
PlanetScaleの無料プランがなくなるので、NeonとTiDBを試してみた
wheatandcat
0
440
Flutter HooksとRiverpodの解説
wheatandcat
0
610
T3 Stack(応用編: Next Auth & SSRの実装紹介)
wheatandcat
1
420
App Routerの紹介
wheatandcat
0
170
Other Decks in Technology
See All in Technology
Goodbye ShellScript, Hello File-based App
shunsock
0
1k
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
250
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
290
Genieを崇めよ
kameitomohiro
0
170
データ_AIの事業の勝敗をわけるもの
nek0128
1
480
「大丈夫そう?」をObservabilityで確かめる
mrmtsu
0
150
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
680
AIは推し活である。
kurazuuuuuu
2
980
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.5k
AI coding 整合正規方法
philipz
0
550
Antigravity SDK for the Java Developer
glaforge
0
200
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
570
Featured
See All Featured
The browser strikes back
jonoalderson
0
1.7k
Mind Mapping
helmedeiros
1
370
RailsConf 2023
tenderlove
30
1.6k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
sira's awesome portfolio website redesign presentation
elsirapls
0
420
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
300
Discover your Explorer Soul
emna__ayadi
2
1.3k
Transcript
Playwright の紹介 Press Space for next page
自己紹介 📝 飯野陽平(wheatandcat ) 🏢 個人事業主 → 法人設立(合同会社UNICORN 代表社員) 💻
Work: シェアフル株式会社CTO 📚 Blog: https://www.wheatandcat.me/ 🛠 今までに作ったもの memoir ペペロミア Atomic Design Check List
Playwright とは? E2E テストのためのNode.js のライブラリ Chromium 、Firefox 、および WebKit ブラウザをサポート
テストコードをブラウザ操作から自動生成できるのが強み Microsoft が作成 開発に元Puppeteer の開発者がいるため、インタフェースが似ている
導入 以下のコマンで実行で導入可能 npm init playwright@latest
コード 以下のコードで実行できる import { test, expect } from '@playwright/test'; test.describe("check
website", () => { test('has title', async ({ page }) => { await page.goto('https://playwright.dev/'); // Expect a title "to contain" a substring. await expect(page).toHaveTitle(/Playwright/); }); test('get started link', async ({ page }) => { await page.goto('https://playwright.dev/'); // Click the get started link. await page.getByRole('link', { name: 'Get started' }).click(); // Expects the URL to contain intro. await expect(page).toHaveURL(/.*intro/); }); });
実行① 以下のコマンドで実行 playwright test
実行② テスト結果は以下のように確認できる
実行③ 対象のテストをクリックで詳細も確認できる
実行④ Trace 機能を使用して確認 Trace Viewer | Playwright playwright test --trace
on npx playwright show-report
テストコードの自動生成 以下のコマンドで実行 ※ デモをやる Test Generator | Playwright npx playwright
codegen
実装 自作のアプリに導入してみたので紹介 PR: e2e で保存したデータを検証
実装したモチベーション アプリで使用しているmarkdown-to-jsx がユニットテストで動作しない Markdown の入力をparse してTODO 管理するアプリなので、markdown-to-jsx の入/ 出力が重要 なので、Playwright
で継続的にテストできるように実装
実装内容 ※ デモしながら紹介(トレースも見せる) テストファイルは以下を参照 e2e/todo.spec.ts localStorage のテストは evaluate を使用 Evaluating
JavaScript | Playwright CI で実行は以下を参照 .github/workflows/playwright.yml 実行結果は、こちら ` `
まとめ E2E テストは保守が大変だが、Playwright はテストコードの生成機能があるので保守しやすい 複数のブラウザをサポートしているので安全性が高い トレース機能があるのでCI でコケた時も原因の発見が容易
ご清聴ありがとうございました 🎉