diff --git a/README.md b/README.md index 0d00934..0b220f8 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ await screen.getByLabel('Password').fill('password123'); await screen.getByRole('button', { name: 'Sign In' }).tap(); await expect(screen.getByText('Welcome back')).toBeVisible(); +const screenshot = await screen.screenshot(); await device.close(); ``` @@ -39,6 +40,14 @@ await device.close(); - Node.js >= 18 - A booted iOS simulator, Android emulator, or connected real device +Run `mobilewright doctor` to verify your environment is ready: + +```bash +npx mobilewright doctor +``` + +It checks Xcode, Android SDK, simulators, ADB, and other dependencies — and tells you exactly what's missing and how to fix it. Add `--json` for machine-readable output. + ## Packages | Package | Description | @@ -274,12 +283,26 @@ The `device` fixture connects once per worker (reading from `mobilewright.config ## CLI +### `mobilewright init` + +Scaffold a `mobilewright.config.ts` and `example.test.ts` in the current directory. Skips files that already exist. + ```bash -# List all connected devices, simulators, and emulators -npx mobilewright devices +npx mobilewright init +``` + ``` +created mobilewright.config.ts +created example.test.ts +``` + +### `mobilewright devices` + +List all connected devices, simulators, and emulators. -Example output: +```bash +npx mobilewright devices +``` ``` ID Name Platform Type State @@ -288,10 +311,33 @@ ID Name Platform Type 5A5FCFCA-27EC-4D1B-B412-BAE629154EE0 iPhone 17 Pro ios simulator booted ``` -## Tests +### `mobilewright test` + +Run your tests. Auto-discovers `mobilewright.config.ts` in the current directory. + +```bash +npx mobilewright test +npx mobilewright test login.test.ts # run a specific file +npx mobilewright test --grep "sign in" # filter by test name +npx mobilewright test --reporter html # generate HTML report +npx mobilewright test --retries 2 # retry flaky tests +npx mobilewright test --workers 4 # parallel workers +npx mobilewright test --list # list tests without running +``` + +### `mobilewright show-report` + +Open the HTML report generated by `--reporter html`. + +```bash +npx mobilewright show-report +npx mobilewright show-report mobilewright-report/ +``` + +## Contributing ```bash -# Run all unit tests +# Run the repository's own unit tests npm test ```