LoginSignup
1
1

VScodeとPlaywrightで自動テスト作成 (更新中)

Last updated at Posted at 2023-11-27

環境準備

VSCode Editor

公式サイトからダウンロードとインストール

Node.js

公式サイトからダウンロードとインストール

node-install.png

Playwright の VSCode 拡張

VS codeに"Playwright Test for VSCode"をインストールする

  1. 以下のページでインストール場合

  1. VScodeからインストール場合
    node-install.png
    [VS code]拡張機能 > "Playwright"で検索 > "Playwright Test for VSCode" を選択 > インストール でインストールする。

Playwright

インストール

表示 > コマンドパレット > "Install Playwright"を検索 > Install Playwrightを選択 > OKをクリックする。
install playwright.png
install playwright 2.png

フォルダ構成

playwright-folder.PNG
playwright.config.ts 設定ファイル
tests/ テストファイル置いてるフォルダ
example.spec.ts
tests-examples/ サンプルコード
demo-todo-app.spec.ts

サンプルテスト実行

Testing → TestExporerにテストリスト表示する。実行したいテストの横に▷ボタン押したらテスト実行する
run-test.png

テスト作成

Testing → Show browerチェック(ブラウザー表示させるため)→ Record new(新しいテスト作成)
run-test-2.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1