Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rails のブラウザテストを Playwright で動かすようにしたらデバッグが簡単になって捗った

Tomoya Chiba
November 02, 2023

Rails のブラウザテストを Playwright で動かすようにしたらデバッグが簡単になって捗った

Omotesando.rb #91 (https://omotesandorb.connpass.com/event/299381/) で発表した資料です。

Tomoya Chiba

November 02, 2023
Tweet

More Decks by Tomoya Chiba

Other Decks in Technology

Transcript

  1. RSpec.describe "Todos", type: :system do before do driven_by(:playwright) end #

    ... end Rails 7.1 で capybara-playwright-driver を使う設定が System Test に組み込まれ た Add support for Playwright as a driver for system tests by yuki24 · Pull Request #48950 · rails/rails Rails 7.1 で System Test に設定が組み込まれた 18
  2. Kaigi on Rails で 「Playwright で Rails 資産を使いつつ JS でブラウザテストす

    る」手法が紹介されていた https://kaigionrails.org/2023/talks/YusukeIwaki/ https://speakerdeck.com/yusukeiwaki/kaigionrails2023pub Node.js ベースだと、いろいろメリットがある 公式ドキュメント (https://playwright.dev/) を参考文献として使える VSCode 拡張 (https://playwright.dev/docs/getting-started-vscode) の恩恵を 受けられる 画面を触りながらテスト生成、テスト実行、デバッグなど、 将来的には Node.js ベースへの移行もあり? 27
  3. Qiita に書いた記事 Rails のブラウザテストを Playwright で動かすようにしたらデバッグが簡単に なって捗った #Ruby - Qiita

    (https://qiita.com/tomoasleep/items/71b792cb2f89235db1ca) サンプル実装: https://github.com/tomoasleep/rails-sample-with-playwright playwright-ruby-client 作者の解説記事 https://yusukeiwaki.hatenablog.com/entry/2021/05/18/capybara- playwright-driver E2E testing on Rails https://speakerdeck.com/yusukeiwaki/kaigionrails2023pub Further Reading 32