作成日:2024-02-06, 更新日:2024-02-06
メモ
- node.jsをインストしておく
- 適当な場所にフォルダを作成
- CMDから色々実行
- ファイルの修正、追加
- CMDからsafari起動
CMDから色々実行
ひとまずカレントを移してから下記実行
$ npm init -y $ npm i -D @playwright/test $ npx playwright install
ファイルの修正、追加
▼フォルダ内に作られているpackage.jsonを修正: script内
"scripts": {
"test:chrome": "npx playwright test --headed --browser=chromium",
"test:firefox": "npx playwright test --headed --browser=firefox",
"test:safari": "npx playwright test --headed --browser=webkit"
}
▼フォルダ内に新規作成: browser.test.ts
import { test } from '@playwright/test';
test('test browser', async ({ page }) => {
// ブラウザが起動した時に表示されるページ
// await page.goto('http://localhost:3000/');
await page.pause();
});
CMDからsafari起動
▼カレントを移してから下記実行
$ npm run test:safari