From 26bdc80b24fac950cf7f18f1264f0c9858bc22a3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:06:22 +0000 Subject: [PATCH] feat(roll): roll to ToT Playwright (03-07-24) --- dotnet/docs/api/class-clock.mdx | 12 ++++++++---- java/docs/api/class-clock.mdx | 6 +++++- nodejs/docs/api/class-clock.mdx | 6 +++++- nodejs/docs/ci-intro.mdx | 2 +- nodejs/docs/ci.mdx | 18 +++++++++--------- nodejs/docs/docker.mdx | 16 ++++++++-------- nodejs/docs/test-annotations.mdx | 2 +- python/docs/api/class-clock.mdx | 12 ++++++++---- src/documentation.js | 30 ++++++++++++++++-------------- src/markdown.js | 20 ++++++++++---------- 10 files changed, 71 insertions(+), 53 deletions(-) diff --git a/dotnet/docs/api/class-clock.mdx b/dotnet/docs/api/class-clock.mdx index 42d4ebb6f9f..93eddd8993b 100644 --- a/dotnet/docs/api/class-clock.mdx +++ b/dotnet/docs/api/class-clock.mdx @@ -65,7 +65,7 @@ await Clock.InstallAsync(options); **Arguments** - `options` `ClockInstallOptions?` *(optional)* - - `TimeInt64|Time|TimeDate` [long]? | [string]? | [Date]? *(optional)*# + - `Time|TimeDate` [string]? | [Date]? *(optional)*# Time to initialize with, current system time by default. @@ -90,7 +90,9 @@ await page.Clock.PauseAtAsync("2020-02-02"); ``` **Arguments** -- `time` [long] | [string] | [Date]# +- `time` [Date] | [string]# + + Time to pause at. **Returns** - [void]# @@ -152,7 +154,7 @@ await page.Clock.SetFixedTimeAsync("2020-02-02"); ``` **Arguments** -- `time` [long] | [string] | [Date]# +- `time` [string] | [Date]# Time to be set. @@ -176,7 +178,9 @@ await page.Clock.SetSystemTimeAsync("2020-02-02"); ``` **Arguments** -- `time` [long] | [string] | [Date]# +- `time` [string] | [Date]# + + Time to be set. **Returns** - [void]# diff --git a/java/docs/api/class-clock.mdx b/java/docs/api/class-clock.mdx index 547035db557..c35bdecb0cf 100644 --- a/java/docs/api/class-clock.mdx +++ b/java/docs/api/class-clock.mdx @@ -93,6 +93,8 @@ page.clock().pauseAt("2020-02-02"); **Arguments** - `time` [long] | [String] | [Date]# + + Time to pause at. **Returns** - [void]# @@ -156,7 +158,7 @@ page.clock().setFixedTime("2020-02-02"); **Arguments** - `time` [long] | [String] | [Date]# - Time to be set. + Time to be set in milliseconds. **Returns** - [void]# @@ -179,6 +181,8 @@ page.clock().setSystemTime("2020-02-02"); **Arguments** - `time` [long] | [String] | [Date]# + + Time to be set in milliseconds. **Returns** - [void]# diff --git a/nodejs/docs/api/class-clock.mdx b/nodejs/docs/api/class-clock.mdx index a35f68a8ffb..a13afe21308 100644 --- a/nodejs/docs/api/class-clock.mdx +++ b/nodejs/docs/api/class-clock.mdx @@ -92,6 +92,8 @@ await page.clock.pauseAt('2020-02-02'); **Arguments** - `time` [long] | [string] | [Date]# + + Time to pause at. **Returns** - [Promise]<[void]># @@ -155,7 +157,7 @@ await page.clock.setFixedTime('2020-02-02'); **Arguments** - `time` [long] | [string] | [Date]# - Time to be set. + Time to be set in milliseconds. **Returns** - [Promise]<[void]># @@ -178,6 +180,8 @@ await page.clock.setSystemTime('2020-02-02'); **Arguments** - `time` [long] | [string] | [Date]# + + Time to be set in milliseconds. **Returns** - [Promise]<[void]># diff --git a/nodejs/docs/ci-intro.mdx b/nodejs/docs/ci-intro.mdx index 3a1b9559b75..f5b75ecbbdf 100644 --- a/nodejs/docs/ci-intro.mdx +++ b/nodejs/docs/ci-intro.mdx @@ -75,7 +75,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright:v1.45.0-jammy + image: mcr.microsoft.com/playwright:v1.45.1-jammy steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/nodejs/docs/ci.mdx b/nodejs/docs/ci.mdx index 829b43485ac..192e70432ab 100644 --- a/nodejs/docs/ci.mdx +++ b/nodejs/docs/ci.mdx @@ -206,7 +206,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright:v1.45.0-jammy +container: mcr.microsoft.com/playwright:v1.45.1-jammy steps: - task: NodeTool@0 @@ -230,7 +230,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-jammy-development: docker: - - image: mcr.microsoft.com/playwright:v1.45.0-jammy + - image: mcr.microsoft.com/playwright:v1.45.1-jammy ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -253,7 +253,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright:v1.45.0-jammy' } } + agent { docker { image 'mcr.microsoft.com/playwright:v1.45.1-jammy' } } stages { stage('e2e-tests') { steps { @@ -270,7 +270,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright:v1.45.0-jammy +image: mcr.microsoft.com/playwright:v1.45.1-jammy ``` ### GitLab CI @@ -283,7 +283,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.45.0-jammy + image: mcr.microsoft.com/playwright:v1.45.1-jammy script: ... ``` @@ -298,7 +298,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.45.0-jammy + image: mcr.microsoft.com/playwright:v1.45.1-jammy parallel: 7 script: - npm ci @@ -313,7 +313,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.45.0-jammy + image: mcr.microsoft.com/playwright:v1.45.1-jammy parallel: matrix: - PROJECT: ['chromium', 'webkit'] @@ -329,7 +329,7 @@ To run Playwright tests on Google Cloud Build, use our public Docker image ([see ```yml steps: -- name: mcr.microsoft.com/playwright:v1.45.0-jammy +- name: mcr.microsoft.com/playwright:v1.45.1-jammy script: ... env: @@ -347,7 +347,7 @@ type: docker steps: - name: test - image: mcr.microsoft.com/playwright:v1.45.0-jammy + image: mcr.microsoft.com/playwright:v1.45.1-jammy commands: - npx playwright test ``` diff --git a/nodejs/docs/docker.mdx b/nodejs/docs/docker.mdx index 7d226f90452..c01beaf971c 100644 --- a/nodejs/docs/docker.mdx +++ b/nodejs/docs/docker.mdx @@ -21,7 +21,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright:v1.45.0-jammy +docker pull mcr.microsoft.com/playwright:v1.45.1-jammy ``` ### Run the image @@ -33,7 +33,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.45.0-jammy /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.45.1-jammy /bin/bash ``` #### Crawling and scraping @@ -41,7 +41,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.45.0-jammy /bin/b On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.45.0-jammy /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.45.1-jammy /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -76,10 +76,10 @@ See [all available image tags]. We currently publish images with the following tags: - `:next` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish). - `:next-jammy` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish). -- `:v1.45.0` - Playwright v1.45.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). -- `:v1.45.0-noble` - Playwright v1.45.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.45.0-jammy` - Playwright v1.45.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). -- `:v1.45.0-focal` - Playwright v1.45.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa). +- `:v1.45.1` - Playwright v1.45.1 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.45.1-noble` - Playwright v1.45.1 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.45.1-jammy` - Playwright v1.45.1 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.45.1-focal` - Playwright v1.45.1 release docker image based on Ubuntu 20.04 LTS (Focal Fossa). :::note It is recommended to always pin your Docker image to a specific version if possible. If the Playwright version in your Docker image does not match the version in your project/tests, Playwright will be unable to locate browser executables. @@ -103,7 +103,7 @@ To run Playwright inside Docker, you need to have Node.js, [Playwright browsers] ```Dockerfile FROM node:20-bookworm -RUN npx -y playwright@1.45.0 install --with-deps +RUN npx -y playwright@1.45.1 install --with-deps ``` diff --git a/nodejs/docs/test-annotations.mdx b/nodejs/docs/test-annotations.mdx index b47471949e6..f0a2334bd40 100644 --- a/nodejs/docs/test-annotations.mdx +++ b/nodejs/docs/test-annotations.mdx @@ -220,7 +220,7 @@ You can also filter tests in the configuration file via [testConfig.grep](/api/c ## Annotate tests -If you would like to annotate your tests with something more substantial than a tag, you can do that when declaring a test. Annotations have a `type` and a `description` for more context, and will be visible in the test report. +If you would like to annotate your tests with something more substantial than a tag, you can do that when declaring a test. Annotations have a `type` and a `description` for more context and available in reporter API. Playwright's built-in HTML reporter shows all annotations, except those where `type` starts with `_` symbol. For example, to annotate a test with an issue url: diff --git a/python/docs/api/class-clock.mdx b/python/docs/api/class-clock.mdx index c5f13498b54..e86f9d14bbe 100644 --- a/python/docs/api/class-clock.mdx +++ b/python/docs/api/class-clock.mdx @@ -86,7 +86,7 @@ clock.install(**kwargs) ``` **Arguments** -- `time` [long] | [str] | [Date] *(optional)*# +- `time` [float] | [str] | [Date] *(optional)*# Time to initialize with, current system time by default. @@ -132,7 +132,9 @@ await page.clock.pause_at("2020-02-02") **Arguments** -- `time` [long] | [str] | [Date]# +- `time` [float] | [str] | [Date]# + + Time to pause at. **Returns** - [NoneType]# @@ -237,7 +239,7 @@ await page.clock.set_fixed_time("2020-02-02") **Arguments** -- `time` [long] | [str] | [Date]# +- `time` [float] | [str] | [Date]# Time to be set. @@ -283,7 +285,9 @@ await page.clock.set_system_time("2020-02-02") **Arguments** -- `time` [long] | [str] | [Date]# +- `time` [float] | [str] | [Date]# + + Time to be set. **Returns** - [NoneType]# diff --git a/src/documentation.js b/src/documentation.js index a3912c23b03..b79069b858c 100644 --- a/src/documentation.js +++ b/src/documentation.js @@ -167,7 +167,7 @@ class Documentation { renderLinksInNodes(nodes, classOrMember) { if (classOrMember instanceof Member) { classOrMember.discouraged = classOrMember.discouraged ? this.renderLinksInText(classOrMember.discouraged, classOrMember) : undefined; - classOrMember.deprecated = classOrMember.deprecated ? this.renderLinksInText(classOrMember.deprecated, classOrMember) : undefined + classOrMember.deprecated = classOrMember.deprecated ? this.renderLinksInText(classOrMember.deprecated, classOrMember) : undefined; } md.visitAll(nodes, node => { if (!node.text) @@ -208,7 +208,7 @@ class Documentation { } } - class Class { +class Class { /** * @param {Metainfo} metainfo * @param {string} name @@ -322,7 +322,7 @@ class Documentation { for (const e of this.eventsArray) e.visit(visitor); } -}; +} class Member { /** @@ -345,7 +345,7 @@ class Member { this.spec = spec; this.argsArray = argsArray; this.required = required; - this.comment = ''; + this.comment = ''; /** @type {!Map} */ this.args = new Map(); this.index(); @@ -473,8 +473,10 @@ class Member { this.type.visit(visitor); for (const arg of this.argsArray) arg.visit(visitor); + for (const lang in this.langs.overrides || {}) + this.langs.overrides?.[lang].visit(visitor); } -}; +} class Type { /** @@ -509,9 +511,9 @@ class Type { * @return {Type} */ static fromParsedType(parsedType, inUnion = false) { - if (!inUnion && !parsedType.unionName && isStringUnion(parsedType) ) { + if (!inUnion && !parsedType.unionName && isStringUnion(parsedType)) throw new Error('Enum must have a name:\n' + JSON.stringify(parsedType, null, 2)); - } + if (!inUnion && (parsedType.union || parsedType.unionName)) { const type = new Type(parsedType.unionName || ''); @@ -556,15 +558,15 @@ class Type { /** @type {Member[] | undefined} */ this.properties = this.name === 'Object' ? properties : undefined; /** @type {Type[] | undefined} */ - this.union; + this.union = undefined; /** @type {Type[] | undefined} */ - this.args; + this.args = undefined; /** @type {Type | undefined} */ - this.returnType; + this.returnType = undefined; /** @type {Type[] | undefined} */ - this.templates; + this.templates = undefined; /** @type {string | undefined} */ - this.expression; + this.expression = undefined; } visit(visitor) { @@ -645,7 +647,7 @@ class Type { if (this.returnType) this.returnType._collectAllTypes(result); } -}; +} /** * @param {ParsedType | null} type @@ -931,7 +933,7 @@ function processCodeGroups(spec, language, transformer) { * @param {string} codeLang * @return {{ highlighter: string, language: string|undefined, codeGroup: string|undefined}} */ - function parseCodeLang(codeLang) { +function parseCodeLang(codeLang) { if (codeLang === 'python async') return { highlighter: 'py', codeGroup: 'python-async', language: 'python' }; if (codeLang === 'python sync') diff --git a/src/markdown.js b/src/markdown.js index 77e7343426e..77a405192ce 100644 --- a/src/markdown.js +++ b/src/markdown.js @@ -124,7 +124,7 @@ function buildTree(lines) { const headerStack = [root]; /** @type {{ indent: string, node: MarkdownNode }[]} */ - let sectionStack = []; + const sectionStack = []; /** * @param {string} indent @@ -133,7 +133,7 @@ function buildTree(lines) { const appendNode = (indent, node) => { while (sectionStack.length && sectionStack[0].indent.length >= indent.length) sectionStack.shift(); - const parentNode = sectionStack.length ? sectionStack[0].node :headerStack[0]; + const parentNode = sectionStack.length ? sectionStack[0].node : headerStack[0]; if (!parentNode.children) parentNode.children = []; parentNode.children.push(node); @@ -176,7 +176,7 @@ function buildTree(lines) { line = lines[++i]; while (!line.trim().startsWith('```')) { if (line && !line.startsWith(indent)) { - const from = Math.max(0, i - 5) + const from = Math.max(0, i - 5); const to = Math.min(lines.length, from + 10); const snippet = lines.slice(from, to); throw new Error(`Bad code block: ${snippet.join('\n')}`); @@ -200,7 +200,7 @@ function buildTree(lines) { const tokens = []; while (!line.trim().startsWith(':::')) { if (!line.startsWith(indent)) { - const from = Math.max(0, i - 5) + const from = Math.max(0, i - 5); const to = Math.min(lines.length, from + 10); const snippet = lines.slice(from, to); throw new Error(`Bad comment block: ${snippet.join('\n')}`); @@ -254,7 +254,7 @@ function buildTree(lines) { } /** - * @param {String} firstLine + * @param {String} firstLine * @returns {[string, string|undefined]} */ function parseCodeBlockMetadata(firstLine) { @@ -279,7 +279,7 @@ function parse(content) { function render(nodes, options) { const result = []; let lastNode; - for (let node of nodes) { + for (const node of nodes) { if (node.type === 'null') continue; innerRenderMdNode('', node, /** @type {MarkdownNode} */ (lastNode), result, options); @@ -322,7 +322,7 @@ function innerRenderMdNode(indent, node, lastNode, result, options) { const bothLinks = node.text.match(/\[[^\]]+\]:/) && lastNode && lastNode.type === 'text' && lastNode.text.match(/\[[^\]]+\]:/); if (!bothTables && !bothGen && !bothComments && !bothLinks && lastNode && lastNode.text) newLine(); - result.push(wrapText(node.text, options, indent)); + result.push(wrapText(node.text, options, indent)); return; } @@ -391,15 +391,15 @@ function tokenizeNoBreakLinks(text) { * @param {string} prefix * @returns {string} */ - function wrapText(text, options, prefix) { +function wrapText(text, options, prefix) { if (options?.flattenText) text = text.replace(/↵/g, ' '); const lines = text.split(/[\n↵]/); const result = /** @type {string[]} */([]); const indent = ' '.repeat(prefix.length); - for (const line of lines) { + for (const line of lines) result.push(wrapLine(line, options?.maxColumns, result.length ? indent : prefix)); - } + return result.join('\n'); }