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
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Playwrightの紹介
Playwrightの紹介
Yohei Iino
April 08, 2023
Transcript
15 slides
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 でコケた時も原因の発見が容易
ご清聴ありがとうございました 🎉
More Decks by Yohei Iino
See All by Yohei Iino
1年半放置したExpo製アプリを最新化してみた
wheatandcat
0
130
作成中のFlutterアプリの中間発表
wheatandcat
0
100
最近読んだ技術書を簡単紹介
wheatandcat
0
130
ユニバーサルリンク/アプリリンクを使ってQRコードでゲストログインできるようにする
wheatandcat
0
410
Firebase App Checkを実装したので紹介
wheatandcat
0
400
PlanetScaleの無料プランがなくなるので、NeonとTiDBを試してみた
wheatandcat
0
450
Flutter HooksとRiverpodの解説
wheatandcat
0
620
T3 Stack(応用編: Next Auth & SSRの実装紹介)
wheatandcat
1
430
App Routerの紹介
wheatandcat
0
180
Other Decks in Technology
See All in Technology
Taking back control of your AI development
inesmontani
PRO
0
310
Amazon EFS のマルウェアスキャンをClamAV で自前実装したら苦労した話
mtmtfactory01
0
110
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
140
Re:ゼロから始めるシェアハウスのペットな鯖
silmin_
0
270
新規事業開発でのAWS活用成功談&失敗談! 〜新規事業開発を専門に行うRelicならではのAWS活用〜
amixedcolor
1
140
Is the Website Dying?
miriamschwab
0
150
AWS DevOps Agentの構造から読み解く運用 AI エージェントの設計原則/aws-devops-agent-design-principles
tomoki10
0
280
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
150
20261113_JAWS_Osaka
takuyay0ne
1
610
現地速報! Microsoft Ignite アップデートレポート
kasada
1
460
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
4
860
HTTP通信に使おうとすると実はめんどくさいfile_get_contents
maguroalternative
0
260
Featured
See All Featured
Visualization
eitanlees
153
17k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
630
30 Presentation Tips
portentint
PRO
1
480
The Pragmatic Product Professional
lauravandoore
37
7.5k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
490
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
400
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
440
The Art of Programming - Codeland 2020
erikaheidi
57
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k