Compare commits

..

14 commits

Author SHA1 Message Date
Pavel Feldman b9e9f4dfaa cherry-pick(#14428): fix(ts): export types explicitly 2022-05-26 15:52:18 -07:00
Ross Wollman bb1da5ec1e fix: expect.toHaveScreenshot.animations types (#14387)
This makes the docs/types match the code which has already been
released.

Relevant code to traverse up from:
- 3e084829c0/packages/playwright-core/src/server/screenshotter.ts (L89)
- 3e084829c0/packages/playwright-core/src/server/screenshotter.ts (L118)

Fixes #14385
2022-05-24 11:36:03 -07:00
Andrey Lushnikov 5965143b73 docs: fix docs for toHaveScreenshot (#14280) 2022-05-24 11:35:55 -07:00
Pavel Feldman 38fe4a5102 chery-pick: fix(ct): do not break if there are no components (2) 2022-05-23 14:40:02 -07:00
Pavel Feldman 95614581db chery-pick(#14362): fix(ct): do not break if there are no components 2022-05-23 14:39:34 -07:00
Andrey Lushnikov 41c6aaf426
chore: mark v1.22.2 (#14289) 2022-05-20 19:26:06 -07:00
Ross Wollman abd4258080
chery-pick(#14267): fix: page.locator.focus() and page.locator(…).type(…) (#14296)
cherry-pick of fbb364c1cd0dec9e4a75b885d51e67ca397b1d6a:

Fixes focus and blur management when `page.locator(…).focus()`  and  `page.locator(…).type(…)` are used which was regressed by 7a5b070 (#13510).

However, some elements are [not focusable](https://html.spec.whatwg.org/multipage/interaction.html#focusable-area), so we were blurring incorrectly, and losing focus that we should have maintained.

Two regression tests were added that pass on the commit prior to 7a5b070e95 (and match manual testing/expectations):

* `page.locator(…).focus()`: _keeps focus on element when attempting to focus a non-focusable element_
* `page.locator(…).type(…)`: _should type repeatedly in input in shadow dom_

Additionally, a third test (_should type repeatedly in input in shadow dom_) was added to check the invariant from #13510 that states:

> This affects [contenteditable] elements, but not input elements.

and allows us to introduce the targeted fix (contenteditble check before blur) without breaking FF again.

And _should type repeatedly in contenteditable in shadow dom with nested elements_ was added to ensure the above fix works with nest contenteditble detection.

Fixes #14254.
2022-05-19 15:19:39 -07:00
Andrey Lushnikov 14782d7a6b
cherry-pick(#14264): chore: more testing-friendly trace (#14276)
SHA 432c52d31a

Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
2022-05-19 07:04:32 -07:00
Andrey Lushnikov baa6aa9f63
cherry-pick(#14243): fix(ct): recreate context on option change (#14257)
Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
2022-05-19 06:10:37 -07:00
Pavel Feldman de23a1b3d2 cherry-pick(#14230): fix: include @types/node in pwt deps 2022-05-17 20:39:23 -07:00
Andrey Lushnikov 28d4804a70
chore: mark 1.22.1 (#14210) 2022-05-17 03:00:26 -07:00
Max Schmitt cce4550cb1
cherry-pick(#14200): chore: fix wrong toHaveScreenshot defaults in docs (#14201) 2022-05-17 07:42:20 +03:00
Andrey Lushnikov 263ae4028a
cherry-pick(#14174): fix(types): fix the toHaveScreenshot types (#14194)
Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
2022-05-16 08:32:38 -07:00
Andrey Lushnikov 9177bd1614
chore: mark v1.22.0 (#14131) 2022-05-12 11:13:57 -07:00
2629 changed files with 143895 additions and 314178 deletions

View file

@ -0,0 +1,11 @@
{
"name": "Playwright",
"image": "mcr.microsoft.com/playwright:next",
"postCreateCommand": "npm install && npm run build && apt-get update && apt-get install -y software-properties-common && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\" && apt-get install -y docker-ce-cli",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"runArgs": [
"-v", "/var/run/docker.sock:/var/run/docker.sock"
]
}

19
.eslintignore Normal file
View file

@ -0,0 +1,19 @@
test/assets/modernizr.js
/packages/*/lib/
*.js
/packages/playwright-core/src/generated/*
/packages/playwright-core/src/third_party/
/packages/playwright-core/types/*
/index.d.ts
utils/generate_types/overrides.d.ts
utils/generate_types/test/test.ts
node_modules/
browser_patches/*/checkout/
browser_patches/chromium/output/
**/*.d.ts
output/
test-results/
tests/components/
examples/
DEPS
.cache/

122
.eslintrc.js Normal file
View file

@ -0,0 +1,122 @@
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "notice"],
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
},
extends: [
"plugin:react-hooks/recommended"
],
/**
* ESLint rules
*
* All available rules: http://eslint.org/docs/rules/
*
* Rules take the following form:
* "rule-name", [severity, { opts }]
* Severity: 2 == error, 1 == warning, 0 == off.
*/
rules: {
"@typescript-eslint/no-unused-vars": [2, {args: "none"}],
"@typescript-eslint/consistent-type-imports": [2, {disallowTypeAnnotations: false}],
/**
* Enforced rules
*/
// syntax preferences
"object-curly-spacing": ["error", "always"],
"quotes": [2, "single", {
"avoidEscape": true,
"allowTemplateLiterals": true
}],
"no-extra-semi": 2,
"@typescript-eslint/semi": [2],
"comma-style": [2, "last"],
"wrap-iife": [2, "inside"],
"spaced-comment": [2, "always", {
"markers": ["*"]
}],
"eqeqeq": [2],
"accessor-pairs": [2, {
"getWithoutSet": false,
"setWithoutGet": false
}],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"curly": [2, "multi-or-nest", "consistent"],
"new-parens": 2,
"arrow-parens": [2, "as-needed"],
"prefer-const": 2,
"quote-props": [2, "consistent"],
// anti-patterns
"no-var": 2,
"no-with": 2,
"no-multi-str": 2,
"no-caller": 2,
"no-implied-eval": 2,
"no-labels": 2,
"no-new-object": 2,
"no-octal-escape": 2,
"no-self-compare": 2,
"no-shadow-restricted-names": 2,
"no-cond-assign": 2,
"no-debugger": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-unreachable": 2,
"no-unsafe-negation": 2,
"radix": 2,
"valid-typeof": 2,
"no-implicit-globals": [2],
"no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true}],
// es2015 features
"require-yield": 2,
"template-curly-spacing": [2, "never"],
// spacing details
"space-infix-ops": 2,
"space-in-parens": [2, "never"],
"space-before-function-paren": [2, {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"no-whitespace-before-property": 2,
"keyword-spacing": [2, {
"overrides": {
"if": {"after": true},
"else": {"after": true},
"for": {"after": true},
"while": {"after": true},
"do": {"after": true},
"switch": {"after": true},
"return": {"after": true}
}
}],
"arrow-spacing": [2, {
"after": true,
"before": true
}],
"@typescript-eslint/func-call-spacing": 2,
"@typescript-eslint/type-annotation-spacing": 2,
// file whitespace
"no-multiple-empty-lines": [2, {"max": 2}],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"linebreak-style": [ process.platform === "win32" ? 0 : 2, "unix" ],
"indent": [2, 2, { "SwitchCase": 1, "CallExpression": {"arguments": 2}, "MemberExpression": 2 }],
"key-spacing": [2, {
"beforeColon": false
}],
// copyright
"notice/notice": [2, {
"mustMatch": "Copyright",
"templateFile": require("path").join(__dirname, "utils", "copyright.js"),
}],
}
};

1
.gitattributes vendored
View file

@ -1,4 +1,5 @@
# text files must be lf for golden file tests to work # text files must be lf for golden file tests to work
* text=auto eol=lf * text=auto eol=lf
# make project show as TS on GitHub # make project show as TS on GitHub
*.js linguist-detectable=false *.js linguist-detectable=false

49
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View file

@ -0,0 +1,49 @@
---
name: Bug Report
about: Something doesn't work like it should? Tell us!
title: "[BUG]"
labels: ''
assignees: ''
---
**Context:**
- Playwright Version: [what Playwright version do you use?]
- Operating System: [e.g. Windows, Linux or Mac]
- Node.js version: [e.g. 12.22, 14.6]
- Browser: [e.g. All, Chromium, Firefox, WebKit]
- Extra: [any specific details about your environment]
<!-- CLI to auto-capture this info -->
<!-- npx envinfo --preset playwright --markdown -->
**Code Snippet**
Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:
```javascript
const {chromium, webkit, firefox} = require('playwright');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
// Please include a snippet of HTML that shows an example of the content
// you are testing.
await page.setContent(`
<div>
</div>
`);
// Alternatively, if you are testing a public application, include the URL:
// await page.goto('https://example.com/')
await page.locator(…);
})();
```
**Describe the bug**
Add any other details about the problem here.

View file

@ -1,101 +0,0 @@
name: Bug Report 🪲
description: Create a bug report to help us improve
title: '[Bug]: '
body:
- type: markdown
attributes:
value: |
# Please follow these steps first:
- type: markdown
attributes:
value: |
## Troubleshoot
If Playwright is not behaving the way you expect, we'd ask you to look at the [documentation](https://playwright.dev/docs/intro) and search the issue tracker for evidence supporting your expectation.
Please make reasonable efforts to troubleshoot and rule out issues with your code, the configuration, or any 3rd party libraries you might be using.
Playwright offers [several debugging tools](https://playwright.dev/docs/debug) that you can use to troubleshoot your issues.
- type: markdown
attributes:
value: |
## Ask for help through appropriate channels
If you feel unsure about the cause of the problem, consider asking for help on for example [StackOverflow](https://stackoverflow.com/questions/ask) or our [Discord channel](https://aka.ms/playwright/discord) before posting a bug report. The issue tracker is not a help forum.
- type: markdown
attributes:
value: |
## Make a minimal reproduction
To file the report, you will need a GitHub repository with a minimal (but complete) example and simple/clear steps on how to reproduce the bug.
The simpler you can make it, the more likely we are to successfully verify and fix the bug. You can create a new project with `npm init playwright@latest new-project` and then add the test code there.
Please make sure you only include the code and the dependencies absolutely necessary for your repro. Due to the security considerations, we can only run the code we trust. Major web frameworks are Ok to use, but smaller convenience libraries are not.
- type: markdown
attributes:
value: |
> [!IMPORTANT]
> Bug reports without a minimal reproduction will be rejected.
---
- type: input
id: version
attributes:
label: Version
description: |
The version of Playwright you are using.
Is it the [latest](https://github.com/microsoft/playwright/releases)? Test and see if the bug has already been fixed.
placeholder: ex. 1.41.1
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: Please link to a repository with a minimal reproduction and describe accurately how we can reproduce/verify the bug.
placeholder: |
Example steps (replace with your own):
1. Clone my repo at https://github.com/<myuser>/example
2. npm install
3. npm run test
4. You should see the error come up
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: A description of what you expect to happen.
placeholder: I expect to see X or Y
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: Actual behavior
description: |
A clear and concise description of the unexpected behavior.
Please include any relevant output here, especially any error messages.
placeholder: A bug happened!
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Anything else that might be relevant
validations:
required: false
- type: textarea
id: envinfo
attributes:
label: Environment
description: |
Please paste the output of running `npx envinfo --preset playwright`.
This will be automatically formatted as a code block, so no need for backticks.
placeholder: |
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (8) arm64
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
npmPackages:
@playwright/test: 1.41.1 => 1.41.1
render: shell
validations:
required: true

View file

@ -1,5 +1,4 @@
blank_issues_enabled: false
contact_links: contact_links:
- name: Join our Discord Server - name: Join our GitHub Discussions community
url: https://aka.ms/playwright/discord url: https://github.com/microsoft/playwright/discussions
about: Ask questions and discuss with other community members about: Ask questions and discuss with other community members

View file

@ -1,29 +0,0 @@
name: Documentation 📖
description: Submit a request to add or update documentation
title: '[Docs]: '
labels: ['Documentation :book:']
body:
- type: markdown
attributes:
value: |
### Thank you for helping us improve our documentation!
Please be sure you are looking at [the Next version of the documentation](https://playwright.dev/docs/next/intro) before opening an issue here.
- type: textarea
id: links
attributes:
label: Page(s)
description: |
Links to one or more documentation pages that should be modified.
If you are reporting an issue with a specific section of a page, try to link directly to the nearest anchor.
If you are suggesting that a new page be created, link to the parent of the proposed page.
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the change you are requesting.
If the issue pertains to a single function or matcher, be sure to specify the entire call signature.
validations:
required: true

View file

@ -1,30 +0,0 @@
name: Feature Request 🚀
description: Submit a proposal for a new feature
title: '[Feature]: '
body:
- type: markdown
attributes:
value: |
### Thank you for taking the time to suggest a new feature!
- type: textarea
id: description
attributes:
label: '🚀 Feature Request'
description: A clear and concise description of what the feature is.
validations:
required: true
- type: textarea
id: example
attributes:
label: Example
description: Describe how this feature would be used.
validations:
required: false
- type: textarea
id: motivation
attributes:
label: Motivation
description: |
Outline your motivation for the proposal. How will it make Playwright better?
validations:
required: true

View file

@ -0,0 +1,11 @@
---
name: Feature request
about: Request new features to be added
title: "[Feature]"
labels: ''
assignees: ''
---
Let us know what functionality you'd like to see in Playwright and what your use case is.
Do you think others might benefit from this as well?

10
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View file

@ -0,0 +1,10 @@
---
name: I have a question
about: Feel free to ask us your questions!
title: "[Question]"
labels: ''
assignees: ''
---

View file

@ -1,27 +0,0 @@
name: 'Questions / Help 💬'
description: If you have questions, please check StackOverflow or Discord
title: '[Please read the message below]'
labels: [':speech_balloon: Question']
body:
- type: markdown
attributes:
value: |
## Questions and Help 💬
This issue tracker is reserved for bug reports and feature requests.
For anything else, such as questions or getting help, please see:
- [The Playwright documentation](https://playwright.dev)
- [Our Discord server](https://aka.ms/playwright/discord)
- type: checkboxes
id: no-post
attributes:
label: |
Please do not submit this issue.
description: |
> [!IMPORTANT]
> This issue will be closed.
options:
- label: I understand
required: true

32
.github/ISSUE_TEMPLATE/regression.md vendored Normal file
View file

@ -0,0 +1,32 @@
---
name: Report regression
about: Functionality that used to work and does not any more
title: "[REGRESSION]: "
labels: ''
assignees: ''
---
**Context:**
- GOOD Playwright Version: [what Playwright version worked nicely?]
- BAD Playwright Version: [what Playwright version doesn't work any more?]
- Operating System: [e.g. Windows, Linux or Mac]
- Extra: [any specific details about your environment]
**Code Snippet**
Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:
```javascript
const {chromium, webkit, firefox} = require('playwright');
(async () => {
const browser = await chromium.launch();
// ...
})();
```
**Describe the bug**
Add any other details about the problem here.

View file

@ -1,96 +0,0 @@
name: Report regression
description: Functionality that used to work and does not any more
title: "[Regression]: "
body:
- type: markdown
attributes:
value: |
# Please follow these steps first:
- type: markdown
attributes:
value: |
## Make a minimal reproduction
To file the report, you will need a GitHub repository with a minimal (but complete) example and simple/clear steps on how to reproduce the regression.
The simpler you can make it, the more likely we are to successfully verify and fix the regression.
- type: markdown
attributes:
value: |
> [!IMPORTANT]
> Regression reports without a minimal reproduction will be rejected.
---
- type: input
id: goodVersion
attributes:
label: Last Good Version
description: |
Last version of Playwright where the feature was working.
placeholder: ex. 1.40.1
validations:
required: true
- type: input
id: badVersion
attributes:
label: First Bad Version
description: |
First version of Playwright where the feature was broken.
Is it the [latest](https://github.com/microsoft/playwright/releases)? Test and see if the regression has already been fixed.
placeholder: ex. 1.41.1
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: Please link to a repository with a minimal reproduction and describe accurately how we can reproduce/verify the bug.
placeholder: |
Example steps (replace with your own):
1. Clone my repo at https://github.com/<myuser>/example
2. npm install
3. npm run test
4. You should see the error come up
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: A description of what you expect to happen.
placeholder: I expect to see X or Y
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: Actual behavior
description: A clear and concise description of the unexpected behavior.
placeholder: A bug happened!
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Anything else that might be relevant
validations:
required: false
- type: textarea
id: envinfo
attributes:
label: Environment
description: |
Please paste the output of running `npx envinfo --preset playwright`.
This will be automatically formatted as a code block, so no need for backticks.
placeholder: |
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (8) arm64
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
npmPackages:
@playwright/test: 1.41.1 => 1.41.1
render: shell
validations:
required: true

View file

@ -1,44 +0,0 @@
name: 'Download artifacts'
description: 'Download artifacts from GitHub'
inputs:
namePrefix:
description: 'Name prefix of the artifacts to download'
required: true
default: 'blob-report'
path:
description: 'Directory with downloaded artifacts'
required: true
default: '.'
runs:
using: "composite"
steps:
- name: Create temp downloads dir
shell: bash
run: mkdir -p '${{ inputs.path }}/artifacts'
- name: Download artifacts
uses: actions/github-script@v7
with:
script: |
console.log(`downloading artifacts for workflow_run: ${context.payload.workflow_run.id}`);
console.log(`workflow_run: ${JSON.stringify(context.payload.workflow_run, null, 2)}`);
const allArtifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {
...context.repo,
run_id: context.payload.workflow_run.id
});
console.log('total = ', allArtifacts.length);
const artifacts = allArtifacts.filter(a => a.name.startsWith('${{ inputs.namePrefix }}'));
const fs = require('fs');
for (const artifact of artifacts) {
const result = await github.rest.actions.downloadArtifact({
...context.repo,
artifact_id: artifact.id,
archive_format: 'zip'
});
console.log(`Downloaded ${artifact.name}.zip (${result.data.byteLength} bytes)`);
fs.writeFileSync(`${{ inputs.path }}/artifacts/${artifact.name}.zip`, Buffer.from(result.data));
}
- name: Unzip artifacts
shell: bash
run: |
unzip -n '${{ inputs.path }}/artifacts/*.zip' -d ${{ inputs.path }}
rm -rf '${{ inputs.path }}/artifacts'

View file

@ -1,25 +0,0 @@
name: Enable Microphone Access (macOS)
description: 'Allow microphone access to all apps on macOS'
runs:
using: composite
steps:
# https://github.com/actions/runner-images/issues/9330
- name: Allow microphone access to all apps
shell: bash
run: |
if [[ "$(uname)" != "Darwin" ]]; then
echo "Not macOS, exiting"
exit 0
fi
echo "Allowing microphone access to all apps"
version=$(sw_vers -productVersion | cut -d. -f1)
if [[ "$version" == "14" || "$version" == "15" ]]; then
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
elif [[ "$version" == "12" || "$version" == "13" ]]; then
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR REPLACE INTO access VALUES('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159);"
else
echo "Skipping unsupported macOS version $version"
exit 0
fi
echo "Successfully allowed microphone access"

View file

@ -1,93 +0,0 @@
name: 'Run browser tests'
description: 'Run browser tests'
inputs:
command:
description: 'Command to run tests'
required: true
node-version:
description: 'Node.js version to use'
required: false
default: '18'
browsers-to-install:
description: 'Browser to install. Default is all browsers.'
required: false
default: ''
bot-name:
description: 'Bot name'
required: true
shell:
description: 'Shell to use'
required: false
default: 'bash'
flakiness-client-id:
description: 'Azure Flakiness Dashboard Client ID'
required: false
flakiness-tenant-id:
description: 'Azure Flakiness Dashboard Tenant ID'
required: false
flakiness-subscription-id:
description: 'Azure Flakiness Dashboard Subscription ID'
required: false
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- uses: ./.github/actions/enable-microphone-access
- run: |
echo "::group::npm ci"
npm ci
echo "::endgroup::"
shell: bash
env:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
- run: |
echo "::group::npm run build"
npm run build
echo "::endgroup::"
shell: bash
- run: |
echo "::group::npx playwright install --with-deps"
npx playwright install --with-deps ${{ inputs.browsers-to-install }}
echo "::endgroup::"
shell: bash
- name: Run tests
if: inputs.shell == 'bash'
run: |
if [[ "$(uname)" == "Linux" ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- ${{ inputs.command }}
else
${{ inputs.command }}
fi
shell: bash
env:
PWTEST_BOT_NAME: ${{ inputs.bot-name }}
- name: Run tests
if: inputs.shell != 'bash'
run: ${{ inputs.command }}
shell: ${{ inputs.shell }}
env:
PWTEST_BOT_NAME: ${{ inputs.bot-name }}
- name: Azure Login
uses: azure/login@v2
if: ${{ !cancelled() && github.event_name == 'push' && github.repository == 'microsoft/playwright' }}
with:
client-id: ${{ inputs.flakiness-client-id }}
tenant-id: ${{ inputs.flakiness-tenant-id }}
subscription-id: ${{ inputs.flakiness-subscription-id }}
- run: |
echo "::group::./utils/upload_flakiness_dashboard.sh"
./utils/upload_flakiness_dashboard.sh ./test-results/report.json
echo "::endgroup::"
if: ${{ !cancelled() }}
shell: bash
- name: Upload blob report
# We only merge reports for PRs as per .github/workflows/create_test_report.yml.
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: ./.github/actions/upload-blob-report
with:
report_dir: blob-report
job_name: ${{ inputs.bot-name }}

View file

@ -1,34 +0,0 @@
name: 'Upload blob report'
description: 'Upload blob report to GitHub artifacts (for pull requests)'
inputs:
report_dir:
description: 'Directory containing blob report'
required: true
default: 'test-results/blob-report'
job_name:
description: 'Unique job name'
required: true
default: ''
runs:
using: "composite"
steps:
- name: Integrity check
shell: bash
run: find "${{ inputs.report_dir }}" -name "*.zip" -exec unzip -t {} \;
- name: Upload blob report to GitHub
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ inputs.job_name }}
path: ${{ inputs.report_dir }}/**
retention-days: 7
- name: Write triggering pull request number in a file
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
shell: bash
run: echo '${{ github.event.number }}' > pull_request_number.txt;
- name: Upload artifact with the pull request number
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: pull-request-${{ inputs.job_name }}
path: pull_request_number.txt

View file

@ -1,14 +0,0 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"

View file

@ -0,0 +1,7 @@
{
"name": "playwright-chromium",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -0,0 +1,7 @@
{
"name": "playwright-core",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -0,0 +1,7 @@
{
"name": "playwright-firefox",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -0,0 +1,7 @@
{
"name": "@playwright/test",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -0,0 +1,7 @@
{
"name": "playwright-webkit",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -0,0 +1,7 @@
{
"name": "playwright",
"version": "1.0.0",
"description": "A high-level API to automate web browsers",
"repository": "github:Microsoft/playwright",
"license": "Apache-2.0"
}

View file

@ -1,81 +0,0 @@
name: Cherry-pick into release branch
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version number, e.g. 1.25
required: true
commit_hashes:
type: string
description: Comma-separated list of commit hashes to cherry-pick
required: true
permissions:
contents: write
jobs:
roll:
runs-on: ubuntu-22.04
steps:
- name: Validate input version number
run: |
VERSION="${{ github.event.inputs.version }}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
echo "Version is not a two digit semver version"
exit 1
fi
- uses: actions/checkout@v4
with:
ref: release-${{ github.event.inputs.version }}
fetch-depth: 0
- name: Cherry-pick commits
id: cherry-pick
run: |
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
for COMMIT_HASH in $(echo "${{ github.event.inputs.commit_hashes }}" | tr "," "\n"); do
git cherry-pick --no-commit "$COMMIT_HASH"
COMMIT_MESSAGE="$(git show -s --format=%B $COMMIT_HASH | head -n 1)"
COMMIT_MESSAGE=$(node -e '
const match = /^(.*) (\(#\d+\))$/.exec(process.argv[1]);
if (!match) {
console.log(process.argv[1]);
process.exit(0);
}
console.log(`cherry-pick${match[2]}: ${match[1]}`);
' "$COMMIT_MESSAGE")
git commit -m "$COMMIT_MESSAGE"
done
LAST_COMMIT_MESSAGE=$(git show -s --format=%B)
echo "PR_TITLE=$LAST_COMMIT_MESSAGE" >> $GITHUB_OUTPUT
- name: Prepare branch
id: prepare-branch
run: |
BRANCH_NAME="cherry-pick-${{ github.event.inputs.version }}-$(date +%Y-%m-%d-%H-%M-%S)"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b "$BRANCH_NAME"
git push origin $BRANCH_NAME
- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
script: |
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
const response = await github.rest.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'release-${{ github.event.inputs.version }}',
title: '${{ steps.cherry-pick.outputs.PR_TITLE }}',
body: `This PR cherry-picks the following commits:\n\n${readableCommitHashesList}`,
});
await github.rest.issues.addLabels({
owner: 'microsoft',
repo: 'playwright',
issue_number: response.data.number,
labels: ['CQ1'],
});

View file

@ -1,123 +0,0 @@
name: Publish Test Results
on:
workflow_run:
workflows: ["tests 1", "tests 2", "tests others"]
types:
- completed
jobs:
merge-reports:
permissions:
pull-requests: write
checks: write
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
if: ${{ github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
env:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
- run: npm run build
- name: Download blob report artifact
uses: ./.github/actions/download-artifact
with:
namePrefix: 'blob-report'
path: 'all-blob-reports'
- name: Merge reports
run: |
npx playwright merge-reports --config .github/workflows/merge.config.ts ./all-blob-reports
env:
NODE_OPTIONS: --max-old-space-size=8192
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_BLOB_REPORTS_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_BLOB_REPORTS_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_BLOB_REPORTS_SUBSCRIPTION_ID }}
- name: Upload HTML report to Azure
run: |
REPORT_DIR='run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}'
azcopy cp --recursive "./playwright-report/*" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html"
env:
AZCOPY_AUTO_LOGIN_TYPE: AZCLI
- name: Read pull request number
uses: ./.github/actions/download-artifact
with:
namePrefix: 'pull-request'
path: '.'
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
let prNumber;
if (context.payload.workflow_run.event === 'pull_request') {
const prs = context.payload.workflow_run.pull_requests;
if (prs.length) {
prNumber = prs[0].number;
} else {
prNumber = parseInt(fs.readFileSync('pull_request_number.txt').toString());
console.log('Read pull request number from file: ' + prNumber);
}
} else {
core.error('Unsupported workflow trigger event: ' + context.payload.workflow_run.event);
return;
}
if (!prNumber) {
core.error('No pull request found for commit ' + context.sha + ' and workflow triggered by: ' + context.payload.workflow_run.event);
return;
}
{
// Mark previous comments as outdated by minimizing them.
const { data: comments } = await github.rest.issues.listComments({
...context.repo,
issue_number: prNumber,
});
for (const comment of comments) {
if (comment.user.login === 'github-actions[bot]' && /\[Test results\]\(https:\/\/.+?\) for "${{ github.event.workflow_run.name }}"/.test(comment.body)) {
await github.graphql(`
mutation {
minimizeComment(input: {subjectId: "${comment.node_id}", classifier: OUTDATED}) {
clientMutationId
}
}
`);
}
}
}
const reportDir = 'run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}';
const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/${reportDir}/index.html#?q=s%3Afailed%20s%3Aflaky`;
core.notice('Report url: ' + reportUrl);
const mergeWorkflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const reportMd = await fs.promises.readFile('report.md', 'utf8');
function formatComment(lines) {
let body = lines.join('\n');
if (body.length > 65535)
body = body.substring(0, 65000) + `... ${body.length - 65000} more characters`;
return body;
}
const { data: response } = await github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: formatComment([
`### [Test results](${reportUrl}) for "${{ github.event.workflow_run.name }}"`,
reportMd,
'',
`Merge [workflow run](${mergeWorkflowUrl}).`
]),
});
core.info('Posted comment: ' + response.html_url);

View file

@ -10,18 +10,16 @@ on:
- main - main
- release-* - release-*
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
doc-and-lint: doc-and-lint:
name: "docs & lint" name: "docs & lint"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
@ -35,27 +33,4 @@ jobs:
exit 1 exit 1
fi fi
- name: Audit prod NPM dependencies - name: Audit prod NPM dependencies
run: node utils/check_audit.js run: npm audit --omit dev
lint-snippets:
name: "Lint snippets"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- run: npm ci
- run: pip install -r utils/doclint/linting-code-snippets/python/requirements.txt
- run: mvn package
working-directory: utils/doclint/linting-code-snippets/java
- run: node utils/doclint/linting-code-snippets/cli.js

View file

@ -1,4 +0,0 @@
export default {
testDir: '../../tests',
reporter: [[require.resolve('../../packages/playwright/lib/reporters/markdown')], ['html']]
};

View file

@ -4,39 +4,29 @@ on:
branches: branches:
- main - main
paths: paths:
- 'docs/src/api/**/*'
- 'packages/playwright-core/src/client/**/*' - 'packages/playwright-core/src/client/**/*'
- 'packages/playwright-core/src/utils/isomorphic/**/*'
- 'packages/playwright/src/matchers/matchers.ts'
- 'packages/protocol/src/protocol.yml'
jobs: jobs:
check: check:
name: Check name: Check
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
steps: steps:
- uses: actions/checkout@v4
- name: Create GitHub issue - name: Create GitHub issue
uses: actions/github-script@v7 uses: actions/github-script@v4
with: with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }} github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
script: | script: |
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0]; const { data } = await github.git.getCommit({
const { data } = await github.rest.git.getCommit({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
commit_sha: context.sha, commit_sha: context.sha,
}); });
const commitHeader = data.message.split('\n')[0]; const commitHeader = data.message.split('\n')[0];
const prMatch = commitHeader.match(/#(\d+)/);
const formattedCommit = prMatch
? `https://github.com/microsoft/playwright/pull/${prMatch[1]}`
: `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`;
const title = '[Ports]: Backport client side changes for ' + currentPlaywrightVersion; const title = '[Ports]: Backport client side changes';
for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) { for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) {
const { data: issuesData } = await github.rest.search.issuesAndPullRequests({ const { data: issuesData } = await github.search.issuesAndPullRequests({
q: `is:issue is:open repo:microsoft/${repo} in:title "${title}" author:playwrightmachine` q: `is:issue is:open repo:microsoft/${repo} in:title "${title}"`
}) })
let issueNumber = null; let issueNumber = null;
let issueBody = ''; let issueBody = '';
@ -44,7 +34,7 @@ jobs:
issueNumber = issuesData.items[0].number issueNumber = issuesData.items[0].number
issueBody = issuesData.items[0].body issueBody = issuesData.items[0].body
} else { } else {
const { data: issueCreateData } = await github.rest.issues.create({ const { data: issueCreateData } = await github.issues.create({
owner: context.repo.owner, owner: context.repo.owner,
repo: repo, repo: repo,
title, title,
@ -54,8 +44,8 @@ jobs:
issueBody = issueCreateData.body; issueBody = issueCreateData.body;
} }
const newBody = issueBody.trimEnd() + ` const newBody = issueBody.trimEnd() + `
- [ ] ${formattedCommit}`; - [ ] https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`;
const data = await github.rest.issues.update({ const data = await github.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: repo, repo: repo,
issue_number: issueNumber, issue_number: issueNumber,

View file

@ -8,24 +8,18 @@ on:
branches: branches:
- release-* - release-*
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
publish-canary: publish-canary:
name: "publish canary NPM" name: "publish canary NPM & Publish canary Docker"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
environment: allow-publish-driver-to-cdn # This is required for OIDC login (azure/login)
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
@ -50,35 +44,43 @@ jobs:
utils/publish_all_packages.sh --beta utils/publish_all_packages.sh --beta
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_PW_CDN_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_PW_CDN_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_PW_CDN_SUBSCRIPTION_ID }}
- name: build & publish driver - name: build & publish driver
env: env:
AZ_UPLOAD_FOLDER: driver/next AZ_UPLOAD_FOLDER: driver/next
AZ_ACCOUNT_KEY: ${{ secrets.AZ_ACCOUNT_KEY }}
AZ_ACCOUNT_NAME: ${{ secrets.AZ_ACCOUNT_NAME }}
run: | run: |
utils/build/build-playwright-driver.sh utils/build/build-playwright-driver.sh
utils/build/upload-playwright-driver.sh utils/build/upload-playwright-driver.sh
- uses: azure/docker-login@v1
with:
login-server: playwright.azurecr.io
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: publish docker canary
run: ./utils/docker/publish_docker.sh canary
publish-trace-viewer: publish-trace-viewer:
name: "publish Trace Viewer to trace.playwright.dev" name: "publish Trace Viewer to trace.playwright.dev"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
- run: npm i -g npm@8
- name: Deploy Canary - name: Deploy Canary
run: bash utils/build/deploy-trace-viewer.sh --canary run: bash utils/build/deploy-trace-viewer.sh --canary
if: contains(github.ref, 'main') if: contains(github.ref, 'main')
env: env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }} GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
- name: Deploy BETA - name: Deploy BETA
run: bash utils/build/deploy-trace-viewer.sh --beta run: bash utils/build/deploy-trace-viewer.sh --beta
if: contains(github.ref, 'release') if: contains(github.ref, 'release')
env: env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }} GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}

View file

@ -2,40 +2,40 @@ name: "publish release - Docker"
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
is_release:
required: true
type: boolean
description: "Is this a release image?"
release: release:
types: [published] types: [published]
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
publish-docker-release: publish-docker-release:
name: "publish to DockerHub" name: "publish to DockerHub"
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
environment: allow-publishing-docker-to-acr
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- uses: azure/docker-login@v1
with:
login-server: playwright.azurecr.io
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU for arm64 docker builds - name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v1
with: with:
platforms: arm64 platforms: arm64
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_DOCKER_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_DOCKER_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_DOCKER_SUBSCRIPTION_ID }}
- name: Login to ACR via OIDC
run: az acr login --name playwright
- run: ./utils/docker/publish_docker.sh stable - run: ./utils/docker/publish_docker.sh stable
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
- run: ./utils/docker/publish_docker.sh canary
if: (github.event_name != 'workflow_dispatch' && github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release != 'true')

View file

@ -4,34 +4,24 @@ on:
release: release:
types: [published] types: [published]
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
publish-driver-release: publish-driver-release:
name: "publish playwright driver to CDN" name: "publish playwright driver to CDN"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
environment: allow-publish-driver-to-cdn # This is required for OIDC login (azure/login)
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
- run: utils/build/build-playwright-driver.sh - run: utils/build/build-playwright-driver.sh
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_PW_CDN_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_PW_CDN_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_PW_CDN_SUBSCRIPTION_ID }}
- run: utils/build/upload-playwright-driver.sh - run: utils/build/upload-playwright-driver.sh
env: env:
AZ_UPLOAD_FOLDER: driver AZ_UPLOAD_FOLDER: driver
AZ_ACCOUNT_KEY: ${{ secrets.AZ_ACCOUNT_KEY }}
AZ_ACCOUNT_NAME: ${{ secrets.AZ_ACCOUNT_NAME }}

View file

@ -4,31 +4,26 @@ on:
release: release:
types: [published] types: [published]
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
publish-npm-release: publish-npm-release:
name: "publish to NPM" name: "publish to NPM"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
permissions:
contents: read
id-token: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
- run: utils/publish_all_packages.sh --release-candidate - run: utils/publish_all_packages.sh --release-candidate
if: ${{ github.event.release.prerelease }} if: "github.event.release.prerelease"
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: utils/publish_all_packages.sh --release - run: utils/publish_all_packages.sh --release
if: ${{ !github.event.release.prerelease }} if: "!github.event.release.prerelease"
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -7,14 +7,15 @@ on:
jobs: jobs:
publish-trace-viewer: publish-trace-viewer:
name: "publish Trace Viewer to trace.playwright.dev" name: "publish Trace Viewer to trace.playwright.dev"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
- run: npm i -g npm@8
- name: Deploy Stable - name: Deploy Stable
run: bash utils/build/deploy-trace-viewer.sh --stable run: bash utils/build/deploy-trace-viewer.sh --stable
env: env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }} GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}

View file

@ -3,67 +3,44 @@ name: Roll Browser into Playwright
on: on:
repository_dispatch: repository_dispatch:
types: [roll_into_pw] types: [roll_into_pw]
workflow_dispatch:
inputs:
browser:
description: 'Browser name, e.g. chromium'
required: true
type: string
revision:
description: 'Browser revision without v prefix, e.g. 1234'
required: true
type: string
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
BROWSER: ${{ github.event.client_payload.browser || github.event.inputs.browser }}
REVISION: ${{ github.event.client_payload.revision || github.event.inputs.revision }}
permissions:
contents: write
jobs: jobs:
roll: roll:
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- name: Install dependencies - name: Install dependencies
run: npx playwright install-deps run: npx playwright install-deps
- name: Roll to new revision - name: Roll to new revision
run: | run: |
./utils/roll_browser.js $BROWSER $REVISION ./utils/roll_browser.js ${{ github.event.client_payload.browser }} ${{ github.event.client_payload.revision }}
npm run build npm run build
- name: Prepare branch - name: Prepare branch
id: prepare-branch id: prepare-branch
run: | run: |
BRANCH_NAME="roll-into-pw-${BROWSER}/${REVISION}" BASE_POSITION="${{ steps.bump-chromium.outputs.BASE_POSITION }}"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT BRANCH_NAME="roll-into-pw-${{ github.event.client_payload.browser }}/${{ github.event.client_payload.revision }}"
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"
git config --global user.name github-actions git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME" git checkout -b "$BRANCH_NAME"
git add . git add .
git commit -m "feat(${BROWSER}): roll to r${REVISION}" git commit -m "feat(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revision }}"
git push origin $BRANCH_NAME --force git push origin $BRANCH_NAME
- name: Create Pull Request - name: Create Pull Request
uses: actions/github-script@v7 uses: actions/github-script@v4
with: with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
script: | script: |
const response = await github.rest.pulls.create({ await github.pulls.create({
owner: 'microsoft', owner: 'microsoft',
repo: 'playwright', repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}', head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main', base: 'main',
title: 'feat(${{ env.BROWSER }}): roll to r${{ env.REVISION }}', title: 'feat(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revision }}',
});
await github.rest.issues.addLabels({
owner: 'microsoft',
repo: 'playwright',
issue_number: response.data.number,
labels: ['CQ1'],
}); });

View file

@ -0,0 +1,43 @@
name: "PR: bump //browser_patches/chromium/BUILD_NUMBER"
on:
workflow_dispatch:
schedule:
# At 10:00am UTC (3AM PST) every day to build every new Chromium beta
- cron: "0 10 * * *"
jobs:
trigger-chromium-build:
name: Trigger Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: ./browser_patches/chromium/roll_to_current_beta.sh
- name: Prepare branch
id: prepare-branch
run: |
if [[ "$(git status --porcelain)" == "" ]]; then
echo "there are no changes";
exit 0;
fi
echo "::set-output name=HAS_CHANGES::1"
CURRENT_DATE=$(date +%Y-%b-%d)
BRANCH_NAME="roll-chromium/${CURRENT_DATE}"
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"
echo "::set-output name=CURRENT_DATE::$CURRENT_DATE"
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "browser(chromium): roll to $CURRENT_DATE"
git push origin $BRANCH_NAME
- name: Create Pull Request
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
uses: actions/github-script@v4
with:
script: |
await github.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main',
title: 'browser(chromium): roll to ${{ steps.prepare-branch.outputs.CURRENT_DATE }}',
});

View file

@ -0,0 +1,43 @@
name: "PR: bump //browser_patches/chromium-tip-of-tree/BUILD_NUMBER"
on:
workflow_dispatch:
schedule:
# At 10:00am UTC (3AM PST) every tuesday and thursday to build new Chromium Tip-of-tree
- cron: "0 10 * * 2,4"
jobs:
trigger-chromium-build:
name: Trigger Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: ./browser_patches/chromium-tip-of-tree/roll_to_current_tip_of_tree.sh
- name: Prepare branch
id: prepare-branch
run: |
if [[ "$(git status --porcelain)" == "" ]]; then
echo "there are no changes";
exit 0;
fi
echo "::set-output name=HAS_CHANGES::1"
CURRENT_DATE=$(date +%Y-%b-%d)
BRANCH_NAME="roll-chromium/${CURRENT_DATE}"
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"
echo "::set-output name=CURRENT_DATE::$CURRENT_DATE"
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "browser(chromium-tip-of-tree): roll to $CURRENT_DATE"
git push origin $BRANCH_NAME
- name: Create Pull Request
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
uses: actions/github-script@v4
with:
script: |
await github.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main',
title: 'browser(chromium-tip-of-tree): roll to ${{ steps.prepare-branch.outputs.CURRENT_DATE }}',
});

View file

@ -1,48 +0,0 @@
name: "PR: bump driver Node.js"
on:
workflow_dispatch:
schedule:
# At 10:00am UTC (3AM PST) every tuesday and thursday to roll to new Node.js driver
- cron: "0 10 * * 2,4"
jobs:
trigger-nodejs-roll:
name: Trigger Roll
runs-on: ubuntu-22.04
if: github.repository == 'microsoft/playwright'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: node utils/build/update-playwright-driver-version.mjs
- name: Prepare branch
id: prepare-branch
run: |
if [[ "$(git status --porcelain)" == "" ]]; then
echo "there are no changes";
exit 0;
fi
echo "HAS_CHANGES=1" >> $GITHUB_OUTPUT
BRANCH_NAME="roll-driver-nodejs/$(date +%Y-%b-%d)"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "chore(driver): roll driver to recent Node.js LTS version"
git push origin $BRANCH_NAME
- name: Create Pull Request
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
script: |
await github.rest.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main',
title: 'chore(driver): roll driver to recent Node.js LTS version',
});

55
.github/workflows/tests_android.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: "tests Android"
on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
paths:
- "**android**"
- "utils/avd_*.js"
- ".github/workflows/tests_android.yml"
env:
# Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
jobs:
test_android:
name: Android Emulator (shard ${{ matrix.shard }})
strategy:
fail-fast: false
matrix:
shard: [1, 2]
# use mac build for emulator hardware accelerator
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
DEBUG: pw:install
- run: npm run build
- run: npx playwright install-deps
- name: Create Android Emulator
run: utils/avd_recreate.sh
- name: Start Android Emulator
run: utils/avd_start.sh
- name: Run tests
run: npm run atest -- --shard=${{ matrix.shard }}/2
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: android-test-results
path: test-results

View file

@ -1,71 +0,0 @@
name: tests BiDi
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- .github/workflows/tests_bidi.yml
- packages/playwright-core/src/server/bidi/**
- tests/bidi/**
schedule:
# Run every day at midnight
- cron: '0 0 * * *'
env:
FORCE_COLOR: 1
jobs:
test_bidi:
name: BiDi
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-24.04
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
strategy:
fail-fast: false
matrix:
channel: [bidi-chromium, bidi-firefox-nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
- run: npm run build
- run: npx playwright install --with-deps chromium
if: matrix.channel == 'bidi-chromium'
- run: npx -y @puppeteer/browsers install firefox@nightly
if: matrix.channel == 'bidi-firefox-nightly'
- name: Run tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --project=${{ matrix.channel }}*
env:
PWTEST_USE_BIDI_EXPECTATIONS: '1'
- name: Upload csv report to GitHub
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: csv-report-${{ matrix.channel }}
path: test-results/report.csv
retention-days: 7
- name: Azure Login
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_BLOB_REPORTS_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_BLOB_REPORTS_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_BLOB_REPORTS_SUBSCRIPTION_ID }}
- name: Upload report.csv to Azure
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
run: |
REPORT_DIR='bidi-reports'
azcopy cp "./test-results/report.csv" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR/${{ matrix.channel }}.csv"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/${{ matrix.channel }}.csv"
env:
AZCOPY_AUTO_LOGIN_TYPE: AZCLI

View file

@ -15,27 +15,22 @@ on:
env: env:
FORCE_COLOR: 1 FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs: jobs:
test_components: test_components:
name: ${{ matrix.os }} - Node.js ${{ matrix.node-version }} name: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [18]
include:
- os: ubuntu-latest
node-version: 20
- os: ubuntu-latest
node-version: 22
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} # Component tests require Node.js 16+ (they require ESM via TS)
node-version: 16
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install --with-deps - run: npx playwright install --with-deps

54
.github/workflows/tests_electron.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: "electron"
on:
push:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
types: [ labeled ]
branches:
- main
- release-*
env:
# Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
jobs:
test_electron:
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run etest
if: matrix.os == 'ubuntu-latest'
- run: npm run etest
if: matrix.os != 'ubuntu-latest'
- run: node tests/config/checkCoverage.js electron
if: always() && matrix.os == 'ubuntu-latest'
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: always() && matrix.os == 'ubuntu-latest'
with:
name: electron-linux-test-results
path: test-results

View file

@ -1,166 +0,0 @@
name: tests others
on:
push:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
types: [ labeled ]
branches:
- main
- release-*
env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs:
test_stress:
name: Stress - ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run build
- run: npx playwright install --with-deps
- run: npm run stest contexts -- --project=chromium
if: ${{ !cancelled() }}
- run: npm run stest browsers -- --project=chromium
if: ${{ !cancelled() }}
- run: npm run stest frames -- --project=chromium
if: ${{ !cancelled() }}
- run: npm run stest contexts -- --project=webkit
if: ${{ !cancelled() }}
- run: npm run stest browsers -- --project=webkit
if: ${{ !cancelled() }}
- run: npm run stest frames -- --project=webkit
if: ${{ !cancelled() }}
- run: npm run stest contexts -- --project=firefox
if: ${{ !cancelled() }}
- run: npm run stest browsers -- --project=firefox
if: ${{ !cancelled() }}
- run: npm run stest frames -- --project=firefox
if: ${{ !cancelled() }}
- run: npm run stest heap -- --project=chromium
if: ${{ !cancelled() }}
test_webview2:
name: WebView2
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-2022
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet build
working-directory: tests/webview2/webview2-app/
- name: Update to Evergreen WebView2 Runtime
shell: pwsh
run: |
# See here: https://developer.microsoft.com/en-us/microsoft-edge/webview2/
Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
Start-Process -FilePath setup.exe -Verb RunAs -Wait
- uses: ./.github/actions/run-test
with:
node-version: 20
browsers-to-install: chromium
command: npm run webview2test
bot-name: "webview2-chromium-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
test_clock_frozen_time_linux:
name: time library - ${{ matrix.clock }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
strategy:
fail-fast: false
matrix:
clock: [frozen, realtime]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
node-version: 20
browsers-to-install: chromium
command: npm run test -- --project=chromium-*
bot-name: "${{ matrix.clock }}-time-library-chromium-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PW_CLOCK: ${{ matrix.clock }}
test_clock_frozen_time_test_runner:
name: time test runner - ${{ matrix.clock }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-22.04
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
strategy:
fail-fast: false
matrix:
clock: [frozen, realtime]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
node-version: 20
command: npm run ttest
bot-name: "${{ matrix.clock }}-time-runner-chromium-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PW_CLOCK: ${{ matrix.clock }}
test_electron:
name: Electron - ${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with:
browsers-to-install: chromium
command: npm run etest
bot-name: "electron-${{ matrix.os }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
ELECTRON_SKIP_BINARY_DOWNLOAD:

View file

@ -22,183 +22,155 @@ concurrency:
env: env:
# Force terminal colors. @see https://www.npmjs.com/package/colors # Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1 FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1 FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
jobs: jobs:
test_linux: test_linux:
name: ${{ matrix.os }} (${{ matrix.browser }} - Node.js ${{ matrix.node-version }}) name: ${{ matrix.os }} (${{ matrix.browser }} - Node.js ${{ matrix.node-version }})
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
os: [ubuntu-22.04] os: [ubuntu-20.04]
node-version: [18] node-version: [14]
include: include:
- os: ubuntu-22.04 - os: ubuntu-20.04
node-version: 20 node-version: 12
browser: chromium browser: chromium
- os: ubuntu-22.04 - os: ubuntu-20.04
node-version: 22 node-version: 16
browser: chromium
- os: ubuntu-20.04
node-version: 18
browser: chromium browser: chromium
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
browsers-to-install: ${{ matrix.browser }} chromium - run: npm i -g npm@8
command: npm run test -- --project=${{ matrix.browser }}-* - run: npm ci
bot-name: "${{ matrix.browser }}-${{ matrix.os }}-node${{ matrix.node-version }}" env:
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} DEBUG: pw:install
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: always()
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results
path: test-results
test_linux_chromium_tot: test_linux_chromium_tot:
name: ${{ matrix.os }} (chromium tip-of-tree) name: ${{ matrix.os }} (chromium tip-of-tree)
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-20.04] os: [ubuntu-20.04]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: chromium-tip-of-tree node-version: 14
command: npm run test -- --project=chromium-* - run: npm i -g npm@8
bot-name: "${{ matrix.os }}-chromium-tip-of-tree" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chromium-tip-of-tree
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium
env: env:
PWTEST_CHANNEL: chromium-tip-of-tree PWTEST_CHANNEL: chromium-tip-of-tree
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: always()
with:
name: ${{ matrix.browser }}-chromium-tip-of-tree-test-results
path: test-results
test_test_runner: test_test_runner:
name: Test Runner name: Test Runner
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18] node-version: [14]
shardIndex: [1, 2]
shardTotal: [2]
include:
- os: ubuntu-latest
node-version: 20
shardIndex: 1
shardTotal: 2
- os: ubuntu-latest
node-version: 20
shardIndex: 2
shardTotal: 2
- os: ubuntu-latest
node-version: 22
shardIndex: 1
shardTotal: 2
- os: ubuntu-latest
node-version: 22
shardIndex: 2
shardTotal: 2
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
node-version: ${{matrix.node-version}} node-version: ${{matrix.node-version}}
command: npm run ttest -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - run: npm i -g npm@8
bot-name: "${{ matrix.os }}-node${{ matrix.node-version }}-${{ matrix.shardIndex }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env: env:
PWTEST_CHANNEL: firefox-beta DEBUG: pw:install
- run: npm run build
- run: npx playwright install --with-deps
- run: npm run ttest
if: matrix.os != 'ubuntu-latest'
- run: xvfb-run npm run ttest
if: matrix.os == 'ubuntu-latest'
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
test_test_runner_esm:
name: Test Runner ESM
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
# ESM tests rely on the experimental loader in Node.js 16+
node-version: 16
- run: npm i -g npm@8
- run: npm ci
env:
DEBUG: pw:install
- run: npm run build
- run: npx playwright install --with-deps
- run: npm run ttest -- esm.spec.ts
test_web_components: test_web_components:
name: Web Components name: Web Components
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 # Component tests require Node.js 16+ (they require ESM via TS)
node-version: 16
- run: npm i -g npm@8
- run: npm ci - run: npm ci
env: env:
DEBUG: pw:install DEBUG: pw:install
- run: npm run build - run: npm run build
- run: npx playwright install --with-deps - run: npx playwright install --with-deps
- run: npm run test-html-reporter - run: npm run test-html-reporter
env: if: always() && matrix.os != 'ubuntu-latest'
PWTEST_BOT_NAME: "web-components-html-reporter" - run: xvfb-run npm run test-html-reporter
- name: Upload blob report if: always() && matrix.os == 'ubuntu-latest'
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-blob-report
with:
report_dir: packages/html-reporter/blob-report
job_name: "web-components-html-reporter"
- run: npm run test-web - run: npm run test-web
if: ${{ !cancelled() }} if: always() && matrix.os != 'ubuntu-latest'
env: - run: xvfb-run npm run test-web
PWTEST_BOT_NAME: "web-components-web" if: always() && matrix.os == 'ubuntu-latest'
- name: Upload blob report
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-blob-report
with:
report_dir: packages/web/blob-report
job_name: "web-components-web"
test_vscode_extension: test-package-installations:
name: VSCode Extension name: "Installation Test ${{ matrix.os }} (${{ matrix.node_version }})"
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
env:
PWTEST_BOT_NAME: "vscode-extension"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
env:
DEBUG: pw:install
- run: npm run build
- run: npx playwright install chromium
- name: Checkout extension
run: git clone https://github.com/microsoft/playwright-vscode.git
- name: Print extension revision
run: git rev-parse HEAD
working-directory: ./playwright-vscode
- name: Remove @playwright/test from extension dependencies
run: node -e "const p = require('./package.json'); delete p.devDependencies['@playwright/test']; fs.writeFileSync('./package.json', JSON.stringify(p, null, 2));"
working-directory: ./playwright-vscode
- name: Build extension
run: npm install && npm run build
working-directory: ./playwright-vscode
- name: Run extension tests
run: npm run test -- --workers=1
working-directory: ./playwright-vscode
- name: Upload blob report
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-blob-report
with:
report_dir: playwright-vscode/blob-report
job_name: ${{ env.PWTEST_BOT_NAME }}
test_package_installations:
name: "Installation Test ${{ matrix.os }}"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -206,27 +178,24 @@ jobs:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
- windows-latest - windows-latest
runs-on: ${{ matrix.os }} node_version:
- "^18.0.0"
timeout-minutes: 30 timeout-minutes: 30
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- run: npm install -g yarn@1 - uses: actions/setup-node@v2
- run: npm install -g pnpm@8
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with: with:
command: npm run itest node-version: ${{ matrix.node_version }}
bot-name: "package-installations-${{ matrix.os }}" - run: npm i -g npm@8
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - run: npm run build
- run: npx playwright install-deps
- run: npm run itest
if: matrix.os != 'ubuntu-latest'
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run itest
if: matrix.os == 'ubuntu-latest'
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash

View file

@ -17,162 +17,199 @@ on:
env: env:
# Force terminal colors. @see https://www.npmjs.com/package/colors # Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1 FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1 FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
jobs: jobs:
test_linux: test_linux:
name: ${{ matrix.os }} (${{ matrix.browser }}) name: ${{ matrix.os }} (${{ matrix.browser }})
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
os: [ubuntu-20.04, ubuntu-24.04] os: [ubuntu-18.04]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* - run: npm i -g npm@8
bot-name: "${{ matrix.browser }}-${{ matrix.os }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: always()
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results
path: test-results
test_mac: test_mac:
name: ${{ matrix.os }} (${{ matrix.browser }}) name: ${{ matrix.os }} (${{ matrix.browser }})
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
# Intel: *-large os: [macos-10.15, macos-11.0]
# Arm64: *-xlarge
os: [macos-13-large, macos-13-xlarge, macos-14-large, macos-14-xlarge]
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
include:
- os: macos-15-large
browser: webkit
- os: macos-15-xlarge
browser: webkit
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* - run: npm i -g npm@8
bot-name: "${{ matrix.browser }}-${{ matrix.os }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: npm run test -- --project=${{ matrix.browser }}
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results
path: test-results
test_win: test_win:
name: "Windows" name: "Windows"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* ${{ matrix.browser == 'firefox' && '--workers 1' || '' }} - run: npm i -g npm@8
bot-name: "${{ matrix.browser }}-windows-latest" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: npm run test -- --project=${{ matrix.browser }}
shell: bash
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: ${{ matrix.browser }}-win-test-results
path: test-results
test-package-installations-other-node-versions: test-package-installations-older-node-versions:
name: "Installation Test ${{ matrix.os }} (${{ matrix.node_version }})" name: "Installation Test ${{ matrix.os }} (${{ matrix.node_version }})"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
node_version: 20 node_version: "^14.1.0" # pre 14.1, zip extraction was broken (https://github.com/microsoft/playwright/issues/1988)
- os: ubuntu-latest - os: ubuntu-latest
node_version: 22 node_version: "^16.0.0"
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- run: npm install -g yarn@1 - uses: actions/setup-node@v2
- run: npm install -g pnpm@8
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with: with:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
command: npm run itest - run: npm i -g npm@8
bot-name: "package-installations-${{ matrix.os }}-node${{ matrix.node_version }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - run: npm run build
- run: npx playwright install-deps
- run: npm run itest
if: matrix.os != 'ubuntu-latest'
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run itest
if: matrix.os == 'ubuntu-latest'
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
headed_tests: headed_tests:
name: "headed ${{ matrix.browser }} (${{ matrix.os }})" name: "headed ${{ matrix.browser }} (${{ matrix.os }})"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
os: [ubuntu-24.04, macos-14-xlarge, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
include:
# We have different binaries per Ubuntu version for WebKit.
- browser: webkit
os: ubuntu-20.04
- browser: webkit
os: ubuntu-22.04
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* --headed - run: npm i -g npm@8
bot-name: "${{ matrix.browser }}-headed-${{ matrix.os }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --headed
if: always() && matrix.os == 'ubuntu-latest'
- run: npm run test -- --project=${{ matrix.browser }} --headed
if: always() && matrix.os != 'ubuntu-latest'
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: always() && matrix.os == 'ubuntu-latest'
with:
name: headful-${{ matrix.browser }}-linux-test-results
path: test-results
transport_linux: transport_linux:
name: "Transport" name: "Transport"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
mode: [driver, service] mode: [driver, service]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: chromium node-version: 14
command: npm run ctest - run: npm i -g npm@8
bot-name: "${{ matrix.mode }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project='Chromium page tests'
if: matrix.mode == 'service'
env: env:
PWTEST_MODE: ${{ matrix.mode }} PWTEST_MODE: ${{ matrix.mode }}
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
if: matrix.mode != 'service'
env:
PWTEST_MODE: ${{ matrix.mode }}
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: mode-${{ matrix.mode }}-linux-test-results
path: test-results
tracing_linux: tracing_linux:
name: Tracing ${{ matrix.browser }} ${{ matrix.channel }} name: Tracing ${{ matrix.browser }} ${{ matrix.channel }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -184,137 +221,559 @@ jobs:
channel: chromium-tip-of-tree channel: chromium-tip-of-tree
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium ${{ matrix.channel }} node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* - run: npm i -g npm@8
bot-name: "tracing-${{ matrix.channel || matrix.browser }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium ${{ matrix.channel }}
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
env: env:
PWTEST_TRACE: 1 PWTEST_TRACE: 1
PWTEST_CHANNEL: ${{ matrix.channel }} PWTEST_CHANNEL: ${{ matrix.channel }}
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
test_chromium_channels: chrome_stable_linux:
name: Test ${{ matrix.channel }} on ${{ matrix.runs-on }} name: "Chrome Stable (Linux)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} runs-on: ubuntu-20.04
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
channel: [chrome, chrome-beta, msedge, msedge-beta, msedge-dev]
runs-on: [ubuntu-20.04, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.channel }} node-version: 14
command: npm run ctest - run: npm i -g npm@8
bot-name: ${{ matrix.channel }}-${{ matrix.runs-on }} - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env: env:
PWTEST_CHANNEL: ${{ matrix.channel }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: chrome
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-stable-linux-test-results
path: test-results
chrome_stable_win:
name: "Chrome Stable (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: chrome
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-stable-win-test-results
path: test-results
chrome_stable_mac:
name: "Chrome Stable (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome
- run: npm run ctest
env:
PWTEST_CHANNEL: chrome
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-stable-mac-test-results
path: test-results
chromium_tot: chromium_tot:
name: Chromium tip-of-tree ${{ matrix.os }}${{ matrix.headed }} name: Chromium TOT ${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-20.04, macos-13, windows-latest] # note: unbuntu-latest is covered in tests_primary
headed: ['--headed', ''] os: [ubuntu-18.04, macos-10.15, macos-11.0, windows-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: chromium-tip-of-tree node-version: 14
command: npm run ctest -- ${{ matrix.headed }} - run: npm i -g npm@8
bot-name: "chromium-tip-of-tree-${{ matrix.os }}${{ matrix.headed }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - run: npm run build
- run: npx playwright install --with-deps chromium-tip-of-tree
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
if: matrix.os == 'ubuntu-18.04'
env: env:
PWTEST_CHANNEL: chromium-tip-of-tree PWTEST_CHANNEL: chromium-tip-of-tree
- run: npm run ctest
chromium_tot_headless_shell: if: matrix.os != 'ubuntu-18.04'
name: Chromium tip-of-tree headless-shell-${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chromium-tip-of-tree-headless-shell
command: npm run ctest
bot-name: "chromium-tip-of-tree-headless-shell-${{ matrix.os }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env: env:
PWTEST_CHANNEL: chromium-tip-of-tree-headless-shell PWTEST_CHANNEL: chromium-tip-of-tree
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: always()
with:
name: chromium-tot-${{ matrix.os }}-test-results
path: test-results
firefox_beta: chromium_tot_headed:
name: Firefox Beta ${{ matrix.os }} name: Chromium TOT headed ${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-20.04, windows-latest, macos-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: firefox-beta chromium node-version: 14
command: npm run ftest - run: npm i -g npm@8
bot-name: "firefox-beta-${{ matrix.os }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - run: npm run build
- run: npx playwright install --with-deps chromium-tip-of-tree
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest -- --headed
if: matrix.os == 'ubuntu-latest'
env:
PWTEST_CHANNEL: chromium-tip-of-tree
- run: npm run ctest -- --headed
if: matrix.os != 'ubuntu-latest'
env:
PWTEST_CHANNEL: chromium-tip-of-tree
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: always()
with:
name: chromium-tot-headed-${{ matrix.os }}-test-results
path: test-results
firefox_beta_linux:
name: "Firefox Beta (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps firefox-beta chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ftest
env: env:
PWTEST_CHANNEL: firefox-beta PWTEST_CHANNEL: firefox-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: firefox-beta-linux-test-results
path: test-results
firefox_beta_win:
name: "Firefox Beta (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps firefox-beta chromium
- run: npm run ftest
shell: bash
env:
PWTEST_CHANNEL: firefox-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: firefox-beta-win-test-results
path: test-results
firefox_beta_mac:
name: "Firefox Beta (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps firefox-beta chromium
- run: npm run ftest
env:
PWTEST_CHANNEL: firefox-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: firefox-beta-mac-test-results
path: test-results
edge_stable_mac:
name: "Edge Stable (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge
- run: npm run ctest
env:
PWTEST_CHANNEL: msedge
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: msedge-stable-mac-test-results
path: test-results
edge_stable_win:
name: "Edge Stable (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: msedge
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-stable-win-test-results
path: test-results
edge_stable_linux:
name: "Edge Stable (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: msedge
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-stable-linux-test-results
path: test-results
edge_beta_mac:
name: "Edge Beta (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-beta
- run: npm run ctest
env:
PWTEST_CHANNEL: msedge-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: msedge-beta-mac-test-results
path: test-results
edge_beta_win:
name: "Edge Beta (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-beta
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: msedge-beta
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-beta-win-test-results
path: test-results
edge_beta_linux:
name: "Edge Beta (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-beta
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: msedge-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-beta-linux-test-results
path: test-results
edge_dev_mac:
name: "Edge Dev (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-dev
- run: npm run ctest
env:
PWTEST_CHANNEL: msedge-dev
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: msedge-dev-mac-test-results
path: test-results
edge_dev_win:
name: "Edge Dev (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-dev
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: msedge-dev
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-dev-win-test-results
path: test-results
edge_dev_linux:
name: "Edge Dev (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps msedge-dev
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: msedge-dev
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-dev-linux-test-results
path: test-results
chrome_beta_linux:
name: "Chrome Beta (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome-beta
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: chrome-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-beta-linux-test-results
path: test-results
chrome_beta_win:
name: "Chrome Beta (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome-beta
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: chrome-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
shell: bash
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-beta-win-test-results
path: test-results
chrome_beta_mac:
name: "Chrome Beta (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm i -g npm@8
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps chrome-beta
- run: npm run ctest
env:
PWTEST_CHANNEL: chrome-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: chrome-beta-mac-test-results
path: test-results
build-playwright-driver: build-playwright-driver:
name: "build-playwright-driver" name: "build-playwright-driver"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v2
with: with:
node-version: 18 node-version: 14
- run: npm i -g npm@8
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npx playwright install-deps - run: npx playwright install-deps
- run: utils/build/build-playwright-driver.sh - run: utils/build/build-playwright-driver.sh
test_channel_chromium:
name: Test channel=chromium
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
# TODO: this should pass --no-shell.
# However, codegen tests do not inherit the channel and try to launch headless shell.
browsers-to-install: chromium
command: npm run ctest
bot-name: "channel-chromium-${{ matrix.runs-on }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chromium

View file

@ -1,70 +0,0 @@
name: "tests service"
on:
workflow_dispatch:
env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs:
test:
name: "Service"
strategy:
fail-fast: false
matrix:
service-os: [linux, windows]
browser: [chromium, firefox, webkit]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --workers=10 --retries=0
env:
PWTEST_MODE: service2
PWTEST_TRACE: 1
PWTEST_BOT_NAME: "${{ matrix.browser }}-${{ matrix.service-os }}-service"
PLAYWRIGHT_SERVICE_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_KEY }}
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
PLAYWRIGHT_SERVICE_OS: ${{ matrix.service-os }}
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
- name: Upload blob report to GitHub
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: all-blob-reports
path: blob-report
retention-days: 2
merge_reports:
name: "Merge reports"
needs: [test]
if: ${{ !cancelled() }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- name: Download blob report artifact
uses: actions/download-artifact@v4
with:
name: all-blob-reports
path: all-blob-reports
- run: npx playwright merge-reports --reporter markdown,html ./all-blob-reports
- name: Upload HTML report to Azure
run: |
REPORT_DIR='run-service-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}'
azcopy cp --recursive "./playwright-report/*" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html#?q=s:failed"
env:
AZCOPY_AUTO_LOGIN_TYPE: SPN
AZCOPY_SPA_APPLICATION_ID: '${{ secrets.AZCOPY_SPA_APPLICATION_ID }}'
AZCOPY_SPA_CLIENT_SECRET: '${{ secrets.AZCOPY_SPA_CLIENT_SECRET }}'
AZCOPY_TENANT_ID: '${{ secrets.AZCOPY_TENANT_ID }}'

View file

@ -9,30 +9,35 @@ on:
env: env:
# Force terminal colors. @see https://www.npmjs.com/package/colors # Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1 FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1 FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
jobs: jobs:
video_linux: video_linux:
name: "Video Linux" name: "Video Linux"
environment: allow-uploading-flakiness-results
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
os: [ubuntu-20.04, ubuntu-22.04] runs-on: ubuntu-20.04
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ./.github/actions/run-test - uses: actions/setup-node@v2
with: with:
browsers-to-install: ${{ matrix.browser }} chromium node-version: 14
command: npm run test -- --project=${{ matrix.browser }}-* - run: npm i -g npm@8
bot-name: "${{ matrix.browser }}-${{ matrix.os }}" - run: npm ci
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} env:
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} DEBUG: pw:install
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
env: env:
PWTEST_VIDEO: 1 PWTEST_VIDEO: 1
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: video-${{ matrix.browser }}-linux-test-results
path: test-results

View file

@ -0,0 +1,31 @@
name: "Trigger: Chromium Builds"
on:
workflow_dispatch:
inputs:
ref:
description: 'Playwright SHA / ref to build Chromium'
required: true
default: 'main'
push:
branches:
- main
- release-*
paths:
- browser_patches/chromium/BUILD_NUMBER
- .github/workflows/trigger_build_chromium.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data "{\"event_type\": \"build_chromium\", \"client_payload\": {\"ref\": \"${GHREF}\"}}" \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GHREF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.sha }}

View file

@ -0,0 +1,31 @@
name: "Trigger: Chromium Tip Of Tree Builds"
on:
workflow_dispatch:
inputs:
ref:
description: 'Playwright SHA / ref to build Chromium Tip Of Tree'
required: true
default: 'main'
push:
branches:
- main
- release-*
paths:
- browser_patches/chromium-tip-of-tree/BUILD_NUMBER
- .github/workflows/trigger_build_chromium_tip_of_tree.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data "{\"event_type\": \"build_chromium_tip_of_tree\", \"client_payload\": {\"ref\": \"${GHREF}\"}}" \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GHREF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.sha }}

View file

@ -0,0 +1,33 @@
name: "Trigger: Chromium with Symbols Builds"
on:
workflow_dispatch:
inputs:
ref:
description: 'Playwright SHA / ref to build Chromium With Symbols'
required: true
default: 'main'
release:
types: [published]
push:
branches:
- release-*
paths:
- browser_patches/chromium/BUILD_NUMBER
- .github/workflows/trigger_build_chromium_with_symbols.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data "{\"event_type\": \"build_chromium_with_symbols\", \"client_payload\": {\"ref\": \"${GHREF}\"}}" \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GHREF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.sha }}

View file

@ -0,0 +1,24 @@
name: "FFMPEG Builder"
on:
push:
branches:
- main
- release-*
paths:
- browser_patches/ffmpeg/BUILD_NUMBER
- .github/workflows/trigger_build_ffmpeg.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "build_ffmpeg"}' \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

View file

@ -0,0 +1,24 @@
name: "Firefox Builder"
on:
push:
branches:
- main
- release-*
paths:
- browser_patches/firefox/BUILD_NUMBER
- .github/workflows/trigger_build_firefox.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "build_firefox"}' \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

View file

@ -0,0 +1,24 @@
name: "Firefox Beta Builder"
on:
push:
branches:
- main
- release-*
paths:
- browser_patches/firefox-beta/BUILD_NUMBER
- .github/workflows/trigger_build_firefox_beta.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "build_firefox_beta"}' \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

View file

@ -0,0 +1,24 @@
name: "WebKit Builder"
on:
push:
branches:
- main
- release-*
paths:
- browser_patches/webkit/BUILD_NUMBER
- .github/workflows/trigger_build_webkit.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "build_webkit"}' \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

View file

@ -0,0 +1,24 @@
name: "WinLDD Builder"
on:
push:
branches:
- main
- release-*
paths:
- browser_patches/winldd/BUILD_NUMBER
- .github/workflows/trigger_build_winldd.yml
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "build_winldd"}' \
https://api.github.com/repos/microsoft/playwright-internal/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

View file

@ -9,13 +9,13 @@ on:
jobs: jobs:
trigger: trigger:
name: "trigger" name: "trigger"
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- run: | - run: |
curl -X POST \ curl -X POST \
-H "Accept: application/vnd.github.v3+json" \ -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \ -H "Authorization: token ${GH_TOKEN}" \
--data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \ --data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
https://api.github.com/repos/microsoft/playwright-browsers/dispatches https://api.github.com/repos/microsoft/playwright-internal/dispatches
env: env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }} GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

9
.gitignore vendored
View file

@ -7,11 +7,9 @@ node_modules/
*.swp *.swp
*.pyc *.pyc
.vscode .vscode
.mono
.idea .idea
yarn.lock yarn.lock
/packages/playwright-core/src/generated /packages/playwright-core/src/generated/*
/packages/playwright-ct-core/src/generated
packages/*/lib/ packages/*/lib/
drivers/ drivers/
.android-sdk/ .android-sdk/
@ -20,19 +18,14 @@ nohup.out
.trace .trace
.tmp .tmp
allure* allure*
blob-report
playwright-report playwright-report
test-results test-results
/demo/ /demo/
/packages/*/LICENSE /packages/*/LICENSE
/packages/*/NOTICE /packages/*/NOTICE
/packages/playwright/README.md /packages/playwright/README.md
/packages/playwright-test/README.md
/packages/playwright-core/api.json /packages/playwright-core/api.json
.env .env
/tests/installation/output/ /tests/installation/output/
/tests/installation/.registry.json /tests/installation/.registry.json
.cache/ .cache/
.eslintcache
playwright.env
/firefox/

View file

@ -1,87 +1,78 @@
# Contributing # Contributing
## Choose an issue - [How to Contribute](#how-to-contribute)
* [Getting Code](#getting-code)
* [Code reviews](#code-reviews)
* [Code Style](#code-style)
* [API guidelines](#api-guidelines)
* [Commit Messages](#commit-messages)
* [Writing Documentation](#writing-documentation)
* [Adding New Dependencies](#adding-new-dependencies)
* [Running & Writing Tests](#running--writing-tests)
* [Public API Coverage](#public-api-coverage)
- [Contributor License Agreement](#contributor-license-agreement)
* [Code of Conduct](#code-of-conduct)
Playwright **requires an issue** for every contribution, except for minor documentation updates. We strongly recommend to pick an issue labeled `open-to-a-pull-request` for your first contribution to the project. ## How to Contribute
If you are passioned about a bug/feature, but cannot find an issue describing it, **file an issue first**. This will facilitate the discussion and you might get some early feedback from project maintainers before spending your time on creating a pull request. ### Getting Code
## Make a change 1. Clone this repository
Make sure you're running Node.js 20 or later.
```bash
node --version
```
Clone the repository. If you plan to send a pull request, it might be better to [fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) first.
```bash ```bash
git clone https://github.com/microsoft/playwright git clone https://github.com/microsoft/playwright
cd playwright cd playwright
``` ```
Install dependencies and run the build in watch mode. 2. Install dependencies
```bash ```bash
npm ci npm install
npm run watch
npx playwright install
``` ```
**Experimental dev mode with Hot Module Replacement for recorder/trace-viewer/UI Mode** 3. Build Playwright
``` ```bash
PW_HMR=1 npm run watch npm run build
PW_HMR=1 npx playwright show-trace
PW_HMR=1 npm run ctest -- --ui
PW_HMR=1 npx playwright codegen
PW_HMR=1 npx playwright show-report
``` ```
Playwright is a multi-package repository that uses npm workspaces. For browser APIs, look at [`packages/playwright-core`](https://github.com/microsoft/playwright/blob/main/packages/playwright-core). For test runner, see [`packages/playwright`](https://github.com/microsoft/playwright/blob/main/packages/playwright). 4. Run all Playwright tests locally. For more information about tests, read [Running & Writing Tests](#running--writing-tests).
Note that some files are generated by the build, so the watch process might override your changes if done in the wrong file. For example, TypeScript types for the API are generated from the [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src). ```bash
npm test
```
Coding style is fully defined in [.eslintrc](https://github.com/microsoft/playwright/blob/main/.eslintrc.js). Before creating a pull request, or at any moment during development, run linter to check all kinds of things: ### Code reviews
```bash
npm run lint
```
Comments should have an explicit purpose and should improve readability rather than hinder it. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory. All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
### Write documentation ### Code Style
Every part of the public API should be documented in [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src), in the same change that adds/changes the API. We use markdown files with custom structure to specify the API. Take a look around for an example. - Coding style is fully defined in [.eslintrc](https://github.com/microsoft/playwright/blob/main/.eslintrc.js)
- Comments should be generally avoided. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.
Various other files are generated from the API specification. If you are running `npm run watch`, these will be re-generated automatically. To run code linter, use:
Larger changes will require updates to the documentation guides as well. This will be made clear during the code review. ```bash
npm run eslint
```
## Add a test ### API guidelines
Playwright requires a test for almost any new or modified functionality. An exception would be a pure refactoring, but chances are you are doing more than that. When authoring new API methods, consider the following:
There are multiple [test suites](https://github.com/microsoft/playwright/blob/main/tests) in Playwright that will be executed on the CI. The two most important that you need to run locally are: - Expose as little information as needed. When in doubt, dont expose new information.
- Methods are used in favor of getters/setters.
- The only exception is namespaces, e.g. `page.keyboard` and `page.coverage`
- All string literals must be lowercase. This includes event names and option values.
- Avoid adding "sugar" API (API that is trivially implementable in user-space) unless they're **very** common.
- Library tests cover APIs not related to the test runner. ### Commit Messages
```bash
# fast path runs all tests in Chromium
npm run ctest
# slow path runs all tests in three browsers Commit messages should follow the Semantic Commit Messages format:
npm run test
```
- Test runner tests.
```bash
npm run ttest
```
Since Playwright tests are using Playwright under the hood, everything from our documentation applies, for example [this guide on running and debugging tests](https://playwright.dev/docs/running-tests#running-tests).
Note that tests should be *hermetic*, and not depend on external services. Tests should work on all three platforms: macOS, Linux and Windows.
## Write a commit message
Commit messages should follow the [Semantic Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/) format:
``` ```
label(namespace): title label(namespace): title
@ -92,57 +83,128 @@ footer
``` ```
1. *label* is one of the following: 1. *label* is one of the following:
- `fix` - bug fixes - `fix` - playwright bug fixes.
- `feat` - new features - `feat` - playwright features.
- `docs` - documentation-only changes - `docs` - changes to docs, e.g. `docs(api.md): ..` to change documentation.
- `test` - test-only changes - `test` - changes to playwright tests infrastructure.
- `devops` - changes to the CI or build - `devops` - build-related work, e.g. CI related patches and general changes to the browser build infrastructure
- `chore` - everything that doesn't fall under previous categories - `chore` - everything that doesn't fall under previous categories
1. *namespace* is put in parenthesis after label and is optional. Must be lowercase. 2. *namespace* is put in parenthesis after label and is optional. Must be lowercase.
1. *title* is a brief summary of changes. 3. *title* is a brief summary of changes.
1. *description* is **optional**, new-line separated from title and is in present tense. 4. *description* is **optional**, new-line separated from title and is in present tense.
1. *footer* is **optional**, new-line separated from *description* and contains "fixes" / "references" attribution to github issues. 5. *footer* is **optional**, new-line separated from *description* and contains "fixes" / "references" attribution to github issues.
Example: Example:
``` ```
feat(trace viewer): network panel filtering fix(firefox): make sure session cookies work
This patch adds a filtering toolbar to the network panel. This patch fixes session cookies in the firefox browser.
<link to a screenshot>
Fixes #123, references #234. Fixes #123, fixes #234
``` ```
## Send a pull request ### Writing Documentation
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests. All API classes, methods, and events should have a description in [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src). There's a [documentation linter](https://github.com/microsoft/playwright/tree/main/utils/doclint) which makes sure documentation is aligned with the codebase.
After a successful code review, one of the maintainers will merge your pull request. Congratulations! To run the documentation linter, use:
## More details ```bash
npm run doc
```
**No new dependencies** ### Adding New Dependencies
There is a very high bar for new dependencies, including updating to a new version of an existing dependency. We recommend to explicitly discuss this in an issue and get a green light from a maintainer, before creating a pull request that updates dependencies. For all dependencies (both installation and development):
- **Do not add** a dependency if the desired functionality is easily implementable.
- If adding a dependency, it should be well-maintained and trustworthy.
**Custom browser build** A barrier for introducing new installation dependencies is especially high:
- **Do not add** installation dependency unless it's critical to project success.
### Running & Writing Tests
- Every feature should be accompanied by a test.
- Every public api event/method should be accompanied by a test.
- Tests should be *hermetic*. Tests should not depend on external services.
- Tests should work on all three platforms: Mac, Linux and Win. This is especially important for screenshot tests.
Playwright tests are located in [`tests`](https://github.com/microsoft/playwright/blob/main/tests) and use `@playwright/test` test runner.
These are integration tests, making sure public API methods and events work as expected.
- To run all tests:
```bash
npm run test
```
- To run all tests in Chromium
```bash
npm run ctest # also `ftest` for firefox and `wtest` for WebKit
```
- To run a specific test, substitute `it` with `it.only`, or use the `--grep 'My test'` CLI parameter:
```js
...
// Using "it.only" to run a specific test
it.only('should work', async ({server, page}) => {
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
// or
playwright test --config=xxx --grep 'should work'
```
- To disable a specific test, substitute `it` with `it.skip`:
```js
...
// Using "it.skip" to skip a specific test
it.skip('should work', async ({server, page}) => {
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
```
- To run tests in non-headless (headed) mode:
```bash
npm run ctest -- --headed
```
- To run tests with custom browser executable, specify `CRPATH`, `WKPATH` or `FFPATH` env variable that points to browser executable:
To run tests with custom browser executable, specify `CRPATH`, `WKPATH` or `FFPATH` env variable that points to browser executable:
```bash ```bash
CRPATH=<path-to-executable> npm run ctest CRPATH=<path-to-executable> npm run ctest
``` ```
You will also find `DEBUG=pw:browser` useful for debugging custom builds. - To run tests in slow-mode:
**Building documentation site** ```bash
SLOW_MO=500 npm run wtest -- --headed
```
The [playwright.dev](https://playwright.dev/) documentation site lives in a separate repository, and documentation from [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src) is frequently rolled there. - When should a test be marked with `skip` or `fail`?
Most of the time this should not concern you. However, if you are doing something unusual in the docs, you can build locally and test how your changes will look in practice: - **`skip(condition)`**: This test *should ***never*** work* for `condition`
1. Clone the [microsoft/playwright.dev](https://github.com/microsoft/playwright.dev) repo. where `condition` is usually a certain browser like `FFOX` (for Firefox),
1. Follow [the playwright.dev README instructions to "roll docs"](https://github.com/microsoft/playwright.dev/#roll-docs) against your local `playwright` repo with your changes in progress. `WEBKIT` (for WebKit), and `CHROMIUM` (for Chromium).
1. Follow [the playwright.dev README instructions to "run dev server"](https://github.com/microsoft/playwright.dev/#run-dev-server) to view your changes.
For example, the [alt-click downloads test](https://github.com/microsoft/playwright/blob/471ccc72d3f0847caa36f629b394a028c7750d93/test/download.spec.js#L86) is marked
with `skip(FFOX)` since an alt-click in Firefox will not produce a download
even if a person was driving the browser.
- **`fail(condition)`**: This test *should ***eventually*** work* for `condition`
where `condition` is usually a certain browser like `FFOX` (for Firefox),
`WEBKIT` (for WebKit), and `CHROMIUM` (for Chromium).
For example, the [alt-click downloads test](https://github.com/microsoft/playwright/blob/471ccc72d3f0847caa36f629b394a028c7750d93/test/download.spec.js#L86) is marked
with `fail(CHROMIUM || WEBKIT)` since Playwright performing these actions
currently diverges from what a user would experience driving a Chromium or
WebKit.
## Contributor License Agreement ## Contributor License Agreement

View file

@ -1,35 +0,0 @@
# How to File a Bug Report That Actually Gets Resolved
Make sure youre on the latest Playwright release before filing. Check existing GitHub issues to avoid duplicates.
## Use the Template
Follow the **Bug Report** template. It guides you step-by-step:
- Fill it out thoroughly.
- Clearly list the steps needed to reproduce the bug.
- Provide what you expected to see versus what happened in reality.
- Include system info from `npx envinfo --preset playwright`.
## Keep Your Repro Minimal
We can't parse your entire code base. Reduce it down to the absolute essentials:
- Start a fresh project (`npm init playwright@latest new-project`).
- Add only the code/DOM needed to show the problem.
- Only use major frameworks if necessary (React, Angular, static HTTP server, etc.).
- Avoid adding extra libraries unless absolutely necessary. Note that we won't install any suspect dependencies.
## Why This Matters
- Most issues that lack a repro turn out to be misconfigurations or usage errors.
- We can't fix problems if we cant reproduce them ourselves.
- We cant debug entire private projects or handle sensitive credentials.
- Each confirmed bug will have a test in our repo, so your repro must be as clean as possible.
## More Help
- [Stack Overflows Minimal Reproducible Example Guide](https://stackoverflow.com/help/minimal-reproducible-example)
- [Playwright Debugging Tools](https://playwright.dev/docs/debug)
## Bottom Line
A well-isolated bug speeds up verification and resolution. Minimal, public repro or its unlikely we can assist.

View file

@ -1,18 +1,18 @@
# 🎭 Playwright # 🎭 Playwright
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-134.0.6998.35-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-135.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-18.2-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord) [![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-102.0.5005.40-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-99.0.1-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-15.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright) ## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright/)
Playwright is a framework for Web Testing and Automation. It allows testing [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**. Playwright is a framework for Web Testing and Automation. It allows testing [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**.
| | Linux | macOS | Windows | | | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: | | :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->134.0.6998.35<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | Chromium <!-- GEN:chromium-version -->102.0.5005.40<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->18.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->135.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | Firefox <!-- GEN:firefox-version -->99.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details. Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/library#system-requirements) for details.
Looking for Playwright for [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)? Looking for Playwright for [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)?
@ -46,25 +46,26 @@ npx playwright install
You can optionally install only selected browsers, see [install browsers](https://playwright.dev/docs/cli#install-browsers) for more details. Or you can install no browsers at all and use existing [browser channels](https://playwright.dev/docs/browsers). You can optionally install only selected browsers, see [install browsers](https://playwright.dev/docs/cli#install-browsers) for more details. Or you can install no browsers at all and use existing [browser channels](https://playwright.dev/docs/browsers).
* [Getting started](https://playwright.dev/docs/intro) * [Getting started](https://playwright.dev/docs/intro)
* [Installation configuration](https://playwright.dev/docs/installation)
* [API reference](https://playwright.dev/docs/api/class-playwright) * [API reference](https://playwright.dev/docs/api/class-playwright)
## Capabilities ## Capabilities
### Resilient • No flaky tests ### Resilient • No flaky tests
**Auto-wait**. Playwright waits for elements to be actionable prior to performing actions. It also has a rich set of introspection events. The combination of the two eliminates the need for artificial timeouts - a primary cause of flaky tests. **Auto-wait**. Playwright waits for elements to be actionable prior to performing actions. It also has rich set of introspection events. The combination of the two eliminate the need for artificial timeouts - primary cause of flaky tests.
**Web-first assertions**. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met. **Web-first assertions**. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met.
**Tracing**. Configure test retry strategy, capture execution trace, videos and screenshots to eliminate flakes. **Tracing**. Configure test retry strategy, capture execution trace, videos, screenshots to eliminate flakes.
### No trade-offs • No limits ### No trade-offs • No limits
Browsers run web content belonging to different origins in different processes. Playwright is aligned with the architecture of the modern browsers and runs tests out-of-process. This makes Playwright free of the typical in-process test runner limitations. Browsers run web content belonging to different origins in different processes. Playwright is aligned with the modern browsers architecture and runs tests out-of-process. This makes Playwright free of the typical in-process test runner limitations.
**Multiple everything**. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test. **Multiple everything**. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test.
**Trusted events**. Hover elements, interact with dynamic controls and produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user. **Trusted events**. Hover elements, interact with dynamic controls, produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user.
Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly. Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly.
@ -76,11 +77,11 @@ Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow
### Powerful Tooling ### Powerful Tooling
**[Codegen](https://playwright.dev/docs/codegen)**. Generate tests by recording your actions. Save them into any language. **Codegen**. Generate tests by recording your actions. Save them into any language.
**[Playwright inspector](https://playwright.dev/docs/inspector)**. Inspect page, generate selectors, step through the test execution, see click points and explore execution logs. **Playwright inspector**. Inspect page, generate selectors, step through the test execution, see click points, explore execution logs.
**[Trace Viewer](https://playwright.dev/docs/trace-viewer)**. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source and many more. **Trace Viewer**. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source and many more.
Looking for Playwright for [TypeScript](https://playwright.dev/docs/intro), [JavaScript](https://playwright.dev/docs/intro), [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)? Looking for Playwright for [TypeScript](https://playwright.dev/docs/intro), [JavaScript](https://playwright.dev/docs/intro), [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)?
@ -90,20 +91,20 @@ To learn how to run these Playwright Test examples, check out our [getting start
#### Page screenshot #### Page screenshot
This code snippet navigates to Playwright homepage and saves a screenshot. This code snippet navigates to whatsmyuseragent.org and saves a screenshot.
```TypeScript ```TypeScript
import { test } from '@playwright/test'; import { test } from '@playwright/test';
test('Page Screenshot', async ({ page }) => { test('Page Screenshot', async ({ page }) => {
await page.goto('https://playwright.dev/'); await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `example.png` }); await page.screenshot({ path: `example.png` });
}); });
``` ```
#### Mobile and geolocation #### Mobile and geolocation
This snippet emulates Mobile Safari on a device at given geolocation, navigates to maps.google.com, performs the action and takes a screenshot. This snippet emulates Mobile Safari on a device at a given geolocation, navigates to maps.google.com, performs action and takes a screenshot.
```TypeScript ```TypeScript
import { test, devices } from '@playwright/test'; import { test, devices } from '@playwright/test';
@ -117,7 +118,7 @@ test.use({
test('Mobile and geolocation', async ({ page }) => { test('Mobile and geolocation', async ({ page }) => {
await page.goto('https://maps.google.com'); await page.goto('https://maps.google.com');
await page.getByText('Your location').click(); await page.locator('text="Your location"').click();
await page.waitForRequest(/.*preview\/pwa/); await page.waitForRequest(/.*preview\/pwa/);
await page.screenshot({ path: 'colosseum-iphone.png' }); await page.screenshot({ path: 'colosseum-iphone.png' });
}); });
@ -162,7 +163,8 @@ test('Intercept network requests', async ({ page }) => {
## Resources ## Resources
* [Documentation](https://playwright.dev) * [Documentation](https://playwright.dev/docs/intro)
* [API reference](https://playwright.dev/docs/api/class-playwright/) * [API reference](https://playwright.dev/docs/api/class-playwright/)
* [Community showcase](https://playwright.dev/docs/showcase/)
* [Contribution guide](CONTRIBUTING.md) * [Contribution guide](CONTRIBUTING.md)
* [Changelog](https://github.com/microsoft/playwright/releases) * [Changelog](https://github.com/microsoft/playwright/releases)

View file

@ -1,18 +1,18 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK --> <!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
## Security ## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin). Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below. If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
## Reporting Security Issues ## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.** **Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report). Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
@ -28,7 +28,7 @@ Please include the requested information listed below (as much as you can provid
This information will help us triage your report more quickly. This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs. If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
## Preferred Languages ## Preferred Languages
@ -36,6 +36,6 @@ We prefer all communications to be in English.
## Policy ## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd). Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK --> <!-- END MICROSOFT SECURITY.MD BLOCK -->

View file

@ -1,17 +0,0 @@
# Support
## How to file issues and get help
This project uses GitHub issues to track bugs and feature requests. Please search the [existing issues][gh-issues] before filing new ones to avoid duplicates. For new issues, file your bug or feature request as a new issue using corresponding template.
For help and questions about using this project, please see the [docs site for Playwright][docs].
Join our community [Discord Server][discord-server] to connect with other developers using Playwright and ask questions in our 'help-playwright' forum.
## Microsoft Support Policy
Support for Playwright is limited to the resources listed above.
[gh-issues]: https://github.com/microsoft/playwright/issues/
[docs]: https://playwright.dev/
[discord-server]: https://aka.ms/playwright/discord

View file

@ -4,11 +4,11 @@
}, },
"plugins": [ "plugins": [
["@babel/plugin-transform-typescript", { "allowDeclareFields": true } ], ["@babel/plugin-transform-typescript", { "allowDeclareFields": true } ],
"@babel/plugin-transform-export-namespace-from", "@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-transform-class-properties", "@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-logical-assignment-operators", "@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-transform-nullish-coalescing-operator", "@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-transform-optional-chaining", "@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-modules-commonjs" "@babel/plugin-transform-modules-commonjs"
], ],
"ignore": [ "ignore": [

166
browser_patches/README.md Normal file
View file

@ -0,0 +1,166 @@
- [Contributing Browser Patches](#Contributing-browser-patches)
* [1. Setting up local browser checkout](#1-setting-up-local-browser-checkout)
* [2. Developing a new change](#2-developing-a-new-change)
* [3. Exporting your change to playwright repo](#3-exporting-your-change-to-playwright-repo)
* [4. Rolling Playwright to the new browser build](#4-rolling-playwright-to-the-new-browser-build)
- [Cheatsheet](#cheatsheet)
* [Firefox](#firefox)
- [stack trace](#stack-trace)
- [logging](#logging)
* [WebKit](#webkit)
- [Debugging Windows](#degugging-windows)
- [Enable core dumps on Linux](#enable-core-dumps-on-linux)
# Contributing Browser Patches
Firefox and WebKit have additional patches atop to expose necessary capabilities.
Ideally, all these changes should be upstreamed.
For the time being, it is possible to setup a browser checkout
and develop from there.
[WebKit upstream status](webkit/upstream_status.md)
## 1. Setting up local browser checkout
From the `playwright` repo, run the following command:
```bash
$ ./browser_patches/prepare_checkout.sh firefox
```
(you can optionally pass "webkit" for a webkit checkout)
This will create a firefox checkout at `$HOME/firefox`
> **NOTE:** this command downloads GBs of data.
This command will:
- create a `browser_upstream` remote in the checkout
- create a `playwright-build` branch and apply all playwright-required patches to it.
## 2. Developing a new change
You want to create a new branch off the `playwright-build` branch.
Assuming that you're under `$HOME/firefox` checkout:
```bash
$ git checkout -b my-new-feature playwright-build
$ # develop my feature on the my-new-feature branch ....
```
## 3. Exporting your change to playwright repo
Once you're happy with the work you did in the browser-land, you want to export it to the `playwright` repo.
Assuming that you're in the root of the `playwright` repo and that your browser checkout has your feature branch checked out:
```bash
$ ./browser_patches/export.sh firefox
```
This script will:
- create a new patch and put it to the `./browser_patches/firefox/patches/`
- update the `./browser_patches/firefox/UPSTREAM_CONFIG.sh` if necessary
- bump the `./browser_patches/firefox/BUILD_NUMBER` number.
The script will assume Firefox checkout is located at `$HOME/firefox`
Send a PR to the Playwright repo to be reviewed.
## 4. Rolling Playwright to the new browser build
Once the patch has been committed, the build bots will kick in, compile and upload a new browser version to all the platforms. Then you can roll the browser:
```bash
$ node utils/roll_browser.js chromium 123456
```
# Cheatsheet
## See browser stdout/stderr
Set the `DEBUG=pw:browser` environment variable to see it.
## Firefox
### Debug build
When compiling set the `FF_DEBUG_BUILD=1` environment variable.
#### Stack trace
In `//mozglue/misc/StackWalk.cpp` add
```c++
#define MOZ_DEMANGLE_SYMBOLS 1
```
In native code use
```c++
#include "mozilla/StackWalk.h"
// ...
MozWalkTheStack(stderr);
```
If the stack trace is still mangled `cat` it to `tools/rb/fix_linux_stack.py`
#### Logging
Upstream documentation: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging
```bash
MOZ_LOG=nsHttp:5
```
Module name is a string passed to the `mozilla::LazyLogModule` of the corresponding component, e.g.:
```c++
LazyLogModule gHttpLog("nsHttp");
```
Inside Juggler, you can use `dump('foo\n')`.
## WebKit
#### Logging
Inside Objective-C you can use [NSLog](https://developer.apple.com/documentation/foundation/1395275-nslog).
```
NSLog(@"Foobar value: %@", value);
```
#### Debugging windows
In `Source\WTF\wtf\win\DbgHelperWin.cpp` replace
```#if !defined(NDEBUG)``` with ```#if 1```
Then regular `WTFReportBacktrace()` works.
#### Debugging linux
`WTFReportBacktrace()` has been broken since [r283707](https://github.com/WebKit/WebKit/commit/de4ba48c8f229bc45042b543a514f6d88b551a64), see [this comment](https://bugs.webkit.org/show_bug.cgi?id=181916#c96). Revert that change locally to make backtraces work again. Otherwise addr2line -f can still be used to map addresses to function names.
#### Enable core dumps on Linux
```bash
mkdir -p /tmp/coredumps
sudo bash -c 'echo "/tmp/coredumps/core-pid_%p.dump" > /proc/sys/kernel/core_pattern'
ulimit -c unlimited
```
Then to read stack traces run the following command:
```bash
# To find out crashing process name
file core-pid_29652.dump
# Point gdb to the local binary of the crashed process and the core file
gdb $HOME/.cache/ms-playwright/webkit-1292/minibrowser-gtk/WebKitWebProcess core-pid_29652
# Inside gdb update .so library search path to the local one
set solib-search-path /home/yurys/.cache/ms-playwright/webkit-1292/minibrowser-gtk
# Finally print backtrace
bt
```

39
browser_patches/build.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: build.sh [firefox|webkit|firefox-beta]"
echo
exit 0
fi
if [[ $# == 0 ]]; then
echo "missing browser: 'firefox' or 'webkit'"
echo "try './build.sh --help' for more information"
exit 1
fi
CMD="$1"
shift
if [[ ("$CMD" == "firefox") || ("$CMD" == "firefox/") || ("$CMD" == "ff") ]]; then
bash ./firefox/build.sh "$@"
elif [[ ("$CMD" == "firefox-beta") || ("$CMD" == "ff-beta") ]]; then
bash ./firefox-beta/build.sh "$@"
elif [[ ("$CMD" == "webkit") || ("$CMD" == "webkit/") || ("$CMD" == "wk") ]]; then
bash ./webkit/build.sh "$@"
elif [[ ("$CMD" == "chromium") || ("$CMD" == "chromium/") || ("$CMD" == "cr") ]]; then
bash ./chromium/build.sh "$@"
elif [[ ("$CMD" == "winldd") ]]; then
bash ./winldd/build.sh "$@"
elif [[ ("$CMD" == "ffmpeg") ]]; then
bash ./ffmpeg/build.sh "$@"
else
echo ERROR: unknown browser to build - "$CMD"
exit 1
fi

View file

@ -0,0 +1,487 @@
#!/bin/bash
set -e
set +x
set -o pipefail
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $(basename "$0") [firefox-linux|firefox-win64|webkit-gtk|webkit-wpe|webkit-gtk-wpe|webkit-win64|webkit-mac-10.15] [-f|--force]"
echo
echo "Prepares checkout under browser folder, applies patches, builds, archives, and uploads if build is missing."
echo "Script will bail out early if the build for the browser version is already present."
echo
echo "Pass -f to upload anyway."
echo
echo "NOTE: This script is safe to run in a cronjob - it aquires a lock so that it does not run twice."
exit 0
fi
if [[ $# == 0 ]]; then
echo "missing build flavor!"
echo "try './$(basename "$0") --help' for more information"
exit 1
fi
CURRENT_ARCH="$(uname -m)"
CURRENT_HOST_OS="$(uname)"
CURRENT_HOST_OS_VERSION=""
if [[ "$CURRENT_HOST_OS" == "Darwin" ]]; then
CURRENT_HOST_OS_VERSION=$(sw_vers -productVersion | grep -o '^\d\+.\d\+')
elif [[ "$CURRENT_HOST_OS" == "Linux" ]]; then
CURRENT_HOST_OS="$(bash -c 'source /etc/os-release && echo $NAME')"
CURRENT_HOST_OS_VERSION="$(bash -c 'source /etc/os-release && echo $VERSION_ID')"
fi
BROWSER_NAME=""
BROWSER_DISPLAY_NAME=""
EXTRA_BUILD_ARGS=""
EXTRA_ARCHIVE_ARGS=""
BUILD_FLAVOR="$1"
BUILD_BLOB_NAME=""
EXPECTED_HOST_OS=""
EXPECTED_HOST_OS_VERSION=""
EXPECTED_ARCH="x86_64"
BUILDS_LIST="EXPECTED_BUILDS"
# ===========================
# WINLDD COMPILATION
# ===========================
if [[ "$BUILD_FLAVOR" == "winldd-win64" ]]; then
BROWSER_NAME="winldd"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="winldd-win64.zip"
# ===========================
# FFMPEG COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "ffmpeg-mac" ]]; then
BROWSER_NAME="ffmpeg"
EXTRA_BUILD_ARGS="--mac --full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
BUILD_BLOB_NAME="ffmpeg-mac.zip"
elif [[ "$BUILD_FLAVOR" == "ffmpeg-mac-arm64" ]]; then
BROWSER_NAME="ffmpeg"
EXTRA_BUILD_ARGS="--mac --full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="ffmpeg-mac-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "ffmpeg-linux" ]]; then
BROWSER_NAME="ffmpeg"
EXTRA_BUILD_ARGS="--linux"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="ffmpeg-linux.zip"
elif [[ "$BUILD_FLAVOR" == "ffmpeg-linux-arm64" ]]; then
BROWSER_NAME="ffmpeg"
EXTRA_BUILD_ARGS="--cross-compile-linux-arm64"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="ffmpeg-linux-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "ffmpeg-cross-compile-win64" ]]; then
BROWSER_NAME="ffmpeg"
EXTRA_BUILD_ARGS="--cross-compile-win64"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="ffmpeg-win64.zip"
# ===========================
# CHROMIUM COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "chromium-win64" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="chromium-win64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-mac" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-mac.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-mac-arm64" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--arm64 --full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-mac-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-linux" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-linux.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-linux-arm64" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--arm64 --full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="chromium-linux-arm64.zip"
# ===========================
# CHROMIUM-TIP-OF-TREE COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "chromium-tip-of-tree-win64" ]]; then
BROWSER_NAME="chromium-tip-of-tree"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="chromium-tip-of-tree-win64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-tip-of-tree-mac" ]]; then
BROWSER_NAME="chromium-tip-of-tree"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-tip-of-tree-mac.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-tip-of-tree-mac-arm64" ]]; then
BROWSER_NAME="chromium-tip-of-tree"
EXTRA_BUILD_ARGS="--arm64 --full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-tip-of-tree-mac-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-tip-of-tree-linux" ]]; then
BROWSER_NAME="chromium-tip-of-tree"
EXTRA_BUILD_ARGS="--full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-tip-of-tree-linux.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-tip-of-tree-linux-arm64" ]]; then
BROWSER_NAME="chromium-tip-of-tree"
EXTRA_BUILD_ARGS="--arm64 --full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="chromium-tip-of-tree-linux-arm64.zip"
# ===========================
# CHROMIUM-WITH-SYMBOLS COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-win64" ]]; then
BROWSER_NAME="chromium"
BROWSER_DISPLAY_NAME="chromium-with-symbols"
EXTRA_BUILD_ARGS="--symbols --full --goma"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="chromium-with-symbols-win64.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-mac" ]]; then
BROWSER_NAME="chromium"
BROWSER_DISPLAY_NAME="chromium-with-symbols"
EXTRA_BUILD_ARGS="--symbols --full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-with-symbols-mac.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-mac-arm64" ]]; then
BROWSER_NAME="chromium"
BROWSER_DISPLAY_NAME="chromium-with-symbols"
EXTRA_BUILD_ARGS="--arm64 --symbols --full --goma"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="chromium-with-symbols-mac-arm64.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-linux" ]]; then
BROWSER_NAME="chromium"
BROWSER_DISPLAY_NAME="chromium-with-symbols"
EXTRA_BUILD_ARGS="--symbols --full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-with-symbols-linux.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-linux-arm64" ]]; then
BROWSER_NAME="chromium"
BROWSER_DISPLAY_NAME="chromium-with-symbols-arm64"
EXTRA_BUILD_ARGS="--arm64 --symbols --full --goma"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="chromium-with-symbols-linux-arm64.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
# ===========================
# FIREFOX COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "firefox-ubuntu-18.04" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="firefox-ubuntu-18.04.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-ubuntu-20.04" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="firefox-ubuntu-20.04.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-ubuntu-20.04-arm64" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full --linux-arm64"
EXTRA_ARCHIVE_ARGS="--linux-arm64"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="firefox-ubuntu-20.04-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-mac-11" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="x86_64"
BUILD_BLOB_NAME="firefox-mac-11.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-mac-11-arm64" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="firefox-mac-11-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-win64" ]]; then
BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="firefox-win64.zip"
# This is the architecture that is set by mozilla-build bash.
EXPECTED_ARCH="i686"
# ===============================
# FIREFOX-BETA COMPILATION
# ===============================
elif [[ "$BUILD_FLAVOR" == "firefox-beta-ubuntu-18.04" ]]; then
BROWSER_NAME="firefox-beta"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="firefox-beta-ubuntu-18.04.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-beta-ubuntu-20.04" ]]; then
BROWSER_NAME="firefox-beta"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="firefox-beta-ubuntu-20.04.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-beta-mac-11" ]]; then
BROWSER_NAME="firefox-beta"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="x86_64"
BUILD_BLOB_NAME="firefox-beta-mac-11.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-beta-mac-11-arm64" ]]; then
BROWSER_NAME="firefox-beta"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="firefox-beta-mac-11-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "firefox-beta-win64" ]]; then
BROWSER_NAME="firefox-beta"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="firefox-beta-win64.zip"
# This is the architecture that is set by mozilla-build bash.
EXPECTED_ARCH="i686"
# ===========================
# WEBKIT COMPILATION
# ===========================
elif [[ "$BUILD_FLAVOR" == "webkit-ubuntu-18.04" ]]; then
BROWSER_NAME="webkit"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="webkit-ubuntu-18.04.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-ubuntu-20.04" ]]; then
BROWSER_NAME="webkit"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="webkit-ubuntu-20.04.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-ubuntu-20.04-arm64" ]]; then
BROWSER_NAME="webkit"
EXTRA_BUILD_ARGS="--full"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
EXPECTED_ARCH="aarch64"
BUILD_BLOB_NAME="webkit-ubuntu-20.04-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-win64" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="webkit-win64.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.15" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.15"
BUILD_BLOB_NAME="webkit-mac-10.15.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-12" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
BUILD_BLOB_NAME="webkit-mac-12.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-12-arm64" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="12.2"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="webkit-mac-12-arm64.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-11" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
BUILD_BLOB_NAME="webkit-mac-11.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-11-arm64" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="11.6"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="webkit-mac-11-arm64.zip"
# ===========================
# Unknown input
# ===========================
else
echo ERROR: unknown build flavor - "$BUILD_FLAVOR"
exit 1
fi
if [[ -z "$BROWSER_DISPLAY_NAME" ]]; then
BROWSER_DISPLAY_NAME="${BROWSER_NAME}"
fi
if [[ "$CURRENT_ARCH" != "$EXPECTED_ARCH" ]]; then
echo "ERROR: cannot build $BUILD_FLAVOR"
echo " -- expected arch: $EXPECTED_ARCH"
echo " -- current arch: $CURRENT_ARCH"
exit 1
fi
if [[ "$CURRENT_HOST_OS" != $EXPECTED_HOST_OS* ]]; then
echo "ERROR: cannot build $BUILD_FLAVOR"
echo " -- expected OS: $EXPECTED_HOST_OS"
echo " -- current OS: $CURRENT_HOST_OS"
exit 1
fi
if [[ "$CURRENT_HOST_OS_VERSION" != "$EXPECTED_HOST_OS_VERSION" ]]; then
echo "ERROR: cannot build $BUILD_FLAVOR"
echo " -- expected OS Version: $EXPECTED_HOST_OS_VERSION"
echo " -- current OS Version: $CURRENT_HOST_OS_VERSION"
exit 1
fi
if [[ $(uname) == MINGW* || "$(uname)" == MSYS* ]]; then
ZIP_PATH="$PWD/archive-$BROWSER_NAME.zip"
LOG_PATH="$PWD/log-$BROWSER_NAME.zip"
else
ZIP_PATH="/tmp/archive-$BROWSER_NAME.zip"
LOG_PATH="/tmp/log-$BROWSER_NAME.zip"
fi
if [[ -f "$ZIP_PATH" ]]; then
echo "Archive $ZIP_PATH already exists - remove and re-run the script."
exit 1
fi
trap "rm -rf ${ZIP_PATH}; rm -rf ${LOG_PATH}; cd $(pwd -P);" INT TERM EXIT
cd "$(dirname "$0")"
BUILD_NUMBER=$(head -1 ./$BROWSER_NAME/BUILD_NUMBER)
BUILD_BLOB_PATH="${BROWSER_NAME}/${BUILD_NUMBER}/${BUILD_BLOB_NAME}"
LOG_BLOB_NAME="${BUILD_BLOB_NAME%.zip}.log.gz"
LOG_BLOB_PATH="${BROWSER_NAME}/${BUILD_NUMBER}/${LOG_BLOB_NAME}"
# pull from upstream and check if a new build has to be uploaded.
if ! [[ ($2 == '-f') || ($2 == '--force') ]]; then
if ./upload.sh "${BUILD_BLOB_PATH}" --check; then
echo "Build is already uploaded - no changes."
exit 0
fi
else
echo "Force-rebuilding the build."
fi
function generate_and_upload_browser_build {
echo "-- preparing checkout"
if ! ./prepare_checkout.sh $BROWSER_NAME; then
return 20
fi
echo "-- cleaning"
if ! ./$BROWSER_NAME/clean.sh; then
return 21
fi
echo "-- building"
if ! ./$BROWSER_NAME/build.sh $EXTRA_BUILD_ARGS; then
return 22
fi
echo "-- archiving to $ZIP_PATH"
if ! ./$BROWSER_NAME/archive.sh "$ZIP_PATH" $EXTRA_ARCHIVE_ARGS; then
return 23
fi
echo "-- uploading"
if ! ./upload.sh "$BUILD_BLOB_PATH" "$ZIP_PATH"; then
return 24
fi
return 0
}
function create_roll_into_playwright_pr {
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "roll_into_pw", "client_payload": {"browser": "'"$1"'", "revision": "'"$2"'"}}' \
https://api.github.com/repos/microsoft/playwright/dispatches
}
source ./send_telegram_message.sh
BUILD_ALIAS="$BUILD_FLAVOR r$BUILD_NUMBER"
send_telegram_message "$BUILD_ALIAS -- started"
if generate_and_upload_browser_build 2>&1 | ./sanitize_and_compress_log.js $LOG_PATH; then
# Report successful build. Note: MINGW might not have `du` command.
UPLOAD_SIZE=""
if command -v du >/dev/null && command -v awk >/dev/null; then
UPLOAD_SIZE="$(du -h "$ZIP_PATH" | awk '{print $1}') "
fi
send_telegram_message "$BUILD_ALIAS -- ${UPLOAD_SIZE}uploaded"
# Check if we uploaded the last build.
(
for i in $(cat "${BROWSER_NAME}/${BUILDS_LIST}"); do
URL="https://playwright2.blob.core.windows.net/builds/${BROWSER_NAME}/${BUILD_NUMBER}/$i"
if ! [[ $(curl -s -L -I "$URL" | head -1 | cut -f2 -d' ') == 200 ]]; then
# Exit subshell
echo "Missing build at ${URL}"
exit
fi
done;
LAST_COMMIT_MESSAGE=$(git log --format=%s -n 1 HEAD -- "./${BROWSER_NAME}/BUILD_NUMBER")
CHECKMARK_CHAR=$(printf '\xe2\x9c\x85')
send_telegram_message "<b>${BROWSER_DISPLAY_NAME} r${BUILD_NUMBER} COMPLETE! ${CHECKMARK_CHAR}</b> ${LAST_COMMIT_MESSAGE}"
if [[ "${BROWSER_DISPLAY_NAME}" != "chromium-with-symbols" ]]; then
create_roll_into_playwright_pr $BROWSER_NAME $BUILD_NUMBER
fi
)
else
RESULT_CODE="$?"
if (( RESULT_CODE == 10 )); then
FAILED_STEP="./download_gtk_and_wpe_and_zip_together.sh"
elif (( RESULT_CODE == 11 )); then
FAILED_STEP="./upload.sh"
elif (( RESULT_CODE == 20 )); then
FAILED_STEP="./prepare_checkout.sh"
elif (( RESULT_CODE == 21 )); then
FAILED_STEP="./clean.sh"
elif (( RESULT_CODE == 22 )); then
FAILED_STEP="./build.sh"
elif (( RESULT_CODE == 23 )); then
FAILED_STEP="./archive.sh"
elif (( RESULT_CODE == 24 )); then
FAILED_STEP="./upload.sh"
else
FAILED_STEP="<unknown step>"
fi
# Upload logs only in case of failure and report failure.
./upload.sh "${LOG_BLOB_PATH}" ${LOG_PATH} || true
CROSS_CHAR=$(printf '\xe2\x9d\x8c')
send_telegram_message "$BUILD_ALIAS -- ${FAILED_STEP} failed! ${CROSS_CHAR} <a href='https://playwright.azureedge.net/builds/${LOG_BLOB_PATH}'>${LOG_BLOB_NAME}</a> -- <a href='$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID'>GitHub Action Logs</a>"
exit 1
fi

View file

@ -0,0 +1 @@
1006

View file

@ -0,0 +1,5 @@
chromium-tip-of-tree-mac.zip
chromium-tip-of-tree-mac-arm64.zip
chromium-tip-of-tree-linux.zip
chromium-tip-of-tree-linux-arm64.zip
chromium-tip-of-tree-win64.zip

View file

@ -0,0 +1,3 @@
# CURRENT_VERSION: 103.0.5058.0
# BRANCH_BASE_POSITION: 1002404
BRANCH_COMMIT="244f27c663d55c021c4e9d5aeb1d64cda64e9e31"

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
bash "../chromium/archive.sh" "$@"

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
bash "../chromium/build.sh" "$@"

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
bash "../chromium/clean.sh" "$@"

View file

@ -0,0 +1,32 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
# 1. get current version
CURRENT_BETA_VERSION=$(curl https://omahaproxy.appspot.com/all | grep "win64,canary," | cut -d ',' -f 3)
VERSION_INFO_JSON=$(curl "https://omahaproxy.appspot.com/deps.json?version=$CURRENT_BETA_VERSION")
NODE_SCRIPT=$(cat <<EOF
const json = JSON.parse(fs.readFileSync(0));
console.log([
'# CURRENT_VERSION: ' + json.chromium_version,
'# BRANCH_BASE_POSITION: ' + json.chromium_base_position,
'BRANCH_COMMIT="' + json.chromium_base_commit + '"',
].join('\n'));
EOF
)
NEW_CONFIG=$(echo "${VERSION_INFO_JSON}" | node -e "${NODE_SCRIPT}")
CURRENT_CONFIG=$(cat "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh")
if [[ "${CURRENT_CONFIG}" == "${NEW_CONFIG}" ]]; then
echo "No changes!"
exit 0
fi
echo "${NEW_CONFIG}" > "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh"
BUILD_NUMBER=$(cat "${SCRIPT_FOLDER}/BUILD_NUMBER")
echo $(( $BUILD_NUMBER + 1 )) > "${SCRIPT_FOLDER}/BUILD_NUMBER"

3
browser_patches/chromium/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/output
/depot_tools
/electron-build-tools

View file

@ -0,0 +1 @@
1005

View file

@ -0,0 +1,5 @@
chromium-mac.zip
chromium-mac-arm64.zip
chromium-linux.zip
chromium-linux-arm64.zip
chromium-win64.zip

View file

@ -0,0 +1,5 @@
chromium-with-symbols-mac.zip
chromium-with-symbols-mac-arm64.zip
chromium-with-symbols-linux.zip
chromium-with-symbols-linux-arm64.zip
chromium-with-symbols-win64.zip

View file

@ -0,0 +1,3 @@
# CURRENT_VERSION: 102.0.5005.40
# BRANCH_BASE_POSITION: 992738
BRANCH_COMMIT="295fa238620132220a9f28eef197611ec492a68d"

View file

@ -0,0 +1,92 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_PATH=$(pwd -P)
source "${SCRIPT_PATH}/../utils.sh"
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./output folder that was previously downloaded."
echo
exit 0
fi
ZIP_PATH=$1
if [[ $ZIP_PATH != /* ]]; then
echo "ERROR: path $ZIP_PATH is not absolute"
exit 1
fi
if [[ $ZIP_PATH != *.zip ]]; then
echo "ERROR: path $ZIP_PATH must have .zip extension"
exit 1
fi
if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
CR_CHECKOUT_PATH="$HOME/chromium"
fi
if [[ ! -d "${CR_CHECKOUT_PATH}/src" ]]; then
echo "ERROR: CR_CHECKOUT_PATH does not have src/ subfolder; is this a chromium checkout?"
exit 1
fi
CHROMIUM_FOLDER_NAME=""
CHROMIUM_FILES_TO_ARCHIVE=()
if is_mac; then
CHROMIUM_FOLDER_NAME="chrome-mac"
IFS=$'\n' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/mac-archive-rel.json"))
unset IFS
elif is_linux; then
CHROMIUM_FOLDER_NAME="chrome-linux"
IFS=$'\n' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/linux-archive-rel.json"))
unset IFS
elif is_win; then
CHROMIUM_FOLDER_NAME="chrome-win"
IFS=$'\n\r' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/win-archive-rel.json"))
unset IFS
else
echo "ERROR: unsupported platform - $(uname)"
exit 1
fi
# Prepare resulting archive.
cd "$SCRIPT_PATH"
rm -rf output
mkdir -p "output/${CHROMIUM_FOLDER_NAME}"
# On Mac, use 'ditto' to copy directories instead of 'cp'.
COPY_COMMAND="cp -R"
if is_mac; then
COPY_COMMAND="ditto"
fi
for ((i = 0; i < ${#CHROMIUM_FILES_TO_ARCHIVE[@]}; i++)) do
file="${CHROMIUM_FILES_TO_ARCHIVE[$i]}"
mkdir -p "output/${CHROMIUM_FOLDER_NAME}/$(dirname "${file}")"
$COPY_COMMAND "${CR_CHECKOUT_PATH}/src/out/Default/${file}" "output/${CHROMIUM_FOLDER_NAME}/${file}"
done
if is_win; then
$COPY_COMMAND "${CR_CHECKOUT_PATH}/src/out/Default/"*.manifest "output/${CHROMIUM_FOLDER_NAME}/"
mkdir -p "output/${CHROMIUM_FOLDER_NAME}/locales"
$COPY_COMMAND "${CR_CHECKOUT_PATH}/src/out/Default/locales/"*.pak "output/${CHROMIUM_FOLDER_NAME}/locales/"
fi
cd output
zip --symlinks -r build.zip "${CHROMIUM_FOLDER_NAME}"
cd "${SCRIPT_PATH}"
cp output/build.zip "$ZIP_PATH"

130
browser_patches/chromium/build.sh Executable file
View file

@ -0,0 +1,130 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
source "${SCRIPT_FOLDER}/../utils.sh"
USAGE=$(cat<<EOF
usage: $(basename "$0") [--arm64] [--symbols] [--full] [--goma] <custom targets to compile>
--arm64 cross-compile for arm64
--symbols compile with symbols
--full install build dependencies
--goma use goma when compiling. Make sure to pre-start goma client beforehand with './goma.sh start'.
On Linux & MacOS, it is possible to specify custom compilation targets:
./build.sh --goma blink_tests
EOF
)
source "${SCRIPT_FOLDER}/../utils.sh"
if [[ $1 == "--help" || $1 == "-h" ]]; then
echo "$USAGE"
exit 0
fi
args=("$@")
IS_ARM64=""
IS_SYMBOLS_BUILD=""
IS_FULL=""
USE_GOMA=""
for ((i="${#args[@]}"-1; i >= 0; --i)); do
case ${args[i]} in
--arm64) IS_ARM64="1"; unset args[i]; ;;
--symbols) IS_SYMBOLS_BUILD="1"; unset args[i]; ;;
--full) IS_FULL="1"; unset args[i]; ;;
--goma) USE_GOMA="1"; unset args[i]; ;;
esac
done
compile_chromium() {
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
CR_CHECKOUT_PATH="$HOME/chromium"
fi
if [[ ! -d "${CR_CHECKOUT_PATH}/src" ]]; then
echo "ERROR: CR_CHECKOUT_PATH does not have src/ subfolder; is this a chromium checkout?"
exit 1
fi
source "${SCRIPT_FOLDER}/ensure_depot_tools.sh"
if is_mac; then
selectXcodeVersionOrDie $(node "${SCRIPT_FOLDER}/../get_xcode_version.js" chromium)
fi
cd "${CR_CHECKOUT_PATH}/src"
# Prepare build folder.
mkdir -p "./out/Default"
echo "is_debug = false" > ./out/Default/args.gn
echo "dcheck_always_on = false" >> ./out/Default/args.gn
if [[ -n "${IS_SYMBOLS_BUILD}" ]]; then
echo "symbol_level = 1" >> ./out/Default/args.gn
else
echo "symbol_level = 0" >> ./out/Default/args.gn
fi
if [[ -n "${IS_ARM64}" ]]; then
echo 'target_cpu = "arm64"' >> ./out/Default/args.gn
fi
if [[ ! -z "$USE_GOMA" ]]; then
"${SCRIPT_FOLDER}/goma.sh" args >> ./out/Default/args.gn
fi
echo 'enable_nacl = false' >> ./out/Default/args.gn
echo "===== args.gn ====="
cat ./out/Default/args.gn
echo "===== ======= ====="
if [[ -n "$IS_FULL" ]]; then
if is_linux; then
./build/install-build-deps.sh
if [[ -n "$IS_ARM64" ]]; then
# Install sysroot image, see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/linux/chromium_arm.md
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
fi
fi
fi
TARGETS="${args[@]}"
if is_win; then
if [[ -n "$TARGETS" ]]; then
echo "ERROR: cannot compile custom targets on windows yet."
echo "Requested to compile chromium targets - ${TARGETS}"
exit 1
fi
if [[ -z "$USE_GOMA" ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"
else
/c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwingoma.bat)"
fi
else
if [[ -z "$TARGETS" ]]; then
if is_linux; then
TARGETS="chrome chrome_sandbox clear_key_cdm"
else
TARGETS="chrome"
fi
fi
echo
echo ">> Compiling Targets: $TARGETS"
echo
gn gen out/Default
if [[ -z "$USE_GOMA" ]]; then
autoninja -C out/Default $TARGETS
else
ninja -j 200 -C out/Default $TARGETS
fi
fi
}
compile_chromium "${args[@]}"

View file

@ -0,0 +1,2 @@
CALL gn gen out/Default
CALL autoninja -C out/Default chrome eventlog_provider

View file

@ -0,0 +1,2 @@
CALL gn gen out/Default
CALL ninja -j 200 -C out/Default chrome eventlog_provider

View file

@ -0,0 +1,15 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
rm -rf output
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
CR_CHECKOUT_PATH="$HOME/chromium"
fi
if [[ -d "${CR_CHECKOUT_PATH}/src" ]]; then
rm -rf "${CR_CHECKOUT_PATH}/src/out"
fi

View file

@ -0,0 +1,26 @@
// This script is supposed to be run with a path to either of the following configs from chromium checkout:
// - infra/archive_config/mac-archive-rel.json
// - infra/archive_config/linux-archive-rel.json
// - infra/archive_config/win-archive-rel.json
const fs = require('fs');
const configs = JSON.parse(fs.readFileSync(process.argv[2], 'utf8')).archive_datas;
const config = configs.find(config => config.gcs_path.includes('chrome-linux.zip') || config.gcs_path.includes('chrome-win.zip') || config.gcs_path.includes('chrome-mac.zip'));
const excludeList = new Set([
// We do not need interactive tests in our archive.
'interactive_ui_tests.exe',
// We no longer compile nacl with Chromium.
'nacl_helper_bootstrap',
'nacl_helper',
'nacl_irt_x86_64.nexe',
]);
const entries = [
...(config.files || []),
...(config.dirs || []),
].filter(entry => !excludeList.has(entry));
for (const entry of entries)
console.log(entry);

View file

@ -0,0 +1,32 @@
# Since this script modifies PATH, it cannot be run in a subshell
# and must be sourced.
# Make sure it is sourced.
sourced=0
(return 0 2>/dev/null) && sourced=1 || sourced=0
if [[ $sourced == 0 ]]; then
echo 'ERROR: cannot run this script in a subshell'
echo 'This file modifies $PATH of the current shell, so it must be sourced instead'
echo 'Use `source ensure_depot_tool.sh` instead'
exit 1
fi
function ensure_depot_tools() {
# Install depot_tools if they are not in system, and modify $PATH
# to include depot_tools
if ! command -v autoninja >/dev/null; then
if [[ $(uname) == "MINGW"* || "$(uname)" == MSYS* ]]; then
# NOTE: as of Feb 8, 2021, windows requires manual and separate
# installation of depot_tools.
echo "ERROR: cannot automatically install depot_tools on windows. Please, install manually"
exit 1
fi
local SCRIPT_PATH=$(cd "$(dirname "$BASH_SOURCE")"; pwd -P)
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
fi
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
fi
}
ensure_depot_tools

105
browser_patches/chromium/goma.sh Executable file
View file

@ -0,0 +1,105 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
source "${SCRIPT_FOLDER}/../utils.sh"
ELECTRON_BUILD_TOOLS_REQUIRED_VERSION=2c24fb5c7c938a4e387f355ab64be449604ae5db
if [[ -d ./electron-build-tools ]]; then
cd ./electron-build-tools
# Make sure required commit is part of electron-build-tools.
if ! git merge-base --is-ancestor "${ELECTRON_BUILD_TOOLS_REQUIRED_VERSION}" HEAD; then
cd ..
rm -rf ./electron-build-tools
echo "Updating electron-build-tools"
else
cd ..
fi
fi
if [[ ! -d ./electron-build-tools ]]; then
git clone --single-branch --branch main https://github.com/electron/build-tools/ electron-build-tools
cd electron-build-tools
npm install
mkdir -p third_party
./src/e update-goma msftGoma
cd ..
fi
if ! is_win; then
if command -v python >/dev/null; then
PYTHON=python
elif command -v python3 >/dev/null; then
PYTHON=python3
else
echo "ERROR: no python or python3 found in PATH"
exit 1
fi
fi
cd electron-build-tools/third_party/goma
export GOMA_START_COMPILER_PROXY=true
function print_gn_args() {
PLAYWRIGHT_GOMA_PATH="${SCRIPT_FOLDER}/electron-build-tools/third_party/goma"
if is_win; then
PLAYWRIGHT_GOMA_PATH=$(cygpath -w "${PLAYWRIGHT_GOMA_PATH}")
fi
echo 'use_goma = true'
echo "goma_dir = \"${PLAYWRIGHT_GOMA_PATH}\""
}
if [[ $1 == "--help" ]]; then
echo "$(basename "$0") [login|start|stop|--help]"
exit 0
elif [[ $1 == "args" ]]; then
print_gn_args
elif [[ $1 == "login" ]]; then
if is_win; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_auth.bat) login"
else
$PYTHON ./goma_auth.py login
fi
echo
echo "Congratulation! Goma is logged in!"
echo "run '$(basename "$0") start' to launch goma client"
elif [[ $1 == "start" ]]; then
# We have to prefix ENV with `PLAYWRIGHT` since `GOMA_` env variables
# have special treatment by goma.
if [[ ! -z "$PLAYWRIGHT_GOMA_LOGIN_COOKIE" ]]; then
echo "$PLAYWRIGHT_GOMA_LOGIN_COOKIE" > "$HOME/.goma_oauth2_config"
fi
if [[ ! -f "$HOME/.goma_oauth2_config" ]]; then
echo "ERROR: goma is not logged in!"
echo "run '$(basename "$0") login'"
exit 1
fi
if is_win; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_ctl.bat) ensure_start"
else
$PYTHON ./goma_ctl.py ensure_start
fi
set +x
echo
echo "Congratulatons! Goma is running!"
echo
echo "Add the following gn args to use goma:"
echo
echo "===== args.gn ====="
print_gn_args
echo "===== ======= ====="
elif [[ $1 == "stop" ]]; then
if is_win; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_ctl.bat) stop"
else
$PYTHON ./goma_ctl.py stop
fi
else
echo "ERROR: unknown command - $1"
echo "Use --help to list all available commands"
exit 1
fi

View file

@ -0,0 +1,32 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER=$(pwd -P)
# 1. get current version
CURRENT_BETA_VERSION=$(curl https://omahaproxy.appspot.com/all | grep "win64,beta" | cut -d ',' -f 3)
VERSION_INFO_JSON=$(curl "https://omahaproxy.appspot.com/deps.json?version=$CURRENT_BETA_VERSION")
NODE_SCRIPT=$(cat <<EOF
const json = JSON.parse(fs.readFileSync(0));
console.log([
'# CURRENT_VERSION: ' + json.chromium_version,
'# BRANCH_BASE_POSITION: ' + json.chromium_base_position,
'BRANCH_COMMIT="' + json.chromium_commit + '"',
].join('\n'));
EOF
)
NEW_CONFIG=$(echo "${VERSION_INFO_JSON}" | node -e "${NODE_SCRIPT}")
CURRENT_CONFIG=$(cat "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh")
if [[ "${CURRENT_CONFIG}" == "${NEW_CONFIG}" ]]; then
echo "No changes!"
exit 0
fi
echo "${NEW_CONFIG}" > "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh"
BUILD_NUMBER=$(cat "${SCRIPT_FOLDER}/BUILD_NUMBER")
echo $(( $BUILD_NUMBER + 1 )) > "${SCRIPT_FOLDER}/BUILD_NUMBER"

39
browser_patches/clean.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: clean.sh [firefox|webkit|firefox-beta]"
echo
exit 0
fi
if [[ $# == 0 ]]; then
echo "missing browser: 'firefox' or 'webkit'"
echo "try './clean.sh --help' for more information"
exit 1
fi
CMD="$1"
shift
if [[ ("$CMD" == "firefox") || ("$CMD" == "firefox/") || ("$CMD" == "ff") ]]; then
bash ./firefox/clean.sh "$@"
elif [[ ("$CMD" == "firefox-beta") || ("$CMD" == "ff-beta") ]]; then
bash ./firefox-beta/clean.sh "$@"
elif [[ ("$CMD" == "webkit") || ("$CMD" == "webkit/") || ("$CMD" == "wk") ]]; then
bash ./webkit/clean.sh "$@"
elif [[ ("$CMD" == "chromium") || ("$CMD" == "chromium/") || ("$CMD" == "cr") ]]; then
bash ./chromium/clean.sh "$@"
elif [[ ("$CMD" == "winldd") ]]; then
bash ./winldd/clean.sh "$@"
elif [[ ("$CMD" == "ffmpeg") ]]; then
bash ./ffmpeg/clean.sh "$@"
else
echo ERROR: unknown browser to build - "$CMD"
exit 1
fi

177
browser_patches/export.sh Executable file
View file

@ -0,0 +1,177 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
REMOTE_BROWSER_UPSTREAM="browser_upstream"
BUILD_BRANCH="playwright-build"
# COLORS
RED=$'\e[1;31m'
GRN=$'\e[1;32m'
YEL=$'\e[1;33m'
END=$'\e[0m'
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: export.sh [firefox|webkit] [custom_checkout_path]"
echo
echo "Exports patch from the current branch of the checkout to browser folder."
echo "The checkout has to be 'prepared', meaning that 'prepare_checkout.sh' should be"
echo "run against it first."
echo
echo "You can optionally specify custom_checkout_path if you have browser checkout somewhere else"
echo "and wish to export patches from it."
echo
exit 0
fi
if [[ $# == 0 ]]; then
echo "missing browser: 'firefox' or 'webkit'"
echo "try './export.sh --help' for more information"
exit 1
fi
# FRIENDLY_CHECKOUT_PATH is used only for logging.
FRIENDLY_CHECKOUT_PATH="";
BUILD_NUMBER_UPSTREAM_URL=""
CHECKOUT_PATH=""
EXPORT_PATH=""
EXTRA_FOLDER_PW_PATH=""
EXTRA_FOLDER_CHECKOUT_RELPATH=""
if [[ ("$1" == "firefox") || ("$1" == "firefox/") || ("$1" == "ff") ]]; then
if [[ -z "${FF_CHECKOUT_PATH}" ]]; then
FRIENDLY_CHECKOUT_PATH='$HOME/firefox';
CHECKOUT_PATH="$HOME/firefox"
else
echo "WARNING: using checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"
CHECKOUT_PATH="${FF_CHECKOUT_PATH}"
FRIENDLY_CHECKOUT_PATH="<FF_CHECKOUT_PATH>"
fi
EXTRA_FOLDER_PW_PATH="$PWD/firefox/juggler"
EXTRA_FOLDER_CHECKOUT_RELPATH="juggler"
EXPORT_PATH="$PWD/firefox"
BUILD_NUMBER_UPSTREAM_URL="https://raw.githubusercontent.com/microsoft/playwright/master/browser_patches/firefox/BUILD_NUMBER"
source "./firefox/UPSTREAM_CONFIG.sh"
elif [[ ("$1" == "firefox-beta") || ("$1" == "ff-beta") ]]; then
if [[ -z "${FF_CHECKOUT_PATH}" ]]; then
FRIENDLY_CHECKOUT_PATH='$HOME/firefox';
CHECKOUT_PATH="$HOME/firefox"
else
echo "WARNING: using checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"
CHECKOUT_PATH="${FF_CHECKOUT_PATH}"
FRIENDLY_CHECKOUT_PATH="<FF_CHECKOUT_PATH>"
fi
EXTRA_FOLDER_PW_PATH="$PWD/firefox-beta/juggler"
EXTRA_FOLDER_CHECKOUT_RELPATH="juggler"
EXPORT_PATH="$PWD/firefox-beta"
BUILD_NUMBER_UPSTREAM_URL="https://raw.githubusercontent.com/microsoft/playwright/master/browser_patches/firefox-beta/BUILD_NUMBER"
source "./firefox-beta/UPSTREAM_CONFIG.sh"
elif [[ ("$1" == "webkit") || ("$1" == "webkit/") || ("$1" == "wk") ]]; then
if [[ -z "${WK_CHECKOUT_PATH}" ]]; then
FRIENDLY_CHECKOUT_PATH='$HOME/webkit';
CHECKOUT_PATH="$HOME/webkit"
else
echo "WARNING: using checkout path from WK_CHECKOUT_PATH env: ${WK_CHECKOUT_PATH}"
CHECKOUT_PATH="${WK_CHECKOUT_PATH}"
FRIENDLY_CHECKOUT_PATH="<WK_CHECKOUT_PATH>"
fi
EXTRA_FOLDER_PW_PATH="$PWD/webkit/embedder/Playwright"
EXTRA_FOLDER_CHECKOUT_RELPATH="Tools/Playwright"
EXPORT_PATH="$PWD/webkit"
BUILD_NUMBER_UPSTREAM_URL="https://raw.githubusercontent.com/microsoft/playwright/master/browser_patches/webkit/BUILD_NUMBER"
source "./webkit/UPSTREAM_CONFIG.sh"
else
echo ERROR: unknown browser to export - "$1"
exit 1
fi
# we will use this just for beauty.
if [[ $# == 2 ]]; then
echo "WARNING: using custom checkout path $2"
CHECKOUT_PATH=$2
FRIENDLY_CHECKOUT_PATH="<custom_checkout ( $2 )>"
fi
# if there's no checkout folder - bail out.
if ! [[ -d $CHECKOUT_PATH ]]; then
echo "ERROR: $FRIENDLY_CHECKOUT_PATH is missing - nothing to export."
exit 1;
else
echo "-- checking $FRIENDLY_CHECKOUT_PATH exists - OK"
fi
# if folder exists but not a git repository - bail out.
if ! [[ -d $CHECKOUT_PATH/.git ]]; then
echo "ERROR: $FRIENDLY_CHECKOUT_PATH is not a git repository! Nothing to export."
exit 1
else
echo "-- checking $FRIENDLY_CHECKOUT_PATH is a git repo - OK"
fi
# Switch to git repository.
cd "$CHECKOUT_PATH"
# Setting up |$REMOTE_BROWSER_UPSTREAM| remote and fetch the $BASE_BRANCH
if git remote get-url $REMOTE_BROWSER_UPSTREAM >/dev/null; then
if ! [[ $(git config --get remote.$REMOTE_BROWSER_UPSTREAM.url || echo "") == "$REMOTE_URL" ]]; then
echo "ERROR: remote $REMOTE_BROWSER_UPSTREAM is not pointing to '$REMOTE_URL'! run 'prepare_checkout.sh' first"
exit 1
fi
else
echo "ERROR: checkout does not have $REMOTE_BROWSER_UPSTREAM; run 'prepare_checkout.sh' first"
exit 1
fi
# Check if git repo is dirty.
if [[ -n $(git status -s --untracked-files=no) ]]; then
echo "ERROR: $FRIENDLY_CHECKOUT_PATH has dirty GIT state - aborting export."
exit 1
else
echo "-- checking $FRIENDLY_CHECKOUT_PATH is clean - OK"
fi
PATCH_NAME=$(ls -1 "$EXPORT_PATH"/patches)
if [[ -z "$PATCH_NAME" ]]; then
PATCH_NAME="bootstrap.diff"
OLD_DIFF=""
else
OLD_DIFF=$(cat "$EXPORT_PATH"/patches/$PATCH_NAME)
fi
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
NEW_BASE_REVISION=$(git merge-base $REMOTE_BROWSER_UPSTREAM/"$BASE_BRANCH" "$CURRENT_BRANCH")
NEW_DIFF=$(git diff --diff-algorithm=myers --full-index "$NEW_BASE_REVISION" "$CURRENT_BRANCH" -- . ":!${EXTRA_FOLDER_CHECKOUT_RELPATH}")
# Increment BUILD_NUMBER
BUILD_NUMBER=$(curl ${BUILD_NUMBER_UPSTREAM_URL} | head -1)
BUILD_NUMBER=$((BUILD_NUMBER+1))
echo "REMOTE_URL=\"$REMOTE_URL\"
BASE_BRANCH=\"$BASE_BRANCH\"
BASE_REVISION=\"$NEW_BASE_REVISION\"" > "$EXPORT_PATH"/UPSTREAM_CONFIG.sh
echo "$NEW_DIFF" > "$EXPORT_PATH"/patches/$PATCH_NAME
echo $BUILD_NUMBER > "$EXPORT_PATH"/BUILD_NUMBER
echo "Changed: $(git config user.email) $(date)" >> "$EXPORT_PATH"/BUILD_NUMBER
echo "-- exporting standalone folder"
rm -rf "${EXTRA_FOLDER_PW_PATH}"
mkdir -p $(dirname "${EXTRA_FOLDER_PW_PATH}")
cp -r "${EXTRA_FOLDER_CHECKOUT_RELPATH}" "${EXTRA_FOLDER_PW_PATH}"
NEW_BASE_REVISION_TEXT="$NEW_BASE_REVISION (not changed)"
if [[ "$NEW_BASE_REVISION" != "$BASE_REVISION" ]]; then
NEW_BASE_REVISION_TEXT="$YEL$NEW_BASE_REVISION (changed)$END"
fi
echo "=============================================================="
echo " Repository: $FRIENDLY_CHECKOUT_PATH"
echo " Changes between branches: $REMOTE_BROWSER_UPSTREAM/$BASE_BRANCH..$CURRENT_BRANCH"
echo " BASE_REVISION: $NEW_BASE_REVISION_TEXT"
echo " BUILD_NUMBER: $YEL$BUILD_NUMBER (changed)$END"
echo "=============================================================="
echo

2
browser_patches/ffmpeg/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build/
output/

View file

@ -0,0 +1 @@
1007

View file

@ -0,0 +1,53 @@
# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the 'License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ZLIB_VERSION="v1.2.11"
ZLIB_CONFIG="--static"
LIBVPX_VERSION="v1.9.0"
LIBVPX_CONFIG="--enable-static \
--disable-shared \
--disable-docs \
--disable-tools \
--disable-unit-tests \
--disable-examples"
FFMPEG_VERSION="n4.3.1"
FFMPEG_CONFIG="--extra-version=playwright-build-$(cat ./BUILD_NUMBER | head -1) \
--disable-debug \
--disable-autodetect \
--disable-everything \
--enable-ffmpeg \
--enable-protocol=pipe \
--enable-protocol=file \
--enable-parser=mjpeg \
--enable-decoder=mjpeg \
--enable-demuxer=image2pipe \
--enable-filter=pad \
--enable-filter=crop \
--enable-filter=scale \
--enable-muxer=webm \
--enable-libvpx \
--enable-static \
--enable-encoder=libvpx_vp8 \
--enable-decoder=libvpx_vp8 \
--enable-demuxer=matroska \
--enable-encoder=png \
--enable-zlib \
--enable-muxer=image2 \
--disable-pthreads \
--disable-iconv \
--disable-w32threads \
--disable-bzlib"

View file

@ -0,0 +1,6 @@
ffmpeg-mac.zip
ffmpeg-mac-arm64.zip
ffmpeg-linux.zip
ffmpeg-linux-arm64.zip
ffmpeg-win64.zip

View file

@ -0,0 +1,57 @@
# Playwright and FFMPEG
Playwright requires FFMPEG to produce screncast and bundles FFMPEG binaries for Mac , Linux and Windows.
## Configuration
We compile `libvpx` and `ffmpeg` only. Their source versions and build
configurations are defined in [`//browser_patches/ffmpeg/CONFIG.sh`](./CONFIG.sh).
## Building `ffmpeg-linux`
Compilation scripts are based on:
- https://trac.ffmpeg.org/wiki/CompilationGuide/Generic
Prerequisites:
- Mac or Linux
- Docker
Building:
```
~/playwright$ ./browser_patches/ffmpeg/build.sh --linux
```
## Building `ffmpeg-mac`
Compilation scripts are based on:
- https://trac.ffmpeg.org/wiki/CompilationGuide/Generic
- https://trac.ffmpeg.org/wiki/CompilationGuide/macOS
Prerequisites:
- Mac
- xcode command line tools: `xcode-select --install`
- [homebrew](https://brew.sh/)
Building:
```
~/playwright$ ./browser_patches/ffmpeg/build.sh --mac
```
## Building `ffmpeg-win*`
Cross-compilation scripts are based on:
- https://trac.ffmpeg.org/wiki/CompilationGuide/Generic
- https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows
Prerequisites:
- Mac or Linux
- [Docker](https://www.docker.com/)
Building:
```
~/playwright$ ./browser_patches/ffmpeg/build.sh --cross-compile-win64
```

View file

@ -0,0 +1,34 @@
#!/bin/bash
set -e
set +x
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "usage: $(basename $0) [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./output folder that was previously built."
echo
exit 0
fi
ZIP_PATH=$1
if [[ $ZIP_PATH != /* ]]; then
echo "ERROR: path $ZIP_PATH is not absolute"
exit 1
fi
if [[ $ZIP_PATH != *.zip ]]; then
echo "ERROR: path $ZIP_PATH must have .zip extension"
exit 1
fi
if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
if ! [[ -d $(dirname $ZIP_PATH) ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
cp output/ffmpeg.zip $ZIP_PATH

View file

@ -0,0 +1,93 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the 'License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
function die() { echo "$@"; exit 1; }
PREFIX="${HOME}/prefix"
if [[ "$(uname)" != "Linux" ]]; then
echo "ERROR: this script is designed to be run on Linux. Can't run on $(uname)"
exit 1
fi
output_path="$1"
if [[ -z "${output_path}" ]]; then
die "ERROR: output path is not specified"
elif [[ "${output_path}" != /* ]]; then
die "ERROR: output path ${output_path} is not absolute"
elif ! [[ -d $(dirname "${output_path}") ]]; then
die "ERROR: folder for output path ${output_path} does not exist."
fi
function build_zlib {
cd "${HOME}"
git clone https://github.com/madler/zlib
cd zlib
git checkout "${ZLIB_VERSION}"
./configure --prefix="${PREFIX}" ${ZLIB_CONFIG}
make && make install
}
function build_libvpx {
cd "${HOME}"
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout "${LIBVPX_VERSION}"
# Cross-compiling libvpx according to the docs:
# - https://chromium.googlesource.com/webm/libvpx/+/main/README
./configure --prefix="${PREFIX}" ${LIBVPX_CONFIG}
make && make install
}
function build_ffmpeg {
cd "${HOME}"
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout "${FFMPEG_VERSION}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
# Prohibit pkg-config from using linux system installed libs.
export PKG_CONFIG_LIBDIR=
./configure --pkg-config=pkg-config \
--pkg-config-flags="--static" \
--extra-cflags="-I/${PREFIX}/include" \
--extra-ldflags="-L/${PREFIX}/lib -static" \
--prefix="${PREFIX}" \
--bindir="${PWD}/bin" \
${FFMPEG_CONFIG}
make && make install
}
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
source ./CONFIG.sh
apt-get update
apt-get install -y git make yasm pkg-config
build_zlib
build_libvpx
build_ffmpeg
# put resulting executable where we were asked to
cp "${HOME}/ffmpeg/bin/ffmpeg" "${output_path}"
strip "${output_path}"

View file

@ -0,0 +1,106 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the 'License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
function die() { echo "$@"; exit 1; }
if [[ "$(uname)" != "Darwin" ]]; then
die "ERROR: this script is designed to be run on OSX. Can't run on $(uname)"
fi
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
SCRIPT_FOLDER="$(pwd -P)"
source "${SCRIPT_FOLDER}/../utils.sh"
selectXcodeVersionOrDie $(node "${SCRIPT_FOLDER}/../get_xcode_version.js" ffmpeg)
source ./CONFIG.sh
BUILDDIR="${PWD}/build"
PREFIX="${BUILDDIR}/osx_prefix"
OUTPUT_PATH="${PWD}/output/ffmpeg-mac"
function build_zlib {
cd "${BUILDDIR}"
git clone https://github.com/madler/zlib
cd zlib
git checkout "${ZLIB_VERSION}"
./configure --prefix="${PREFIX}" ${ZLIB_CONFIG}
make && make install
}
function build_libvpx {
cd "${BUILDDIR}"
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout "${LIBVPX_VERSION}"
# Compile libvpx according to the docs:
# - https://chromium.googlesource.com/webm/libvpx/+/main/README
./configure --prefix="${PREFIX}" ${LIBVPX_CONFIG}
make && make install
}
function build_ffmpeg {
cd "${BUILDDIR}"
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout "${FFMPEG_VERSION}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
# Prohibit pkg-config from using system installed libs.
export PKG_CONFIG_LIBDIR=
./configure --pkg-config=pkg-config \
--pkg-config-flags="--static" \
--extra-cflags="-I/${PREFIX}/include" \
--extra-ldflags="-L/${PREFIX}/lib" \
--prefix="${PREFIX}" \
--bindir="${PWD}/bin" \
${FFMPEG_CONFIG}
make && make install
}
REQUIERED_BUILD_TOOLS=("git" "make" "yasm" "pkg-config")
missing_build_tools=()
for dependency in ${REQUIERED_BUILD_TOOLS[@]}; do
if ! command -v "${dependency}" >/dev/null; then
missing_build_tools+=("${dependency}")
fi
done
if [[ ${#missing_build_tools[@]} != 0 ]]; then
if [[ "$1" == "--full" ]]; then
brew install ${missing_build_tools[@]}
else
die "ERROR: missing dependencies! Please run: brew install ${missing_build_tools[@]}"
fi
fi
# Cleanup
set -x
rm -rf "${BUILDDIR}"
mkdir -p "${BUILDDIR}"
build_zlib
build_libvpx
build_ffmpeg
# put resulting executable where we were asked to
mkdir -p $(dirname "${OUTPUT_PATH}")
cp "${BUILDDIR}/ffmpeg/bin/ffmpeg" "${OUTPUT_PATH}"
strip "${OUTPUT_PATH}"

78
browser_patches/ffmpeg/build.sh Executable file
View file

@ -0,0 +1,78 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the 'License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "usage: $(basename $0) [--mac|--linux|--cross-compile-win64] [--full]"
echo
echo "Build ffmpeg for the given platform"
echo
exit 0
fi
if [[ -z "$1" ]]; then
echo "ERROR: expected build target. Run with --help for more info"
exit 1
fi
LICENSE_FILE="COPYING.LGPLv2.1"
rm -rf ./output
mkdir -p output
cp ffmpeg-license/"${LICENSE_FILE}" output
dockerflags="";
# Use |-it| to run docker to support Ctrl-C if we run the script inside interactive terminal.
# Otherwise (e.g. cronjob) - do nothing.
if [[ -t 0 ]]; then
dockerflags="-it"
fi
function ensure_docker_or_die() {
if ! command -v docker >/dev/null; then
echo "ERROR: docker is required for the script"
exit 1
fi
}
if [[ "$1" == "--mac" ]]; then
bash ./build-mac.sh $2
cd output && zip ffmpeg.zip ffmpeg-mac "${LICENSE_FILE}"
elif [[ "$1" == "--linux" ]]; then
ensure_docker_or_die
time docker run --init --rm -v"${PWD}":/host ${dockerflags} ubuntu:18.04 bash /host/build-linux.sh /host/output/ffmpeg-linux
cd output && zip ffmpeg.zip ffmpeg-linux "${LICENSE_FILE}"
elif [[ "$1" == --cross-compile-win64 ]]; then
ensure_docker_or_die
time docker run --init --rm -v"${PWD}":/host ${dockerflags} ubuntu:18.04 bash /host/crosscompile-from-linux.sh --win64 /host/output/ffmpeg-win64.exe
cd output && zip ffmpeg.zip ffmpeg-win64.exe "${LICENSE_FILE}"
elif [[ "$1" == "--cross-compile-linux-arm64" ]]; then
ensure_docker_or_die
time docker run --init --rm -v"${PWD}":/host ${dockerflags} ubuntu:18.04 bash /host/crosscompile-from-linux.sh --linux-arm64 /host/output/ffmpeg-linux
cd output && zip ffmpeg.zip ffmpeg-linux "${LICENSE_FILE}"
else
echo "ERROR: unsupported platform - $1"
exit 1
fi

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
rm -rf output

Some files were not shown because too many files have changed in this diff Show more