Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick: sync ToT docs #16680

Merged
merged 9 commits into from
Aug 19, 2022
2 changes: 1 addition & 1 deletion docs/src/api/class-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/src/browser-contexts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: browser-contexts
title: "Browser Contexts"
id: isolation
title: "Isolation"
---

<!-- TOC -->
Expand Down
4 changes: 2 additions & 2 deletions docs/src/ci-intro-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/src/intro-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ using Microsoft.Playwright.MSTest;

namespace PlaywrightTests;

[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
Expand Down
5 changes: 4 additions & 1 deletion docs/src/library-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/src/library-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <ol><li>Pick a browser to use (e.g. `chromium`)</li><li>Create `browser` ([`method: BrowserType.launch`])</li><li>Create a `context` ([`method: Browser.newContext`]), <em>and</em> pass any context options explcitly (e.g. `devices['iPhone 11']`</li><li>Create a `page` ([`method: BrowserContext.newPage`])</li></ol> | 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: <ul><li>[`method: PageAssertions.toHaveTitle`]</li><li>[`method: PageAssertions.toHaveScreenshot#1`]</li></ul> which auto-wait and retry for the condition to be met.|
Expand Down
4 changes: 3 additions & 1 deletion docs/src/test-advanced-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/src/trace-viewer-intro-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions docs/src/writing-tests-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ using Microsoft.Playwright.MSTest;

namespace PlaywrightTests;

[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
Expand Down Expand Up @@ -153,6 +154,7 @@ using Microsoft.Playwright.MSTest;

namespace PlaywrightTests;

[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
Expand Down Expand Up @@ -213,6 +215,7 @@ using Microsoft.Playwright.MSTest;

namespace PlaywrightTests;

[TestClass]
public class UnitTest1 : PageTest
{
[TestMethod]
Expand Down
8 changes: 4 additions & 4 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down