From 48ad4387362722bb86510ac66527374a635cea5e Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Fri, 3 May 2024 10:06:22 +0000
Subject: [PATCH] feat(roll): roll to ToT Playwright (03-05-24)
---
dotnet/docs/api/class-apirequest.mdx | 3 +
dotnet/docs/api/class-browser.mdx | 6 +
dotnet/docs/api/class-browsertype.mdx | 3 +
dotnet/docs/ci-intro.mdx | 20 +-
dotnet/docs/codegen-intro.mdx | 2 +-
dotnet/docs/intro.mdx | 76 +++----
dotnet/docs/running-tests.mdx | 199 ++++++++++++++----
dotnet/docs/test-runners.mdx | 261 +-----------------------
dotnet/docs/trace-viewer-intro.mdx | 28 +--
dotnet/docs/writing-tests.mdx | 141 +++++++++----
java/docs/api/class-apirequest.mdx | 3 +
java/docs/api/class-browser.mdx | 6 +
java/docs/api/class-browsertype.mdx | 3 +
java/docs/ci-intro.mdx | 11 +-
java/docs/trace-viewer-intro.mdx | 10 +-
nodejs/docs/api/class-androiddevice.mdx | 3 +
nodejs/docs/api/class-apirequest.mdx | 3 +
nodejs/docs/api/class-browser.mdx | 6 +
nodejs/docs/api/class-browsertype.mdx | 3 +
nodejs/docs/api/class-electron.mdx | 3 +
nodejs/docs/api/class-testoptions.mdx | 3 +
nodejs/docs/ci-intro.mdx | 11 +-
python/docs/api/class-apirequest.mdx | 3 +
python/docs/api/class-browser.mdx | 6 +
python/docs/api/class-browsertype.mdx | 3 +
python/docs/ci-intro.mdx | 11 +-
python/docs/trace-viewer-intro.mdx | 10 +-
27 files changed, 394 insertions(+), 443 deletions(-)
diff --git a/dotnet/docs/api/class-apirequest.mdx b/dotnet/docs/api/class-apirequest.mdx
index 2600f422211..0668289c9cb 100644
--- a/dotnet/docs/api/class-apirequest.mdx
+++ b/dotnet/docs/api/class-apirequest.mdx
@@ -47,6 +47,9 @@ await ApiRequest.NewContextAsync(options);
- `Origin` [string]? *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `SendImmediately` [bool]? *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `IgnoreHTTPSErrors` [bool]? *(optional)*#
diff --git a/dotnet/docs/api/class-browser.mdx b/dotnet/docs/api/class-browser.mdx
index 423aed64be1..ce04ad22da9 100644
--- a/dotnet/docs/api/class-browser.mdx
+++ b/dotnet/docs/api/class-browser.mdx
@@ -208,6 +208,9 @@ await browser.CloseAsync();
- `Origin` [string]? *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `SendImmediately` [bool]? *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `IgnoreHTTPSErrors` [bool]? *(optional)*#
@@ -387,6 +390,9 @@ await Browser.NewPageAsync(options);
- `Origin` [string]? *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `SendImmediately` [bool]? *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `IgnoreHTTPSErrors` [bool]? *(optional)*#
diff --git a/dotnet/docs/api/class-browsertype.mdx b/dotnet/docs/api/class-browsertype.mdx
index 1495348a794..6575cf25b32 100644
--- a/dotnet/docs/api/class-browsertype.mdx
+++ b/dotnet/docs/api/class-browsertype.mdx
@@ -351,6 +351,9 @@ await BrowserType.LaunchPersistentContextAsync(userDataDir, options);
- `Origin` [string]? *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `SendImmediately` [bool]? *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `IgnoreAllDefaultArgs` [bool]? *(optional)* Added in: v1.9#
diff --git a/dotnet/docs/ci-intro.mdx b/dotnet/docs/ci-intro.mdx
index 3aef2364b41..55bd55495d2 100644
--- a/dotnet/docs/ci-intro.mdx
+++ b/dotnet/docs/ci-intro.mdx
@@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet build
@@ -67,7 +67,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet build
@@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet build
@@ -110,13 +110,15 @@ jobs:
Once you have your [GitHub actions workflow](#setting-up-github-actions) setup then all you need to do is [Create a repo on GitHub](https://docs.github.com/en/get-started/quickstart/create-a-repo) or push your code to an existing repository. Follow the instructions on GitHub and don't forget to [initialize a git repository](https://github.com/git-guides/git-init) using the `git init` command so you can [add](https://github.com/git-guides/git-add), [commit](https://github.com/git-guides/git-commit) and [push](https://github.com/git-guides/git-push) your code.
-
+######
+![dotnet repo on github](https://github.com/microsoft/playwright/assets/13063165/4f1b4cc3-b850-4d60-a99e-24057eaf91ad)
## Opening the Workflows
Click on the **Actions** tab to see the workflows. Here you will see if your tests have passed or failed.
-
+######
+![opening the workflow](https://github.com/microsoft/playwright/assets/13063165/71793c09-0815-4faa-866b-85684a1f87e5)
On Pull Requests you can also click on the **Details** link in the [PR status check](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
@@ -126,13 +128,15 @@ On Pull Requests you can also click on the **Details** link in the [PR status ch
Clicking on the workflow run will show you the all the actions that GitHub performed and clicking on **Run Playwright tests** will show the error messages, what was expected and what was received as well as the call log.
-
+######
+![viewing the test logs](https://github.com/microsoft/playwright/assets/13063165/ba2d8d7b-ffce-42de-95e0-bcb35c421975)
## Viewing the Trace
-[trace.playwright.dev](https://trace.playwright.dev) is a statically hosted variant of the Trace Viewer. You can upload trace files using drag and drop.
+You can upload Traces which get created on your CI like GitHub Actions as artifacts. This requires [starting and stopping the trace](./trace-viewer-intro#recording-a-trace). We recommend only recording traces for failing tests. Once your traces have been uploaded to CI, they can then be downloaded and opened using [trace.playwright.dev](https://trace.playwright.dev), which is a statically hosted variant of the Trace Viewer. You can upload trace files using drag and drop.
-![playwright trace viewer](https://github.com/microsoft/playwright/assets/13063165/6d5885dc-d511-4c20-b728-040a7ef6cea4)
+######
+![playwright trace viewer](https://github.com/microsoft/playwright/assets/13063165/84150084-5019-470a-8449-b61d206bfbb0)
## What's Next
- [Learn how to use Locators](./locators.mdx)
diff --git a/dotnet/docs/codegen-intro.mdx b/dotnet/docs/codegen-intro.mdx
index bd520a5fc30..cd4fb8eee45 100644
--- a/dotnet/docs/codegen-intro.mdx
+++ b/dotnet/docs/codegen-intro.mdx
@@ -19,7 +19,7 @@ Playwright comes with the ability to generate tests out of the box and is a grea
Use the `codegen` command to run the test generator followed by the URL of the website you want to generate tests for. The URL is optional and you can always run the command without it and then add the URL directly into the browser window instead.
```bash
-pwsh bin/Debug/netX/playwright.ps1 codegen demo.playwright.dev/todomvc
+pwsh bin/Debug/net8.0/playwright.ps1 codegen demo.playwright.dev/todomvc
```
### Recording a test
diff --git a/dotnet/docs/intro.mdx b/dotnet/docs/intro.mdx
index ace0a838399..aa1a0361c82 100644
--- a/dotnet/docs/intro.mdx
+++ b/dotnet/docs/intro.mdx
@@ -63,13 +63,13 @@ dotnet add package Microsoft.Playwright.MSTest
dotnet build
```
-4. Install required browsers by replacing `netX` with the actual output folder name, e.g. `net8.0`:
+1. Install required browsers. This example uses `net8.0`, if you are using a different version of .NET you will need to adjust the command and change `net8.0` to your version.
```bash
-pwsh bin/Debug/netX/playwright.ps1 install
+pwsh bin/Debug/net8.0/playwright.ps1 install
```
-If `pwsh` is not available, you have to [install PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell).
+If `pwsh` is not available, you will have to [install PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell).
## Add Example Tests
@@ -90,28 +90,28 @@ namespace PlaywrightTests;
[Parallelizable(ParallelScope.Self)]
[TestFixture]
-public class Tests : PageTest
+public class ExampleTest : PageTest
{
[Test]
- public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
+ public async Task HasTitle()
{
await Page.GotoAsync("https://playwright.dev");
// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+ }
- // create a locator
- var getStarted = Page.GetByRole(AriaRole.Link, new() { Name = "Get started" });
-
- // Expect an attribute "to be strictly equal" to the value.
- await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/intro");
+ [Test]
+ public async Task GetStartedLink()
+ {
+ await Page.GotoAsync("https://playwright.dev");
// Click the get started link.
- await getStarted.ClickAsync();
+ await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
- // Expects the URL to contain intro.
- await Expect(Page).ToHaveURLAsync(new Regex(".*intro"));
- }
+ // Expects page to have a heading with the name of Installation.
+ await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Installation" })).ToBeVisibleAsync();
+ }
}
```
@@ -129,28 +129,28 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestMethod]
- public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
+ public async Task HasTitle()
{
await Page.GotoAsync("https://playwright.dev");
// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+ }
- // create a locator
- var getStarted = Page.GetByRole(AriaRole.Link, new() { Name = "Get started" });
-
- // Expect an attribute "to be strictly equal" to the value.
- await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/intro");
+ [TestMethod]
+ public async Task GetStartedLink()
+ {
+ await Page.GotoAsync("https://playwright.dev");
// Click the get started link.
- await getStarted.ClickAsync();
+ await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
- // Expects the URL to contain intro.
- await Expect(Page).ToHaveURLAsync(new Regex(".*intro"));
- }
+ // Expects page to have a heading with the name of Installation.
+ await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Installation" })).ToBeVisibleAsync();
+ }
}
```
@@ -160,29 +160,13 @@ public class UnitTest1 : PageTest
## Running the Example Tests
-By default tests will be run on Chromium. This can be configured via the `BROWSER` environment variable, or by adjusting the [launch configuration options](./test-runners.mdx). Tests are run in headless mode meaning no browser will open up when running the tests. Results of the tests and test logs will be shown in the terminal.
-
-
-
-
-
-```bash
-dotnet test -- NUnit.NumberOfTestWorkers=5
-```
-
-
-
-
+By default tests will be run on Chromium. This can be configured via the `BROWSER` environment variable, or by adjusting the [launch configuration options](./running-tests.mdx). Tests are run in headless mode meaning no browser will open up when running the tests. Results of the tests and test logs will be shown in the terminal.
```bash
-dotnet test -- MSTest.Parallelize.Workers=5
+dotnet test
```
-
-
-
-
-See our doc on [Test Runners](./test-runners.mdx) to learn more about running tests in headed mode, running multiple tests, running specific configurations etc.
+See our doc on [Running and Debugging Tests](./running-tests.mdx) to learn more about running tests in headed mode, running multiple tests, running specific configurations etc.
## System requirements
- Playwright is distributed as a .NET Standard 2.0 library. We recommend .NET 8.
@@ -193,10 +177,10 @@ See our doc on [Test Runners](./test-runners.mdx) to learn more about running te
## What's next
- [Write tests using web first assertions, page fixtures and locators](./writing-tests.mdx)
- [Run single test, multiple tests, headed mode](./running-tests.mdx)
-- [Learn more about the NUnit and MSTest base classes](./test-runners.mdx)
- [Generate tests with Codegen](./codegen.mdx)
- [See a trace of your tests](./trace-viewer-intro.mdx)
-- [Using Playwright as library](./library.mdx)
+- [Run tests on CI](./ci-intro.mdx)
+- [Learn more about the NUnit and MSTest base classes](./test-runners.mdx)
[Accessibility]: /api/class-accessibility.mdx "Accessibility"
diff --git a/dotnet/docs/running-tests.mdx b/dotnet/docs/running-tests.mdx
index 781fb7887c9..324f6568f88 100644
--- a/dotnet/docs/running-tests.mdx
+++ b/dotnet/docs/running-tests.mdx
@@ -9,57 +9,166 @@ import HTMLCard from '@site/src/components/HTMLCard';
## Introduction
You can run a single test, a set of tests or all tests. Tests can be run on different browsers. By default, tests are run in a headless manner, meaning no browser window will be opened while running the tests and results will be seen in the terminal. If you prefer, you can run your tests in headed mode by using the `headless` test run parameter.
-- Running all tests
-
- ```bash
- dotnet test
- ```
-
-- Running a single test file
-
- ```bash
- dotnet test --filter "MyClassName"
- ```
-
-- Run a set of test files
-
- ```bash
- dotnet test --filter "MyClassName1|MyClassName2"
- ```
-
-- Run the test with the title
-
- ```bash
- dotnet test --filter "Name~TestMethod1"
- ```
-
-- Running Tests on specific browsers
-
- ```bash
- dotnet test -- Playwright.BrowserName=webkit
- ```
-
-- Running Tests on multiple browsers
-
- To run your test on multiple browsers or configurations, you need to invoke the `dotnet test` command multiple times. There you can then either specify the `BROWSER` environment variable or set the `Playwright.BrowserName` via the runsettings file:
-
- ```bash
- dotnet test --settings:chromium.runsettings
- dotnet test --settings:firefox.runsettings
- dotnet test --settings:webkit.runsettings
- ```
-
- ```xml
-
+
+**You will learn**
+- [How to run tests](/running-tests)
+- [How to debug tests](/running-tests.mdx#debugging-tests)
+
+## Running tests
+
+### Run all tests
+
+Use the following command to run all tests.
+
+```bash
+dotnet test
+```
+
+### Run your tests in headed mode
+
+Use the following command to run your tests in headed mode opening a browser window for each test.
+
+
+
+
+```bash
+HEADED=1 dotnet test
+```
+
+
+
+
+```powershell
+$env:HEADED="1"
+dotnet test
+```
+
+
+
+
+```batch
+set HEADED=1
+dotnet test
+```
+
+
+
+
+### Run tests on different browsers: Browser env
+
+Specify which browser you would like to run your tests on via the `BROWSER` environment variable.
+
+
+
+
+```bash
+BROWSER=webkit dotnet test
+```
+
+
+
+
+```powershell
+$env:BROWSER="webkit"
+dotnet test
+```
+
+
+
+
+```batch
+set BROWSER=webkit
+dotnet test
+```
+
+
+
+
+### Run tests on different browsers: launch configuration
+
+Specify which browser you would like to run your tests on by adjusting the launch configuration options:
+
+```bash
+dotnet test -- Playwright.BrowserName=webkit
+```
+
+To run your test on multiple browsers or configurations, you need to invoke the `dotnet test` command multiple times. There you can then either specify the `BROWSER` environment variable or set the `Playwright.BrowserName` via the runsettings file:
+
+```bash
+dotnet test --settings:chromium.runsettings
+dotnet test --settings:firefox.runsettings
+dotnet test --settings:webkit.runsettings
+```
+
+```xml
+
chromium
- ```
-
+```
+
For more information see [selective unit tests](https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest) in the Microsoft docs.
+### Run specific tests
+
+To run a single test file, use the filter flag followed by the class name of the test you want to run.
+
+```bash
+dotnet test --filter "ExampleTest"
+```
+
+To run a set of test files, use the filter flag followed by the class names of the tests you want to run.
+
+```bash
+dotnet test --filter "ExampleTest1|ExampleTest2"
+```
+
+To run a test with a specific title use the filter flag followed by *Name~* and the title of the test.
+
+```bash
+dotnet test --filter "Name~GetStartedLink"
+```
+
+### Run tests with multiple workers:
+
+
+
+
+
+```bash
+dotnet test -- NUnit.NumberOfTestWorkers=5
+```
+
+
+
+
+
+```bash
+dotnet test -- MSTest.Parallelize.Workers=5
+```
+
+
+
+
+
## Debugging Tests
Since Playwright runs in .NET, you can debug it with your debugger of choice in e.g. Visual Studio Code or Visual Studio. Playwright comes with the Playwright Inspector which allows you to step through Playwright API calls, see their debug logs and explore [locators](./locators.mdx).
@@ -98,7 +207,7 @@ dotnet test
-
+![debugging tests with playwright inspector](https://github.com/microsoft/playwright/assets/13063165/a1e758d3-d379-414f-be0b-7339f12bb635)
Check out our [debugging guide](./debug.mdx) to learn more about the [Playwright Inspector](./debug.mdx#playwright-inspector) as well as debugging with [Browser Developer tools](./debug.mdx#browser-developer-tools).
diff --git a/dotnet/docs/test-runners.mdx b/dotnet/docs/test-runners.mdx
index 036d65be360..ac94eac7f75 100644
--- a/dotnet/docs/test-runners.mdx
+++ b/dotnet/docs/test-runners.mdx
@@ -12,138 +12,11 @@ While Playwright for .NET isn't tied to a particular test runner or testing fram
Playwright and Browser instances can be reused between tests for better performance. We recommend running each test case in a new BrowserContext, this way browser state will be isolated between the tests.
-
-
## NUnit
Playwright provides base classes to write tests with NUnit via the [`Microsoft.Playwright.NUnit`](https://www.nuget.org/packages/Microsoft.Playwright.NUnit) package.
-### Creating an NUnit project
-
-```bash
-# Create a new project
-dotnet new nunit -n PlaywrightTests
-cd PlaywrightTests
-
-# Add the required reference
-dotnet add package Microsoft.Playwright.NUnit
-dotnet build
-
-# Install the required browsers and operating system dependencies
-pwsh bin/Debug/netX/playwright.ps1 install --with-deps
-```
-
-Modify the UnitTest1.cs:
-
-```csharp
-using Microsoft.Playwright.NUnit;
-
-namespace PlaywrightTests;
-
-[Parallelizable(ParallelScope.Self)]
-[TestFixture]
-public class MyTest : PageTest
-{
- [Test]
- public async Task ShouldHaveTheCorrectSlogan()
- {
- await Page.GotoAsync("https://playwright.dev");
- await Expect(Page.Locator("text=enables reliable end-to-end testing for modern web apps")).ToBeVisibleAsync();
- }
-
- [Test]
- public async Task ShouldHaveTheCorrectTitle()
- {
- await Page.GotoAsync("https://playwright.dev");
- var title = Page.Locator(".navbar__inner .navbar__title");
- await Expect(title).ToHaveTextAsync("Playwright");
- }
-}
-```
-
-Run your tests against Chromium
-
-```bash
-dotnet test
-```
-
-Run your tests against WebKit
-
-
-
-
-```bash
-BROWSER=webkit dotnet test
-```
-
-
-
-
-```powershell
-$env:BROWSER="webkit"
-dotnet test
-```
-
-
-
-
-```batch
-set BROWSER=webkit
-dotnet test
-```
-
-
-
-
-Run your tests with GUI
-
-
-
-
-```bash
-HEADED=1 dotnet test
-```
-
-
-
-
-```powershell
-$env:HEADED="1"
-dotnet test
-```
-
-
-
-
-```batch
-set HEADED=1
-dotnet test
-```
-
-
-
-
-You can also choose specifically which tests to run, using the [filtering capabilities](https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=nunit):
-
-```bash
-dotnet test --filter "Name~Slogan"
-```
+Check out the [installation guide](./intro.mdx) to get started.
### Running NUnit tests in Parallel
@@ -151,6 +24,10 @@ By default NUnit will run all test files in parallel, while running tests inside
For CPU-bound tests, we recommend using as many workers as there are cores on your system, divided by 2. For IO-bound tests you can use as many workers as you have cores.
+```bash
+dotnet test -- NUnit.NumberOfTestWorkers=5
+```
+
### Customizing [BrowserContext] options
To customize context options, you can override the `ContextOptions` method of your test class derived from `Microsoft.Playwright.MSTest.PageTest` or `Microsoft.Playwright.MSTest.ContextTest`. See the following example:
@@ -259,131 +136,7 @@ There are a few base classes available to you in `Microsoft.Playwright.NUnit` na
Playwright provides base classes to write tests with MSTest via the [`Microsoft.Playwright.MSTest`](https://www.nuget.org/packages/Microsoft.Playwright.MSTest) package.
-### Creating an MSTest project
-
-```bash
-# Create a new project
-dotnet new mstest -n PlaywrightTests
-cd PlaywrightTests
-
-# Add the required reference
-dotnet add package Microsoft.Playwright.MSTest
-dotnet build
-
-# Install the required browsers and operating system dependencies
-pwsh bin/Debug/netX/playwright.ps1 install --with-deps
-```
-
-Modify the UnitTest1.cs:
-
-```csharp
-using Microsoft.Playwright.MSTest;
-
-namespace PlaywrightTests;
-
-[TestClass]
-public class UnitTest1: PageTest
-{
- [TestMethod]
- public async Task ShouldHaveTheCorrectSlogan()
- {
- await Page.GotoAsync("https://playwright.dev");
- await Expect(Page.Locator("text=enables reliable end-to-end testing for modern web apps")).ToBeVisibleAsync();
- }
-
- [TestMethod]
- public async Task ShouldHaveTheCorrectTitle()
- {
- await Page.GotoAsync("https://playwright.dev");
- var title = Page.Locator(".navbar__inner .navbar__title");
- await Expect(title).ToHaveTextAsync("Playwright");
- }
-}
-```
-
-Run your tests against Chromium
-
-```bash
-dotnet test
-```
-
-Run your tests against WebKit
-
-
-
-
-```bash
-BROWSER=webkit dotnet test
-```
-
-
-
-
-```powershell
-$env:BROWSER="webkit"
-dotnet test
-```
-
-
-
-
-```batch
-set BROWSER=webkit
-dotnet test
-```
-
-
-
-
-Run your tests with GUI
-
-
-
-
-```bash
-HEADED=1 dotnet test
-```
-
-
-
-
-```powershell
-$env:HEADED="1"
-dotnet test
-```
-
-
-
-
-```batch
-set HEADED=1
-dotnet test
-```
-
-
-
-
-You can also choose specifically which tests to run, using the [filtering capabilities](https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest):
-
-```bash
-dotnet test --filter "Name~Slogan"
-```
+Check out the [installation guide](./intro.mdx) to get started.
### Running MSTest tests in Parallel
@@ -406,7 +159,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestMethod]
public async Task TestWithCustomContextOptions()
diff --git a/dotnet/docs/trace-viewer-intro.mdx b/dotnet/docs/trace-viewer-intro.mdx
index 6268f376732..b3e3846e89b 100644
--- a/dotnet/docs/trace-viewer-intro.mdx
+++ b/dotnet/docs/trace-viewer-intro.mdx
@@ -12,7 +12,6 @@ Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright
**You will learn**
- How to record a trace
-- How to open the HTML report
- How to open the trace viewer
## Recording a trace
@@ -45,8 +44,6 @@ public class Tests : PageTest
[TearDown]
public async Task TearDown()
{
- // This will produce e.g.:
- // bin/Debug/net8.0/playwright-traces/PlaywrightTests.Tests.Test1.zip
await Context.Tracing.StopAsync(new()
{
Path = Path.Combine(
@@ -74,17 +71,17 @@ using System.Text.RegularExpressions;
using Microsoft.Playwright;
using Microsoft.Playwright.MSTest;
-namespace PlaywrightTestsMSTest;
+namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestInitialize]
public async Task TestInitialize()
{
await Context.Tracing.StartAsync(new()
{
- Title = TestContext.TestName,
+ Title = TestContext.CurrentContext.Test.ClassName + "." + TestContext.
Screenshots = true,
Snapshots = true,
Sources = true
@@ -94,20 +91,18 @@ public class UnitTest1 : PageTest
[TestCleanup]
public async Task TestCleanup()
{
- // This will produce e.g.:
- // bin/Debug/net8.0/playwright-traces/PlaywrightTests.UnitTest1.zip
await Context.Tracing.StopAsync(new()
{
Path = Path.Combine(
Environment.CurrentDirectory,
"playwright-traces",
- $"{TestContext.FullyQualifiedTestClassName}.zip"
+ $"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}.zip"
)
});
}
[TestMethod]
- public async Task TestYourOnlineShop()
+ public async Task GetStartedLink()
{
// ...
}
@@ -118,21 +113,18 @@ public class UnitTest1 : PageTest
-This will record the trace and place it into the `bin/Debug/net8.0/playwright-traces/` directory.
+This will record a zip file for each test, e.g. `PlaywrightTests.ExampleTest.GetStartedLink.zip` and place it into the `bin/Debug/net8.0/playwright-traces/` directory.
## Opening the trace
-You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located. This should include the `test-results` directory followed by the test name and then `trace.zip`.
+You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
```bash
-pwsh bin/Debug/netX/playwright.ps1 show-trace trace.zip
+pwsh bin/Debug/net8.0/playwright.ps1 show-trace bin/Debug/net8.0/playwright-traces/PlaywrightTests.ExampleTest.GetStartedLink.zip
```
-## Viewing the trace
-
-View traces of your test by clicking through each action or hovering using the timeline and see the state of the page before and after the action. Inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
-
-![playwright trace viewer](https://github.com/microsoft/playwright/assets/13063165/10fe3585-8401-4051-b1c2-b2e92ac4c274)
+######
+![playwright trace viewer dotnet](https://github.com/microsoft/playwright/assets/13063165/4372d661-5bfa-4e1f-be65-0d2fe165a75c)
To learn more check out our detailed guide on [Trace Viewer](/trace-viewer.mdx).
diff --git a/dotnet/docs/writing-tests.mdx b/dotnet/docs/writing-tests.mdx
index 980524c268a..203e57cba81 100644
--- a/dotnet/docs/writing-tests.mdx
+++ b/dotnet/docs/writing-tests.mdx
@@ -8,9 +8,26 @@ import HTMLCard from '@site/src/components/HTMLCard';
## Introduction
-Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met. Playwright comes with [auto-wait](./actionability.mdx) built in meaning it waits for elements to be actionable prior to performing actions. Playwright provides the [Expect](./test-assertions) function to write assertions.
+Playwright tests are simple, they
+- **perform actions**, and
+- **assert the state** against expectations.
-Take a look at the example test below to see how to write a test using using [locators](/locators.mdx) and web first assertions.
+There is no need to wait for anything prior to performing an action: Playwright automatically waits for the wide range of [actionability](./actionability.mdx) checks to pass prior to performing each action.
+
+There is also no need to deal with the race conditions when performing the checks - Playwright assertions are designed in a way that they describe the expectations that need to be eventually met.
+
+That's it! These design choices allow Playwright users to forget about flaky timeouts and racy checks in their tests altogether.
+
+**You will learn**
+- [How to write the first test](/writing-tests.mdx#first-test)
+- [How to perform actions](/writing-tests.mdx#actions)
+- [How to use assertions](/writing-tests.mdx#assertions)
+- [How tests run in isolation](/writing-tests.mdx#test-isolation)
+- [How to use test hooks](/writing-tests.mdx#using-test-hooks)
+
+## First test
+
+Take a look at the following example to see how to write a test.
@@ -27,30 +44,28 @@ namespace PlaywrightTests;
[Parallelizable(ParallelScope.Self)]
[TestFixture]
-public class Tests : PageTest
+public class ExampleTest : PageTest
{
[Test]
- public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
+ public async Task HasTitle()
{
await Page.GotoAsync("https://playwright.dev");
// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+ }
- // create a locator
- var getStarted = Page.GetByRole(AriaRole.Link, new() { Name = "Get started" });
-
- // Expect an attribute "to be strictly equal" to the value.
- await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/intro");
+ [Test]
+ public async Task GetStartedLink()
+ {
+ await Page.GotoAsync("https://playwright.dev");
// Click the get started link.
- await getStarted.ClickAsync();
+ await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
// Expects page to have a heading with the name of Installation.
- await Expect(Page
- .GetByRole(AriaRole.Heading, new() { Name = "Installation" }))
- .ToBeVisibleAsync();
- }
+ await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Installation" })).ToBeVisibleAsync();
+ }
}
```
@@ -68,28 +83,28 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestMethod]
- public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
+ public async Task HasTitle()
{
await Page.GotoAsync("https://playwright.dev");
// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+ }
- // create a locator
- var getStarted = Page.GetByRole(AriaRole.Link, new() { Name = "Get started" });
-
- // Expect an attribute "to be strictly equal" to the value.
- await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/intro");
+ [TestMethod]
+ public async Task GetStartedLink()
+ {
+ await Page.GotoAsync("https://playwright.dev");
// Click the get started link.
- await getStarted.ClickAsync();
+ await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
- // Expects the URL to contain intro.
- await Expect(Page).ToHaveURLAsync(new Regex(".*intro"));
- }
+ // Expects page to have a heading with the name of Installation.
+ await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Installation" })).ToBeVisibleAsync();
+ }
}
```
@@ -97,26 +112,76 @@ public class UnitTest1 : PageTest
-### Assertions
+## Actions
-Playwright provides an async function called [Expect](./test-assertions) to assert and wait until the expected condition is met.
+### Navigation
+
+Most of the tests will start by navigating the page to a URL. After that, the test will be able to interact with the page elements.
```csharp
-await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+await Page.GotoAsync("https://playwright.dev");
```
-### Locators
+Playwright will wait for the page to reach the load state prior to moving forward. Learn more about the [Page.GotoAsync()](/api/class-page.mdx#page-goto) options.
+
+### Interactions
-[Locators](./locators.mdx) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.ClickAsync` `.FillAsync` etc.
+Performing actions starts with locating the elements. Playwright uses [Locators API](./locators.mdx) for that. Locators represent a way to find element(s) on the page at any moment, learn more about the [different types](./locators.mdx) of locators available. Playwright will wait for the element to be [actionable](./actionability.mdx) prior to performing the action, so there is no need to wait for it to become available.
```csharp
+// Create a locator.
var getStarted = Page.GetByRole(AriaRole.Link, new() { Name = "Get started" });
-await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/installation");
+// Click it.
await getStarted.ClickAsync();
```
-### Test Isolation
+In most cases, it'll be written in one line:
+
+```csharp
+await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
+```
+
+### Basic actions
+
+This is the list of the most popular Playwright actions. Note that there are many more, so make sure to check the [Locator API](./api/class-locator.mdx) section to learn more about them.
+
+| Action | Description |
+| :- | :- |
+| [Locator.CheckAsync()](/api/class-locator.mdx#locator-check) | Check the input checkbox |
+| [Locator.ClickAsync()](/api/class-locator.mdx#locator-click) | Click the element |
+| [Locator.UncheckAsync()](/api/class-locator.mdx#locator-uncheck) | Uncheck the input checkbox |
+| [Locator.HoverAsync()](/api/class-locator.mdx#locator-hover) | Hover mouse over the element |
+| [Locator.FillAsync()](/api/class-locator.mdx#locator-fill) | Fill the form field, input text |
+| [Locator.FocusAsync()](/api/class-locator.mdx#locator-focus) | Focus the element |
+| [Locator.PressAsync()](/api/class-locator.mdx#locator-press) | Press single key |
+| [Locator.SetInputFilesAsync()](/api/class-locator.mdx#locator-set-input-files) | Pick files to upload |
+| [Locator.SelectOptionAsync()](/api/class-locator.mdx#locator-select-option) | Select option in the drop down |
+
+## Assertions
+
+Playwright provides an async function called [Expect](./test-assertions) to assert and wait until the expected condition is met.
+
+```csharp
+await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
+```
+
+Here is the list of the most popular async assertions. Note that there are [many more](./test-assertions.mdx) to get familiar with:
+
+| Assertion | Description |
+| :- | :- |
+| [Expect(Locator).ToBeCheckedAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-checked) | Checkbox is checked |
+| [Expect(Locator).ToBeEnabledAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-enabled) | Control is enabled |
+| [Expect(Locator).ToBeVisibleAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-visible) | Element is visible |
+| [Expect(Locator).ToContainTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-contain-text) | Element contains text |
+| [Expect(Locator).ToHaveAttributeAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) | Element has attribute |
+| [Expect(Locator).ToHaveCountAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) | List of elements has given length |
+| [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) | Element matches text |
+| [Expect(Locator).ToHaveValueAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-value) | Input element has value |
+| [Expect(Page).ToHaveTitleAsync()](/api/class-pageassertions.mdx#page-assertions-to-have-title) | Page has title |
+| [Expect(Page).ToHaveURLAsync()](/api/class-pageassertions.mdx#page-assertions-to-have-url) | Page has URL |
+
+## Test Isolation
The Playwright NUnit and MSTest test framework base classes will isolate each test from each other by providing a separate `Page` instance. Pages are isolated between tests due to the Browser Context, which is equivalent to a brand new browser profile, where every test gets a fresh environment, even when multiple tests run in a single Browser.
@@ -133,7 +198,7 @@ namespace PlaywrightTests;
[Parallelizable(ParallelScope.Self)]
[TestFixture]
-public class Tests : PageTest
+public class ExampleTest : PageTest
{
[Test]
public async Task BasicTest()
@@ -155,7 +220,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestMethod]
public async Task BasicTest()
@@ -169,7 +234,7 @@ public class UnitTest1 : PageTest
-### Using Test Hooks
+## Using Test Hooks
You can use `SetUp`/`TearDown` in NUnit or `TestInitialize`/`TestCleanup` in MSTest to prepare and clean up your test environment:
@@ -186,7 +251,7 @@ namespace PlaywrightTests;
[Parallelizable(ParallelScope.Self)]
[TestFixture]
-public class Tests : PageTest
+public class ExampleTest : PageTest
{
[Test]
public async Task MainNavigation()
@@ -215,7 +280,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PlaywrightTests;
[TestClass]
-public class UnitTest1 : PageTest
+public class ExampleTest : PageTest
{
[TestMethod]
public async Task MainNavigation()
@@ -240,6 +305,8 @@ public class UnitTest1 : PageTest
- [Run single test, multiple tests, headed mode](./running-tests.mdx)
- [Generate tests with Codegen](./codegen.mdx)
- [See a trace of your tests](./trace-viewer-intro.mdx)
+- [Run tests on CI](./ci-intro.mdx)
+- [Learn more about the NUnit and MSTest base classes](./test-runners.mdx)
[Accessibility]: /api/class-accessibility.mdx "Accessibility"
diff --git a/java/docs/api/class-apirequest.mdx b/java/docs/api/class-apirequest.mdx
index 7071d989b96..afaa8a5dc2c 100644
--- a/java/docs/api/class-apirequest.mdx
+++ b/java/docs/api/class-apirequest.mdx
@@ -48,6 +48,9 @@ APIRequest.newContext(options);
- `setOrigin` [String] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `setSendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `setIgnoreHTTPSErrors` [boolean] *(optional)*#
diff --git a/java/docs/api/class-browser.mdx b/java/docs/api/class-browser.mdx
index 79d84651d89..45800a4f832 100644
--- a/java/docs/api/class-browser.mdx
+++ b/java/docs/api/class-browser.mdx
@@ -211,6 +211,9 @@ browser.close();
- `setOrigin` [String] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `setSendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `setIgnoreHTTPSErrors` [boolean] *(optional)*#
@@ -391,6 +394,9 @@ Browser.newPage(options);
- `setOrigin` [String] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `setSendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `setIgnoreHTTPSErrors` [boolean] *(optional)*#
diff --git a/java/docs/api/class-browsertype.mdx b/java/docs/api/class-browsertype.mdx
index b759b1208f2..b80d8d07e41 100644
--- a/java/docs/api/class-browsertype.mdx
+++ b/java/docs/api/class-browsertype.mdx
@@ -351,6 +351,9 @@ BrowserType.launchPersistentContext(userDataDir, options);
- `setOrigin` [String] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `setSendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `setIgnoreAllDefaultArgs` [boolean] *(optional)* Added in: v1.9#
diff --git a/java/docs/ci-intro.mdx b/java/docs/ci-intro.mdx
index 84535218c27..a76c52e02c7 100644
--- a/java/docs/ci-intro.mdx
+++ b/java/docs/ci-intro.mdx
@@ -113,23 +113,22 @@ jobs:
Once you have your [GitHub actions workflow](#setting-up-github-actions) setup then all you need to do is [Create a repo on GitHub](https://docs.github.com/en/get-started/quickstart/create-a-repo) or push your code to an existing repository. Follow the instructions on GitHub and don't forget to [initialize a git repository](https://github.com/git-guides/git-init) using the `git init` command so you can [add](https://github.com/git-guides/git-add), [commit](https://github.com/git-guides/git-commit) and [push](https://github.com/git-guides/git-push) your code.
+######
## Opening the Workflows
Click on the **Actions** tab to see the workflows. Here you will see if your tests have passed or failed.
-
-
-On Pull Requests you can also click on the **Details** link in the [PR status check](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
-
-
+######
+![opening the workflow](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## Viewing Test Logs
Clicking on the workflow run will show you the all the actions that GitHub performed and clicking on **Run Playwright tests** will show the error messages, what was expected and what was received as well as the call log.
-
+######
+![Viewing Test Logs](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## Viewing the Trace
diff --git a/java/docs/trace-viewer-intro.mdx b/java/docs/trace-viewer-intro.mdx
index 7ddde4c96d7..377cd18eaff 100644
--- a/java/docs/trace-viewer-intro.mdx
+++ b/java/docs/trace-viewer-intro.mdx
@@ -12,7 +12,6 @@ Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright
**You will learn**
- How to record a trace
-- How to open the HTML report
- How to open the trace viewer
## Recording a trace
@@ -41,20 +40,15 @@ This will record the trace and place it into the file named `trace.zip`.
## Opening the trace
-You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located. This should include the `test-results` directory followed by the test name and then `trace.zip`.
+You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
```
-## Viewing the trace
-
-View traces of your test by clicking through each action or hovering using the timeline and see the state of the page before and after the action. Inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
-
+######
![playwright trace viewer](https://github.com/microsoft/playwright/assets/13063165/10fe3585-8401-4051-b1c2-b2e92ac4c274)
-To learn more check out our detailed guide on [Trace Viewer](/trace-viewer.mdx).
-
## What's next
- [Run tests on CI with GitHub Actions](/ci-intro.mdx)
- [Learn more about Trace Viewer](/trace-viewer.mdx)
diff --git a/nodejs/docs/api/class-androiddevice.mdx b/nodejs/docs/api/class-androiddevice.mdx
index 22f1aa44932..f71d9b585a3 100644
--- a/nodejs/docs/api/class-androiddevice.mdx
+++ b/nodejs/docs/api/class-androiddevice.mdx
@@ -253,6 +253,9 @@ await androidDevice.launchBrowser(options);
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreHTTPSErrors` [boolean] *(optional)*#
diff --git a/nodejs/docs/api/class-apirequest.mdx b/nodejs/docs/api/class-apirequest.mdx
index e60547c88aa..585d7f44cc2 100644
--- a/nodejs/docs/api/class-apirequest.mdx
+++ b/nodejs/docs/api/class-apirequest.mdx
@@ -48,6 +48,9 @@ await apiRequest.newContext(options);
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreHTTPSErrors` [boolean] *(optional)*#
diff --git a/nodejs/docs/api/class-browser.mdx b/nodejs/docs/api/class-browser.mdx
index 810c483f579..62f81d00a58 100644
--- a/nodejs/docs/api/class-browser.mdx
+++ b/nodejs/docs/api/class-browser.mdx
@@ -210,6 +210,9 @@ If directly using this method to create [BrowserContext]s, it is best practice t
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreHTTPSErrors` [boolean] *(optional)*#
@@ -458,6 +461,9 @@ await browser.newPage(options);
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreHTTPSErrors` [boolean] *(optional)*#
diff --git a/nodejs/docs/api/class-browsertype.mdx b/nodejs/docs/api/class-browsertype.mdx
index 346c9b48c19..fcb7459cc45 100644
--- a/nodejs/docs/api/class-browsertype.mdx
+++ b/nodejs/docs/api/class-browsertype.mdx
@@ -355,6 +355,9 @@ await browserType.launchPersistentContext(userDataDir, options);
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreDefaultArgs` [boolean]|[Array]<[string]> *(optional)*#
diff --git a/nodejs/docs/api/class-electron.mdx b/nodejs/docs/api/class-electron.mdx
index 4247eee22b7..1f509cc951e 100644
--- a/nodejs/docs/api/class-electron.mdx
+++ b/nodejs/docs/api/class-electron.mdx
@@ -119,6 +119,9 @@ await electron.launch(options);
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignoreHTTPSErrors` [boolean] *(optional)* Added in: v1.12#
diff --git a/nodejs/docs/api/class-testoptions.mdx b/nodejs/docs/api/class-testoptions.mdx
index 282bbd78463..e00a0671c3f 100644
--- a/nodejs/docs/api/class-testoptions.mdx
+++ b/nodejs/docs/api/class-testoptions.mdx
@@ -438,6 +438,9 @@ export default defineConfig({
- `origin` [string] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [boolean] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
---
diff --git a/nodejs/docs/ci-intro.mdx b/nodejs/docs/ci-intro.mdx
index b6689c27c78..df1b3476699 100644
--- a/nodejs/docs/ci-intro.mdx
+++ b/nodejs/docs/ci-intro.mdx
@@ -121,23 +121,22 @@ jobs:
Once you have your [GitHub actions workflow](#setting-up-github-actions) setup then all you need to do is [Create a repo on GitHub](https://docs.github.com/en/get-started/quickstart/create-a-repo) or push your code to an existing repository. Follow the instructions on GitHub and don't forget to [initialize a git repository](https://github.com/git-guides/git-init) using the `git init` command so you can [add](https://github.com/git-guides/git-add), [commit](https://github.com/git-guides/git-commit) and [push](https://github.com/git-guides/git-push) your code.
+######
## Opening the Workflows
Click on the **Actions** tab to see the workflows. Here you will see if your tests have passed or failed.
-
-
-On Pull Requests you can also click on the **Details** link in the [PR status check](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
-
-
+######
+![opening the workflow](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## Viewing Test Logs
Clicking on the workflow run will show you the all the actions that GitHub performed and clicking on **Run Playwright tests** will show the error messages, what was expected and what was received as well as the call log.
-
+######
+![Viewing Test Logs](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## HTML Report
diff --git a/python/docs/api/class-apirequest.mdx b/python/docs/api/class-apirequest.mdx
index d54c7892bbb..ad655b50037 100644
--- a/python/docs/api/class-apirequest.mdx
+++ b/python/docs/api/class-apirequest.mdx
@@ -47,6 +47,9 @@ api_request.new_context(**kwargs)
- `origin` [str] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [bool] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignore_https_errors` [bool] *(optional)*#
diff --git a/python/docs/api/class-browser.mdx b/python/docs/api/class-browser.mdx
index 40b2125e3cf..6b909c760d3 100644
--- a/python/docs/api/class-browser.mdx
+++ b/python/docs/api/class-browser.mdx
@@ -216,6 +216,9 @@ await browser.close()
- `origin` [str] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [bool] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignore_https_errors` [bool] *(optional)*#
@@ -433,6 +436,9 @@ browser.new_page(**kwargs)
- `origin` [str] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [bool] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignore_https_errors` [bool] *(optional)*#
diff --git a/python/docs/api/class-browsertype.mdx b/python/docs/api/class-browsertype.mdx
index 75bcc7bd541..3ff0332a8da 100644
--- a/python/docs/api/class-browsertype.mdx
+++ b/python/docs/api/class-browsertype.mdx
@@ -403,6 +403,9 @@ browser_type.launch_persistent_context(user_data_dir, **kwargs)
- `origin` [str] *(optional)*
Restrain sending http credentials on specific origin (scheme://host:port).
+ - `sendImmediately` [bool] *(optional)*
+
+ Whether to send `Authorization` header with the first API request. By deafult, the credentials are sent only when 401 (Unauthorized) response with `WWW-Authenticate` header is received. This option does not affect requests sent from the browser.
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
- `ignore_default_args` [bool]|[List]\[[str]\] *(optional)*#
diff --git a/python/docs/ci-intro.mdx b/python/docs/ci-intro.mdx
index c9ae97bd238..b0a55165c00 100644
--- a/python/docs/ci-intro.mdx
+++ b/python/docs/ci-intro.mdx
@@ -124,23 +124,22 @@ jobs:
Once you have your [GitHub actions workflow](#setting-up-github-actions) setup then all you need to do is [Create a repo on GitHub](https://docs.github.com/en/get-started/quickstart/create-a-repo) or push your code to an existing repository. Follow the instructions on GitHub and don't forget to [initialize a git repository](https://github.com/git-guides/git-init) using the `git init` command so you can [add](https://github.com/git-guides/git-add), [commit](https://github.com/git-guides/git-commit) and [push](https://github.com/git-guides/git-push) your code.
+######
## Opening the Workflows
Click on the **Actions** tab to see the workflows. Here you will see if your tests have passed or failed.
-
-
-On Pull Requests you can also click on the **Details** link in the [PR status check](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
-
-
+######
+![opening the workflow](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## Viewing Test Logs
Clicking on the workflow run will show you the all the actions that GitHub performed and clicking on **Run Playwright tests** will show the error messages, what was expected and what was received as well as the call log.
-
+######
+![Viewing Test Logs](https://user-images.githubusercontent.com/13063165/183423783-58bf2008-514e-4f96-9c12-c9a55703960c.png)
## Viewing the Trace
diff --git a/python/docs/trace-viewer-intro.mdx b/python/docs/trace-viewer-intro.mdx
index c579665d0ed..740951005f4 100644
--- a/python/docs/trace-viewer-intro.mdx
+++ b/python/docs/trace-viewer-intro.mdx
@@ -12,7 +12,6 @@ Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright
**You will learn**
- How to record a trace
-- How to open the HTML report
- How to open the trace viewer
## Recording a trace
@@ -82,20 +81,15 @@ await context.tracing.stop(path = "trace.zip")
## Opening the trace
-You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located. This should include the `test-results` directory followed by the test name and then `trace.zip`.
+You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
```bash
playwright show-trace trace.zip
```
-## Viewing the trace
-
-View traces of your test by clicking through each action or hovering using the timeline and see the state of the page before and after the action. Inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.
-
+######
![playwright trace viewer](https://github.com/microsoft/playwright/assets/13063165/10fe3585-8401-4051-b1c2-b2e92ac4c274)
-To learn more check out our detailed guide on [Trace Viewer](/trace-viewer.mdx).
-
## What's next
- [Run tests on CI with GitHub Actions](/ci-intro.mdx)
- [Learn more about Trace Viewer](/trace-viewer.mdx)