From c9e2a8b3407472b00575b5b75c8075710ab1c029 Mon Sep 17 00:00:00 2001
From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com>
Date: Fri, 19 Aug 2022 05:30:34 -0700
Subject: [PATCH] cherry-pick: sync ToT docs (#16680)
This PR cherry-picks the following commits:
- daee232e9e7620729ee632c18a6dd13dea5b0ff3
- 258170511557d3f5c1c1ed24b98046d24d2f8401
- f272ad23083aac71113b2d39f7755d1eb77c16f3
- c5f0265481d633fc2e171ee35e4aea7185044c34
- d7ba59270417e807e8823ccd4d138de5880a24ee
- cfe7af79e9ffc0dfd59567b2e380e6032336f3c6
- 411ec4479c1ece0edecf491c343969ec3cd845a5
- 00ba3051522b84e1ddd3ca5f75929ae6bdd6b2b4
- 14ac443c856bf87f4592a8d7795a4c3ffcdcbf14
---
docs/src/api/class-page.md | 2 +-
docs/src/browser-contexts.md | 4 ++--
docs/src/ci-intro-js.md | 4 ++--
docs/src/intro-csharp.md | 1 +
docs/src/library-csharp.md | 5 ++++-
docs/src/library-js.md | 1 +
docs/src/test-advanced-js.md | 4 +++-
docs/src/trace-viewer-intro-js.md | 2 +-
docs/src/writing-tests-csharp.md | 3 +++
packages/playwright-core/types/types.d.ts | 8 ++++----
10 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 747df53999..c54f6f9130 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -4162,7 +4162,7 @@ Returns when element specified by selector satisfies [`option: state`] option. R
:::note
Playwright automatically waits for element to be ready before performing an action. Using
-[Locator] objects and web-first assertions make the code wait-for-selector-free.
+[Locator] objects and web-first assertions makes the code wait-for-selector-free.
:::
Wait for the [`param: selector`] to satisfy [`option: state`] option (either appear/disappear from dom, or become
diff --git a/docs/src/browser-contexts.md b/docs/src/browser-contexts.md
index e54c5b6030..0fa80a8843 100644
--- a/docs/src/browser-contexts.md
+++ b/docs/src/browser-contexts.md
@@ -1,6 +1,6 @@
---
-id: browser-contexts
-title: "Browser Contexts"
+id: isolation
+title: "Isolation"
---
diff --git a/docs/src/ci-intro-js.md b/docs/src/ci-intro-js.md
index 9958177b36..9d81c35843 100644
--- a/docs/src/ci-intro-js.md
+++ b/docs/src/ci-intro-js.md
@@ -11,8 +11,8 @@ When installing Playwright you are given the option to add a [GitHub Actions](ht
- [How to create a repo and push to GitHub](#create-a-repo-and-push-to-github)
- [How to open the workflows](#opening-the-workflows)
- [How to view the test logs](#viewing-test-logs)
-- [How to download the report from GitHub](#downloading-the-playwright-report)
-- [How to view the report](#viewing-the-playwright-report)
+- [How to download the report from GitHub](#downloading-the-html-report)
+- [How to view the report](#viewing-the-html-report)
- [How to view the trace](#viewing-the-trace)
## GitHub Actions
diff --git a/docs/src/intro-csharp.md b/docs/src/intro-csharp.md
index 6f5aeb6a44..1fe8423baa 100644
--- a/docs/src/intro-csharp.md
+++ b/docs/src/intro-csharp.md
@@ -132,6 +132,7 @@ using Microsoft.Playwright.MSTest;
namespace PlaywrightTests;
+[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
diff --git a/docs/src/library-csharp.md b/docs/src/library-csharp.md
index e0f737c492..d0c4c69f6d 100644
--- a/docs/src/library-csharp.md
+++ b/docs/src/library-csharp.md
@@ -34,7 +34,10 @@ using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet");
-await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot.png" });
+await page.ScreenshotAsync(new()
+{
+ Path = "screenshot.png"
+});
```
Now run it.
diff --git a/docs/src/library-js.md b/docs/src/library-js.md
index e4925db6f9..3cebaadcb2 100644
--- a/docs/src/library-js.md
+++ b/docs/src/library-js.md
@@ -117,6 +117,7 @@ The key differences to note are as follows:
| | Library | Test |
| - | - | - |
| Installation | `npm install playwright` | `npm init playwright@latest` (note `install` vs. `init`) |
+| Install browsers | Chromium, Firefox, WebKit are installed by default | `npx playwright install` or `npx playwright install chromium` for a single one |
| `import`/`require` name | `playwright` | `@playwright/test` |
| Initialization | Explicitly need to:
- Pick a browser to use (e.g. `chromium`)
- Create `browser` ([`method: BrowserType.launch`])
- Create a `context` ([`method: Browser.newContext`]), and pass any context options explcitly (e.g. `devices['iPhone 11']`
- Create a `page` ([`method: BrowserContext.newPage`])
| An isolated `page` and `context` are provided to each test out-of the box (along with any other [built-in fixtures](./test-fixtures.md#built-in-fixtures)). No explicit creation. If referenced by the test in it's arguments, the Test Runner will create them for the test. (i.e. lazy-initialization) |
| Assertions | No built-in Web-First Assertions | [Web-First assertions](./test-assertions.md) like: - [`method: PageAssertions.toHaveTitle`]
- [`method: PageAssertions.toHaveScreenshot#1`]
which auto-wait and retry for the condition to be met.|
diff --git a/docs/src/test-advanced-js.md b/docs/src/test-advanced-js.md
index 3d7f35cd38..6c6f4ba166 100644
--- a/docs/src/test-advanced-js.md
+++ b/docs/src/test-advanced-js.md
@@ -681,7 +681,9 @@ test('numeric ranges', () => {
});
```
-For TypeScript, also add the following to `global.d.ts`. You don't need it for JavaScript.
+For TypeScript, also add the following to your [`global.d.ts`](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-d-ts.html). If it does not exist, you need to create it inside your repository. Make sure that your `global.d.ts` gets included inside your `tsconfig.json` via the `include` or `compilerOptions.typeRoots` option so that your IDE will pick it up.
+
+You don't need it for JavaScript.
```js
// global.d.ts
diff --git a/docs/src/trace-viewer-intro-js.md b/docs/src/trace-viewer-intro-js.md
index 8f04e7082a..8af91af2ec 100644
--- a/docs/src/trace-viewer-intro-js.md
+++ b/docs/src/trace-viewer-intro-js.md
@@ -14,7 +14,7 @@ Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright
## Recording a Trace
-By default the [playwright.config](/test-configuration.md#record-test-trace) file will contain the configuration needed to create a `trace.zip` file for each test. Traces are setup to run `on-first-retry` meaning they will be run on the first retry of a failed test. Also `retires` are set to 2 when running on CI and 0 locally. This means the traces will be recorded on the first retry of a failed test but not on the first run and not on the second retry.
+By default the [playwright.config](/test-configuration.md#record-test-trace) file will contain the configuration needed to create a `trace.zip` file for each test. Traces are setup to run `on-first-retry` meaning they will be run on the first retry of a failed test. Also `retries` are set to 2 when running on CI and 0 locally. This means the traces will be recorded on the first retry of a failed test but not on the first run and not on the second retry.
```js tab=js-js
// @ts-check
diff --git a/docs/src/writing-tests-csharp.md b/docs/src/writing-tests-csharp.md
index b3e3aed8c2..e9bb085a9d 100644
--- a/docs/src/writing-tests-csharp.md
+++ b/docs/src/writing-tests-csharp.md
@@ -58,6 +58,7 @@ using Microsoft.Playwright.MSTest;
namespace PlaywrightTests;
+[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
@@ -153,6 +154,7 @@ using Microsoft.Playwright.MSTest;
namespace PlaywrightTests;
+[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
@@ -213,6 +215,7 @@ using Microsoft.Playwright.MSTest;
namespace PlaywrightTests;
+[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index c85c16b037..3dd3062dbc 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -593,7 +593,7 @@ export interface Page {
* `detached`.
*
* > NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and
- * web-first assertions make the code wait-for-selector-free.
+ * web-first assertions makes the code wait-for-selector-free.
*
* Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
@@ -625,7 +625,7 @@ export interface Page {
* `detached`.
*
* > NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and
- * web-first assertions make the code wait-for-selector-free.
+ * web-first assertions makes the code wait-for-selector-free.
*
* Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
@@ -657,7 +657,7 @@ export interface Page {
* `detached`.
*
* > NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and
- * web-first assertions make the code wait-for-selector-free.
+ * web-first assertions makes the code wait-for-selector-free.
*
* Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
@@ -689,7 +689,7 @@ export interface Page {
* `detached`.
*
* > NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and
- * web-first assertions make the code wait-for-selector-free.
+ * web-first assertions makes the code wait-for-selector-free.
*
* Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the