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
98
最近読んだ技術書を簡単紹介
wheatandcat
0
120
ユニバーサルリンク/アプリリンクを使ってQRコードでゲストログインできるようにする
wheatandcat
0
400
Firebase App Checkを実装したので紹介
wheatandcat
0
370
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
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
940
WasmをRustにする
sansantech
PRO
0
250
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
110
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
Browser Spec: Testing Hotwire with Ruby
takahashim
1
120
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
860
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
4
1.1k
Temporal 最高!でも改めて「日付」について調べたら人類の負債すぎる件
riyaamemiya
0
140
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
140
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Marketing to machines
jonoalderson
1
5.9k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Balancing Empowerment & Direction
lara
6
1.3k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Visualization
eitanlees
153
17k
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 でコケた時も原因の発見が容易
ご清聴ありがとうございました 🎉