This repository was archived by the owner on Mar 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ # Playwright
2+
3+ ## Get Started
4+
5+ ### Installation
6+
7+ - Playwright は E2E テストのためのツール
8+ - とにかくマルチ
9+ - マルチブラウザ(含むモバイル)
10+ - マルチ OS
11+ - マルチ環境(Local or CI)
12+ - ヘッドレス or ヘッドフル、
13+ - 初め方 ` yarn create playwright `
14+ - テストの実行 ` npx playwright test `
15+ - HTML レポートの生成 ` npx playwright show-report `
16+
17+ ### Writing Tests
18+
19+ - テストは以下の 2 つから構成される
20+ - アクションの実行
21+ - アサーションの実行
22+ - アクションを行う際、何かを待つ必要はない
23+ - [ actionability checks] ( https://playwright.dev/docs/actionability ) のおかげ
24+ - レースコンディションを気にする必要もない
25+ - 理想的な結果を宣言的に記述できるため
26+ - async/await を多用しながらテストを書いていく
27+ - アクションの種類
28+ - ナビゲーション
29+ - まずはこれがないと始まらない
30+ - デフォルトでは次のアクションが実行される前にページがロード状態になるまで自動で待ってくれる
31+ - ``` ts
32+ await page .goto (' https://playwright.dev/' );
33+ ```
34+ - インタラクション
35+ - Locators API を使って要素を取得し、その要素に対してアクションを実行する
36+ - 手順としては、` getByRole ` や ` getByText ` などで要素を取得した後、クリック、チェック、ホバー、Input File のセットなどを実行する
37+ - ` ` ` ts
38+ await page.getByRole('link', { name: 'Get started' }).click();
39+ ` ` `
40+ - アサーション
41+ - sync matchers ` expect(success).toBeTruthy(); `
42+ - async matchers ` await expect(page).toHaveTitle('Playwright'); `
43+ - async matchers はテストを堅牢にし、フレーキーになることを防ぐために重要
44+ - テストの独立性
45+ - テストごとに独自のブラウザインスタンスを使用し、独自のページを開き、独自のステートを保持するため、異なるテスト間で状態が共有されないようになっている
46+ - Test Hooks が色々ある
47+ - ` test.describe `
48+ - ` test.beforeEach `
49+ - ` test.afterEach `
50+ - ` test.beforeAll `
51+ - ` test.afterAll `
You can’t perform that action at this time.
0 commit comments