From bb2a2c73313f7da375e891eb4c5550cf4b5c5c12 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 20 Dec 2022 16:19:07 +0100 Subject: [PATCH] fix: render discouraged / deprecated types (#19596) Fixes https://github.com/microsoft/playwright/issues/19591 --- docs/src/api/class-timeouterror.md | 3 +- packages/playwright-core/types/types.d.ts | 312 +++++++++++++++------- utils/doclint/documentation.js | 11 +- 3 files changed, 217 insertions(+), 109 deletions(-) diff --git a/docs/src/api/class-timeouterror.md b/docs/src/api/class-timeouterror.md index 8fcfd3634b3fc..0ac64e52ac4e3 100644 --- a/docs/src/api/class-timeouterror.md +++ b/docs/src/api/class-timeouterror.md @@ -2,8 +2,7 @@ * since: v1.8 * extends: [Error] -TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`method: -Locator.waitFor`] or [`method: BrowserType.launch`]. +TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`method: Locator.waitFor`] or [`method: BrowserType.launch`]. ```js const playwright = require('playwright'); diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index c23bec9fca5ae..c00b3acedb634 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -286,7 +286,8 @@ export interface Page { addInitScript(script: PageFunction | { path?: string, content?: string }, arg?: Arg): Promise; /** - * **NOTE** Use locator-based [`method: Page.locator`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * The method finds an element matching the specified selector within the page. If no elements match the selector, the * return value resolves to `null`. To wait for an element on the page, use @@ -296,7 +297,8 @@ export interface Page { */ $(selector: K, options?: { strict: boolean }): Promise | null>; /** - * **NOTE** Use locator-based [`method: Page.locator`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * The method finds an element matching the specified selector within the page. If no elements match the selector, the * return value resolves to `null`. To wait for an element on the page, use @@ -307,7 +309,8 @@ export interface Page { $(selector: string, options?: { strict: boolean }): Promise | null>; /** - * **NOTE** Use locator-based [`method: Page.locator`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * The method finds all elements matching the specified selector within the page. If no elements match the selector, * the return value resolves to `[]`. @@ -315,7 +318,8 @@ export interface Page { */ $$(selector: K): Promise[]>; /** - * **NOTE** Use locator-based [`method: Page.locator`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * The method finds all elements matching the specified selector within the page. If no elements match the selector, * the return value resolves to `[]`. @@ -325,7 +329,9 @@ export interface Page { /** * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. - * Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead. + * Use + * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), + * other [Locator] helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. @@ -352,7 +358,9 @@ export interface Page { $eval(selector: K, pageFunction: PageFunctionOn, arg: Arg): Promise; /** * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. - * Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead. + * Use + * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), + * other [Locator] helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. @@ -379,7 +387,9 @@ export interface Page { $eval(selector: string, pageFunction: PageFunctionOn, arg: Arg): Promise; /** * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. - * Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead. + * Use + * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), + * other [Locator] helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. @@ -406,7 +416,9 @@ export interface Page { $eval(selector: K, pageFunction: PageFunctionOn, arg?: any): Promise; /** * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. - * Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead. + * Use + * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), + * other [Locator] helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. @@ -433,8 +445,9 @@ export interface Page { $eval(selector: string, pageFunction: PageFunctionOn, arg?: any): Promise; /** - * **NOTE** In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better - * job. + * **NOTE** In most cases, + * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), + * other [Locator] helper methods and web-first assertions do a better job. * * The method finds all elements matching the specified selector within the page and passes an array of matched * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. @@ -455,8 +468,9 @@ export interface Page { */ $$eval(selector: K, pageFunction: PageFunctionOn, arg: Arg): Promise; /** - * **NOTE** In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better - * job. + * **NOTE** In most cases, + * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), + * other [Locator] helper methods and web-first assertions do a better job. * * The method finds all elements matching the specified selector within the page and passes an array of matched * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. @@ -477,8 +491,9 @@ export interface Page { */ $$eval(selector: string, pageFunction: PageFunctionOn, arg: Arg): Promise; /** - * **NOTE** In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better - * job. + * **NOTE** In most cases, + * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), + * other [Locator] helper methods and web-first assertions do a better job. * * The method finds all elements matching the specified selector within the page and passes an array of matched * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. @@ -499,8 +514,9 @@ export interface Page { */ $$eval(selector: K, pageFunction: PageFunctionOn, arg?: any): Promise; /** - * **NOTE** In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better - * job. + * **NOTE** In most cases, + * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), + * other [Locator] helper methods and web-first assertions do a better job. * * The method finds all elements matching the specified selector within the page and passes an array of matched * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. @@ -1797,7 +1813,8 @@ export interface Page { bringToFront(): Promise; /** - * **NOTE** Use locator-based [`method: Locator.check`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead. + * Read more about [locators](https://playwright.dev/docs/locators). * * This method checks an element matching `selector` by performing the following steps: * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. @@ -1862,7 +1879,8 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.click`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead. + * Read more about [locators](https://playwright.dev/docs/locators). * * This method clicks an element matching `selector` by performing the following steps: * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. @@ -1980,7 +1998,8 @@ export interface Page { coverage: Coverage; /** - * **NOTE** Use locator-based [`method: Locator.dblclick`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.dblclick([options])](https://playwright.dev/docs/api/class-locator#locator-dblclick) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * This method double clicks an element matching `selector` by performing the following steps: * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. @@ -2061,7 +2080,9 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.dispatchEvent`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based + * [locator.dispatchEvent(type[, eventInit, options])](https://playwright.dev/docs/api/class-locator#locator-dispatch-event) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, * `click` is dispatched. This is equivalent to calling @@ -2298,7 +2319,8 @@ export interface Page { exposeFunction(name: string, callback: Function): Promise; /** - * **NOTE** Use locator-based [`method: Locator.fill`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/docs/actionability) checks, * focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string @@ -2345,7 +2367,8 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.focus`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.focus([options])](https://playwright.dev/docs/api/class-locator#locator-focus) instead. + * Read more about [locators](https://playwright.dev/docs/locators). * * This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the * method waits until a matching element appears in the DOM. @@ -2420,7 +2443,9 @@ export interface Page { frames(): Array; /** - * **NOTE** Use locator-based [`method: Locator.getAttribute`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based + * [locator.getAttribute(name[, options])](https://playwright.dev/docs/api/class-locator#locator-get-attribute) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * Returns element attribute value. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be @@ -2779,7 +2804,8 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.hover`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.hover([options])](https://playwright.dev/docs/api/class-locator#locator-hover) instead. + * Read more about [locators](https://playwright.dev/docs/locators). * * This method hovers over an element matching `selector` by performing the following steps: * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. @@ -2847,7 +2873,8 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.innerHTML`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.innerHTML([options])](https://playwright.dev/docs/api/class-locator#locator-inner-html) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * Returns `element.innerHTML`. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be @@ -2871,7 +2898,8 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.innerText`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based [locator.innerText([options])](https://playwright.dev/docs/api/class-locator#locator-inner-text) + * instead. Read more about [locators](https://playwright.dev/docs/locators). * * Returns `element.innerText`. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be @@ -2895,7 +2923,9 @@ export interface Page { }): Promise; /** - * **NOTE** Use locator-based [`method: Locator.inputValue`] instead. Read more about [locators](https://playwright.dev/docs/locators). + * **NOTE** Use locator-based + * [locator.inputValue([options])](https://playwright.dev/docs/api/class-locator#locator-input-value) instead. Read + * more about [locators](https://playwright.dev/docs/locators). * * Returns `input.value` for the selected `` or `