chore: more doc nits (#6937)

This commit is contained in:
Pavel Feldman 2021-06-07 11:54:50 -07:00 committed by GitHub
parent 8960584b78
commit 99ec32ae61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 35 deletions

View File

@ -20,16 +20,13 @@ Create a console project and add the Playwright dependency.
```bash ```bash
# Create project # Create project
dotnet new console -n pw_demo dotnet new console -n PlaywrightDemo
cd pw_demo cd PlaywrightDemo
# Install dependencies # Install dependencies, build project and download necessary browsers.
dotnet add package Microsoft.Playwright --prerelease dotnet add package Microsoft.Playwright
dotnet build
# Install local Playwright tool and use it to install browsers. playwright install
dotnet new tool-manifest
dotnet tool install Microsoft.Playwright.CLI --version 1.0.0-alpha-1
dotnet playwright install
``` ```
Create a `Program.cs` that will navigate to `https://playwright.dev/dotnet` and take a screenshot in Chromium. Create a `Program.cs` that will navigate to `https://playwright.dev/dotnet` and take a screenshot in Chromium.
@ -70,16 +67,15 @@ You can choose to use NUnit test fixtures that come bundled with Playwright. The
```bash ```bash
# Create new project. # Create new project.
dotnet new nunit -n PlaywrightTests dotnet new nunit -n PlaywrightTests
cd pw_test cd PlaywrightTests
```
# Install dependencies Install dependencies, build project and download necessary browsers. This is only done once per project.
dotnet add package Microsoft.Playwright --prerelease
dotnet add package Microsoft.Playwright.NUnit --prerelease
# Install local Playwright tool and use it to install browsers. ```bash
dotnet new tool-manifest dotnet add package Microsoft.Playwright
dotnet tool install Microsoft.Playwright.CLI --version 1.0.0-alpha-1 dotnet build
dotnet playwright install playwright install
``` ```
Edit UnitTest1.cs file. Edit UnitTest1.cs file.

View File

@ -256,9 +256,6 @@ test('my test', async ({ page }) => {
// Expect an attribute "to be strictly equal" to the value. // Expect an attribute "to be strictly equal" to the value.
expect(await page.getAttribute('text=Get Started', 'href')).toBe('/docs/intro'); expect(await page.getAttribute('text=Get Started', 'href')).toBe('/docs/intro');
// Expect an element "to be visible".
expect(await page.isVisible('[aria-label="GitHub repository"]')).toBeTruthy();
await page.click('text=Get Started'); await page.click('text=Get Started');
// Expect some text to be visible on the page. // Expect some text to be visible on the page.
expect(await page.waitForSelector('text=System requirements')).toBeTruthy(); expect(await page.waitForSelector('text=System requirements')).toBeTruthy();
@ -296,61 +293,61 @@ Here are the most common options available in the [command line](./test-cli.md).
- Run tests in headed browsers - Run tests in headed browsers
```bash ```bash
npx playwright test --headed npx playwright test -c tests --headed
``` ```
- Run tests in a particular browser - Run tests in a particular browser
```bash ```bash
npx playwright test --browser=webkit npx playwright test -c tests --browser=webkit
``` ```
- Run tests in all browsers - Run tests in all browsers
```bash ```bash
npx playwright test --browser=all npx playwright test -c tests --browser=all
``` ```
- Run a single test file - Run a single test file
```bash ```bash
npx playwright test tests/todo-page.spec.ts npx playwright test -c tests tests/todo-page.spec.ts
``` ```
- Run a set of test files - Run a set of test files
```bash ```bash
npx playwright test tests/todo-page/ tests/landing-page/ npx playwright test -c tests tests/todo-page/ tests/landing-page/
``` ```
- Run a test with specific title - Run a test with specific title
```bash ```bash
npx playwright test -g "add a todo item" npx playwright test -c tests -g "add a todo item"
``` ```
- Run tests [in parallel](./test-parallel.md) - that's the default - Run tests [in parallel](./test-parallel.md) - that's the default
```bash ```bash
npx playwright test npx playwright test -c tests
``` ```
- Disable [parallelization](./test-parallel.md) - Disable [parallelization](./test-parallel.md)
```bash ```bash
npx playwright test --workers=1 npx playwright test -c tests --workers=1
``` ```
- Choose a [reporter](./test-reporters.md) - Choose a [reporter](./test-reporters.md)
```bash ```bash
npx playwright test --reporter=dot npx playwright test -c tests --reporter=dot
``` ```
- Run in debug mode with [Playwright Inspector](./inspector.md) - Run in debug mode with [Playwright Inspector](./inspector.md)
```bash ```bash
# Linux/macOS # Linux/macOS
PWDEBUG=1 npx playwright test PWDEBUG=1 npx playwright test -c tests
# Windows with cmd.exe # Windows with cmd.exe
set PWDEBUG=1 set PWDEBUG=1
npx playwright test npx playwright test -c tests
# Windows with PowerShell # Windows with PowerShell
$env:PWDEBUG=1 $env:PWDEBUG=1
npx playwright test npx playwright test -c tests
``` ```
## Create a configuration file ## Create a configuration file
@ -407,11 +404,11 @@ import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
projects: [ projects: [
{ {
name: 'Desktop Chromium', name: 'Chrome Stable',
use: { use: {
browserName: 'chromium', browserName: 'chromium',
// Test against Chrome Beta channel. // Test against Chrome Stable channel.
channel: 'chrome-beta', channel: 'chrome',
}, },
}, },
{ {