@wordpress/e2e-tests
Topics
WordPress の End-To-End (E2E) テスト
注意: 現在進行中の プロジェクト により、E2E テストは Playwright に移行します。このパッケージは非推奨で、完全に Playwright に移行するまで、バグフィックスのみを受け付けます。
インストール
モジュールのインストール
npm install @wordpress/e2e-tests --save-dev
テストの実行
Gutenberg リポジトリでは、以下のコマンドを実行できます。
{"test:e2e":"wp-scripts test-e2e --config packages/e2e-tests/jest.config.js","test:e2e:debug":"wp-scripts --inspect-brk test-e2e --config packages/e2e-tests/jest.config.js --puppeteer-devtools","test:e2e:watch":"npm run test:e2e -- --watch"}
すべての実行可能なテストを実行
npm run test:e2e
すべての実行可能なテストを実行し、変更を監視
npm run test:e2e:watch
特定のテストファイルを実行
npm run test-e2e -- packages/e2e-test/<path_to_test_file>
# または、変更を監視するには
npm run test-e2e:watch -- packages/e2e-test/<path_to_test_file>
デバッグ
e2e テストを Chrome ブラウザでデバッグできるようにします。
npm run test:e2e:debug
コマンドの実行後、chrome://inspect/#devices にアクセスし、パス /test-e2e.js
の下にある inspect
をクリックすると、テストがChromeでデバッグできるようになります。
vscode でのデバッグ
以下の設定を.vscode/launch.json
に追加することで、Chrome ブラウザでのデバッグを、vscode
のデバッガに置き換えられます。
{"type":"node","request":"launch","name":"Debug current e2e test","program":"${workspaceFolder}/node_modules/@wordpress/scripts/bin/wp-scripts.js","args":["test-e2e","--config=${workspaceFolder}/packages/e2e-tests/jest.config.js","--verbose=true","--runInBand","--watch","${file}"],"console":"integratedTerminal","internalConsoleOptions":"neverOpen","trace":"all"}
これにより、エディタで現在開いている spec ファイルをターゲットにして、jest が実行されます。vscode
デバッガーを使用して、Chrome DevTools のようにブレークポイントを追加したり、テストをチェックできます。
注意: このパッケージは Node.js 14.0.0 以降が必要です。古いバージョンと互換性はありません。
このパッケージへのコントリビュート
これは、Gutenberg プロジェクトの一部である、個別パッケージです。このプロジェクトは、monorepo として構成されています。複数の自己完結型ソフトウェアパッケージで構成されており、それぞれが特定の目的を持ちます。この monorepo のパッケージは npm で公開され、WordPress や他のソフトウェアプロジェクトで利用されています。
このパッケージや Gutenberg 全体へのコントリビュートの詳細については、プロジェクトのメインのコントリビューターガイドを参照ください。

最終更新日: