From 8b0b09b9b0a1167719b6ea2353e0371fdb1b1102 Mon Sep 17 00:00:00 2001 From: jfgreffier Date: Sun, 11 Sep 2022 18:07:34 +0200 Subject: [PATCH 1/2] docs: fix migrations typos --- docs/src/protractor-js.md | 6 +++--- docs/src/puppeteer-js.md | 10 +++++----- docs/src/testing-library-js.md | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/src/protractor-js.md b/docs/src/protractor-js.md index 47527c3da651d..ee10ab7596f77 100644 --- a/docs/src/protractor-js.md +++ b/docs/src/protractor-js.md @@ -140,18 +140,18 @@ Here's how to polyfill `waitForAngular` function in Playwright Test: await page.goto('https://example.org'); await waitForAngular(page); ``` - + ## Playwright Test Super Powers Once you're on Playwright Test, you get a lot! - Full zero-configuration TypeScript support -- Run tests across **all web engines** (Chrome, Firefox, Safari) on **any popular operating system** (Windows, MacOS, Ubuntu) +- Run tests across **all web engines** (Chrome, Firefox, Safari) on **any popular operating system** (Windows, macOS, Ubuntu) - Full support for multiple origins, [(i)frames](./api/class-frame), [tabs and contexts](./pages) - Run tests in parallel across multiple browsers - Built-in test artifact collection: [video recording](./test-configuration#record-video), [screenshots](./test-configuration#automatic-screenshots) and [playwright traces](./test-configuration#record-test-trace) -Also you get all these ✨ awesome tools ✨ that come bundled with Playwright Test: +You also get all these ✨ awesome tools ✨ that come bundled with Playwright Test: - [Playwright Inspector](./debug.md) - [Playwright Test Code generation](./auth#code-generation) - [Playwright Tracing](./trace-viewer) for post-mortem debugging diff --git a/docs/src/puppeteer-js.md b/docs/src/puppeteer-js.md index f8511aa8aed03..da946845b5489 100644 --- a/docs/src/puppeteer-js.md +++ b/docs/src/puppeteer-js.md @@ -43,9 +43,9 @@ This guide describes migration to [Playwright Library](./library) and [Playwrigh `page.waitForNavigation` and `page.waitForSelector` remain, but in many cases will not be necessary due to [auto-waiting](./actionability). -The use of [ElementHandle] is discouraged , use [Locator] objects and web-first assertions instead. +The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead. -Locators are the central piece of Playwright's auto-waiting and retry-ability. Locators are strict. This means that all operations on locators that imply some target DOM element will throw an exception if more than one element matches given selector. +Locators are the central piece of Playwright's auto-waiting and retry-ability. Locators are strict. This means that all operations on locators that imply some target DOM element will throw an exception if more than one element matches a given selector. ## Examples @@ -90,7 +90,7 @@ Migration highlights (see inline comments in the Playwright code snippet): 1. Each Playwright Library file has explicit import of `chromium`. Other browsers `webkit` or `firefox` can be used. 1. For browser state isolation, consider [browser contexts](./browser-contexts.md) 1. `setViewport` becomes `setViewportSize` -1. `networkidle2` becomes `networkidle`. Please note that on most cases it is not useful, thanks to auto-waiting. +1. `networkidle2` becomes `networkidle`. Please note that in most cases it is not useful, thanks to auto-waiting. ### Test example @@ -145,7 +145,7 @@ Playwright Test creates an isolated [Page] object for each test. However, if you With a few lines of code, you can hook up Playwright to your existing JavaScript [test runner](./test-runners). -To improve testing, it is adviced to use [Locators](./api/class-locator) and web-first [Assertions](./test-assertions). See [Writing Tests](./writing-tests) +To improve testing, it is advised to use [Locators](./api/class-locator) and web-first [Assertions](./test-assertions). See [Writing Tests](./writing-tests) It is common with Puppeteer to use `page.evaluate()` or `page.$eval()` to inspect an [ElementHandle] and extract the value of text content, attribute, class... Web-first [Assertions](./test-assertions) offers several matchers for this purpose, it is more reliable and readable. @@ -161,7 +161,7 @@ Once you're on Playwright Test, you get a lot! - Run tests in isolation in parallel across multiple browsers - Built-in test artifact collection: [video recording](./test-configuration#record-video), [screenshots](./test-configuration#automatic-screenshots) and [playwright traces](./test-configuration#record-test-trace) -Also you get all these ✨ awesome tools ✨ that come bundled with Playwright Test: +You also get all these ✨ awesome tools ✨ that come bundled with Playwright Test: - [Playwright Inspector](./debug.md) - [Playwright Test Code generation](./auth#code-generation) - [Playwright Tracing](./trace-viewer) for post-mortem debugging diff --git a/docs/src/testing-library-js.md b/docs/src/testing-library-js.md index 148ac5840bae0..33fc2f01a89e2 100644 --- a/docs/src/testing-library-js.md +++ b/docs/src/testing-library-js.md @@ -83,7 +83,7 @@ Migration highlights (see inline comments in the Playwright Test code snippet): ## Migrating queries -All queries like `getBy...`, `findBy...`, `queryBy...` and their multi-element counterparts are replaced with `page.locator('...')`. Locators always auto-wait and retry when needed, so you don't have to worry about choosing the right method. When you want to do a [list operation](./locators#lists), e.g. assert a list of texts, Playwright automatically performs multi-element opertations. +All queries like `getBy...`, `findBy...`, `queryBy...` and their multi-element counterparts are replaced with `page.locator('...')`. Locators always auto-wait and retry when needed, so you don't have to worry about choosing the right method. When you want to do a [list operation](./locators#lists), e.g. assert a list of texts, Playwright automatically performs multi-element operations. 1. `getByRole`: use [role selector](./selectors#role-selector) `component.locator('role=button[name="Sign up"]')`. 1. `getByText`: use `component.locator('text=some value')` and other variations of the [text selector](./selectors#text-selector). @@ -141,7 +141,7 @@ Once you're on Playwright Test, you get a lot! - Run tests in isolation in parallel across multiple browsers - Built-in test artifact collection: [video recording](./test-configuration#record-video), [screenshots](./test-configuration#automatic-screenshots) and [playwright traces](./test-configuration#record-test-trace) -Also you get all these ✨ awesome tools ✨ that come bundled with Playwright Test: +You also get all these ✨ awesome tools ✨ that come bundled with Playwright Test: - [Playwright Inspector](./debug.md) - [Playwright Test Code generation](./auth#code-generation) - [Playwright Tracing](./trace-viewer) for post-mortem debugging From 0cf2b0e0aec809444da9fc9375f602c1183eed0f Mon Sep 17 00:00:00 2001 From: jfgreffier Date: Sun, 11 Sep 2022 18:09:12 +0200 Subject: [PATCH 2/2] docs: fix typos --- docs/src/api/class-framelocator.md | 2 +- docs/src/mock-js.md | 5 ++--- packages/playwright-core/types/types.d.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/src/api/class-framelocator.md b/docs/src/api/class-framelocator.md index 96bdb5cd376d7..a73520a8b686d 100644 --- a/docs/src/api/class-framelocator.md +++ b/docs/src/api/class-framelocator.md @@ -30,7 +30,7 @@ await locator.ClickAsync(); **Strictness** -Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches given selector. +Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches a given selector. ```js // Throws if there are several frames in DOM: diff --git a/docs/src/mock-js.md b/docs/src/mock-js.md index ce8726ad3fbd1..4510ac4bba638 100644 --- a/docs/src/mock-js.md +++ b/docs/src/mock-js.md @@ -5,7 +5,7 @@ title: "Mock APIs" Playwright provides native support for most of the browser features. However, there are some experimental APIs and APIs which are not (yet) fully supported by all browsers. Playwright usually doesn't provide dedicated -automation APIs in such cases. You can use mocks to test behavior of your application in such cases. This guide +automation APIs in such cases. You can use mocks to test the behavior of your application in such cases. This guide gives a few examples. @@ -18,8 +18,7 @@ battery status. ## Creating mocks -Since the page may be calling the API very early while loading it's important to setup all the mocks before the -page started loading. The easiest way to achieve that is to call [`method: Page.addInitScript`]: +Since the page may be calling the API very early while loading it's important to setup all the mocks before the page started loading. The easiest way to achieve that is to call [`method: Page.addInitScript`]: ```js await page.addInitScript(() => { diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 06013c0769343..d3f93e89a4f78 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -14499,7 +14499,7 @@ export interface FileChooser { * **Strictness** * * Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches - * given selector. + * a given selector. * * ```js * // Throws if there are several frames in DOM: