mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
chore: more doc nits (#6937)
This commit is contained in:
parent
8960584b78
commit
99ec32ae61
@ -20,16 +20,13 @@ Create a console project and add the Playwright dependency.
|
||||
|
||||
```bash
|
||||
# Create project
|
||||
dotnet new console -n pw_demo
|
||||
cd pw_demo
|
||||
dotnet new console -n PlaywrightDemo
|
||||
cd PlaywrightDemo
|
||||
|
||||
# Install dependencies
|
||||
dotnet add package Microsoft.Playwright --prerelease
|
||||
|
||||
# Install local Playwright tool and use it to install browsers.
|
||||
dotnet new tool-manifest
|
||||
dotnet tool install Microsoft.Playwright.CLI --version 1.0.0-alpha-1
|
||||
dotnet playwright install
|
||||
# Install dependencies, build project and download necessary browsers.
|
||||
dotnet add package Microsoft.Playwright
|
||||
dotnet build
|
||||
playwright install
|
||||
```
|
||||
|
||||
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
|
||||
# Create new project.
|
||||
dotnet new nunit -n PlaywrightTests
|
||||
cd pw_test
|
||||
cd PlaywrightTests
|
||||
```
|
||||
|
||||
# Install dependencies
|
||||
dotnet add package Microsoft.Playwright --prerelease
|
||||
dotnet add package Microsoft.Playwright.NUnit --prerelease
|
||||
Install dependencies, build project and download necessary browsers. This is only done once per project.
|
||||
|
||||
# Install local Playwright tool and use it to install browsers.
|
||||
dotnet new tool-manifest
|
||||
dotnet tool install Microsoft.Playwright.CLI --version 1.0.0-alpha-1
|
||||
dotnet playwright install
|
||||
```bash
|
||||
dotnet add package Microsoft.Playwright
|
||||
dotnet build
|
||||
playwright install
|
||||
```
|
||||
|
||||
Edit UnitTest1.cs file.
|
||||
|
@ -256,9 +256,6 @@ test('my test', async ({ page }) => {
|
||||
// Expect an attribute "to be strictly equal" to the value.
|
||||
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');
|
||||
// Expect some text to be visible on the page.
|
||||
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
|
||||
```bash
|
||||
npx playwright test --headed
|
||||
npx playwright test -c tests --headed
|
||||
```
|
||||
|
||||
- Run tests in a particular browser
|
||||
```bash
|
||||
npx playwright test --browser=webkit
|
||||
npx playwright test -c tests --browser=webkit
|
||||
```
|
||||
|
||||
- Run tests in all browsers
|
||||
```bash
|
||||
npx playwright test --browser=all
|
||||
npx playwright test -c tests --browser=all
|
||||
```
|
||||
|
||||
- Run a single test file
|
||||
```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
|
||||
```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
|
||||
```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
|
||||
```bash
|
||||
npx playwright test
|
||||
npx playwright test -c tests
|
||||
```
|
||||
|
||||
- Disable [parallelization](./test-parallel.md)
|
||||
```bash
|
||||
npx playwright test --workers=1
|
||||
npx playwright test -c tests --workers=1
|
||||
```
|
||||
|
||||
- Choose a [reporter](./test-reporters.md)
|
||||
```bash
|
||||
npx playwright test --reporter=dot
|
||||
npx playwright test -c tests --reporter=dot
|
||||
```
|
||||
|
||||
- Run in debug mode with [Playwright Inspector](./inspector.md)
|
||||
```bash
|
||||
# Linux/macOS
|
||||
PWDEBUG=1 npx playwright test
|
||||
PWDEBUG=1 npx playwright test -c tests
|
||||
|
||||
# Windows with cmd.exe
|
||||
set PWDEBUG=1
|
||||
npx playwright test
|
||||
npx playwright test -c tests
|
||||
|
||||
# Windows with PowerShell
|
||||
$env:PWDEBUG=1
|
||||
npx playwright test
|
||||
npx playwright test -c tests
|
||||
```
|
||||
|
||||
## Create a configuration file
|
||||
@ -407,11 +404,11 @@ import { PlaywrightTestConfig, devices } from '@playwright/test';
|
||||
const config: PlaywrightTestConfig = {
|
||||
projects: [
|
||||
{
|
||||
name: 'Desktop Chromium',
|
||||
name: 'Chrome Stable',
|
||||
use: {
|
||||
browserName: 'chromium',
|
||||
// Test against Chrome Beta channel.
|
||||
channel: 'chrome-beta',
|
||||
// Test against Chrome Stable channel.
|
||||
channel: 'chrome',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user