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
Playwrightの紹介
Search
Yohei Iino
April 08, 2023
Technology
260
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
95
最近読んだ技術書を簡単紹介
wheatandcat
0
120
ユニバーサルリンク/アプリリンクを使ってQRコードでゲストログインできるようにする
wheatandcat
0
390
Firebase App Checkを実装したので紹介
wheatandcat
0
340
PlanetScaleの無料プランがなくなるので、NeonとTiDBを試してみた
wheatandcat
0
430
Flutter HooksとRiverpodの解説
wheatandcat
0
590
T3 Stack(応用編: Next Auth & SSRの実装紹介)
wheatandcat
1
420
App Routerの紹介
wheatandcat
0
160
Other Decks in Technology
See All in Technology
【Oracle AI Spotlight ウェビナー】AWSか、Azureか、Google Cloudか。その議論にオラクルを含める意義。
oracle4engineer
PRO
2
240
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
0
120
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
200
Azure App Service / Container Apps の組み込み認証
kuniteru
0
210
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
170
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
110
Sony-DroidKaigi2026
sony
1
400
Benchmarking Vector Databases: pgvector vs. LanceDB
tsho
0
150
AI 駆動 Terraform 開発/SRE_BizReach_MIXI_2
visional_engineering_and_design
2
1.9k
V8コントリビュート超入門
riyaamemiya
0
150
プロダクトエンジニアに必要な「いい感じ」に作る能力 〜たくさん作れる時代に、どこまで作るかの決め方〜
jnishime_dresscode
2
1.4k
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
0
450
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
How to Talk to Developers About Accessibility
jct
2
540
Believing is Seeing
oripsolob
1
210
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
How to make the Groovebox
asonas
2
2.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Practical Orchestrator
shlominoach
191
12k
Everyday Curiosity
cassininazir
0
310
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
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 でコケた時も原因の発見が容易
ご清聴ありがとうございました 🎉