Compare commits
18 commits
main
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4743420999 | ||
|
|
c41012b055 | ||
|
|
ed619b6fcb | ||
|
|
abf9df39cf | ||
|
|
35d8604f8d | ||
|
|
6cc43d81c5 | ||
|
|
2a577a5caf | ||
|
|
ed919f3dda | ||
|
|
476b74f7c4 | ||
|
|
0861364c28 | ||
|
|
9271ba9495 | ||
|
|
da997ee8c0 | ||
|
|
94b6fe1bdb | ||
|
|
55cf8eae25 | ||
|
|
a0a099fe4a | ||
|
|
cd8b12c0d5 | ||
|
|
9981f1418a | ||
|
|
5f78f27a7a |
11
.devcontainer/devcontainer.json
Normal file
11
.devcontainer/devcontainer.json
Normal 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
19
.eslintignore
Normal 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/
|
||||||
126
.eslintrc.js
Normal file
126
.eslintrc.js
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
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}],
|
||||||
|
"no-proto": 2,
|
||||||
|
|
||||||
|
// es2015 features
|
||||||
|
"require-yield": 2,
|
||||||
|
"template-curly-spacing": [2, "never"],
|
||||||
|
|
||||||
|
// spacing details
|
||||||
|
"space-infix-ops": 2,
|
||||||
|
"space-in-parens": [2, "never"],
|
||||||
|
"array-bracket-spacing": [2, "never"],
|
||||||
|
"comma-spacing": [2, { "before": false, "after": true }],
|
||||||
|
"keyword-spacing": [2, "always"],
|
||||||
|
"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"),
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
};
|
||||||
73
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
73
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: Something doesn't work like it should? Tell us!
|
||||||
|
title: "[BUG]"
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- ⚠️⚠️ Do not delete this template ⚠️⚠️ -->
|
||||||
|
|
||||||
|
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
|
||||||
|
<!-- 🧪 Test using the latest Playwright release to see if your issue has already been fixed -->
|
||||||
|
<!-- 💡 Provide enough information for us to be able to reproduce your issue locally -->
|
||||||
|
|
||||||
|
### System info
|
||||||
|
- Playwright Version: [v1.XX]
|
||||||
|
- Operating System: [All, Windows 11, Ubuntu 20, macOS 13.2, etc.]
|
||||||
|
- Browser: [All, Chromium, Firefox, WebKit]
|
||||||
|
- Other info:
|
||||||
|
|
||||||
|
### Source code
|
||||||
|
|
||||||
|
- [ ] I provided exact source code that allows reproducing the issue locally.
|
||||||
|
|
||||||
|
<!-- For simple cases, please provide a self-contained test file along with the config file -->
|
||||||
|
<!-- For larger cases, you can provide a GitHub repo you created for this issue -->
|
||||||
|
<!-- If we can not reproduce the problem locally, we won't be able to act on it -->
|
||||||
|
<!-- You can still file without the exact code and we will try to help, but if we can't repro, it will be closed -->
|
||||||
|
|
||||||
|
**Link to the GitHub repository with the repro**
|
||||||
|
|
||||||
|
[https://github.com/your_profile/playwright_issue_title]
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
**Config file**
|
||||||
|
|
||||||
|
```js
|
||||||
|
// playwright.config.ts
|
||||||
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: { ...devices['Desktop Chrome'], },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**Test file (self-contained)**
|
||||||
|
|
||||||
|
```js
|
||||||
|
it('should check the box using setChecked', async ({ page }) => {
|
||||||
|
await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
||||||
|
await page.getByRole('checkbox').check();
|
||||||
|
await expect(page.getByRole('checkbox')).toBeChecked();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**Steps**
|
||||||
|
- [Run the test]
|
||||||
|
- [...]
|
||||||
|
|
||||||
|
**Expected**
|
||||||
|
|
||||||
|
[Describe expected behavior]
|
||||||
|
|
||||||
|
**Actual**
|
||||||
|
|
||||||
|
[Describe actual behavior]
|
||||||
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
|
|
@ -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
|
|
||||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
1
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,4 +1,3 @@
|
||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Join our Discord Server
|
- name: Join our Discord Server
|
||||||
url: https://aka.ms/playwright/discord
|
url: https://aka.ms/playwright/discord
|
||||||
|
|
|
||||||
29
.github/ISSUE_TEMPLATE/documentation.yml
vendored
29
.github/ISSUE_TEMPLATE/documentation.yml
vendored
|
|
@ -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
|
|
||||||
30
.github/ISSUE_TEMPLATE/feature.yml
vendored
30
.github/ISSUE_TEMPLATE/feature.yml
vendored
|
|
@ -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
|
|
||||||
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal 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?
|
||||||
27
.github/ISSUE_TEMPLATE/question.yml
vendored
27
.github/ISSUE_TEMPLATE/question.yml
vendored
|
|
@ -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
32
.github/ISSUE_TEMPLATE/regression.md
vendored
Normal 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.
|
||||||
96
.github/ISSUE_TEMPLATE/regression.yml
vendored
96
.github/ISSUE_TEMPLATE/regression.yml
vendored
|
|
@ -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
|
|
||||||
26
.github/ISSUE_TEMPLATE/vscode-extension.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/vscode-extension.md
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
name: VSCode extension bug
|
||||||
|
about: Something doesn't work like it should inside the Visual Studio Code extension or you have a feature request? 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]
|
||||||
|
- Visual Studio Code version: [e.g. 1.65]
|
||||||
|
- Playwright for VSCode extension version: [e.g. 1.2.3]
|
||||||
|
- Browser: [e.g. All, Chromium, Firefox, WebKit]
|
||||||
|
- 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:
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
|
||||||
|
Add any other details about the problem here.
|
||||||
48
.github/actions/download-artifact/action.yml
vendored
48
.github/actions/download-artifact/action.yml
vendored
|
|
@ -1,44 +1,40 @@
|
||||||
name: 'Download artifacts'
|
name: 'Download blob report'
|
||||||
description: 'Download artifacts from GitHub'
|
description: 'Download blob report from GitHub artifacts'
|
||||||
inputs:
|
inputs:
|
||||||
namePrefix:
|
name:
|
||||||
description: 'Name prefix of the artifacts to download'
|
description: 'Name of the artifact to download'
|
||||||
required: true
|
required: true
|
||||||
|
type: string
|
||||||
default: 'blob-report'
|
default: 'blob-report'
|
||||||
path:
|
path:
|
||||||
description: 'Directory with downloaded artifacts'
|
description: 'Directory with downloaded artifacts'
|
||||||
required: true
|
required: true
|
||||||
default: '.'
|
type: string
|
||||||
|
default: 'blob-report'
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Create temp downloads dir
|
- name: Download blob report
|
||||||
shell: bash
|
uses: actions/github-script@v6
|
||||||
run: mkdir -p '${{ inputs.path }}/artifacts'
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
console.log(`downloading artifacts for workflow_run: ${context.payload.workflow_run.id}`);
|
console.log(`downloading artifacts for workflow_run: ${context.payload.workflow_run.id}`);
|
||||||
console.log(`workflow_run: ${JSON.stringify(context.payload.workflow_run, null, 2)}`);
|
console.log(`workflow_run: ${JSON.stringify(context.payload.workflow_run, null, 2)}`);
|
||||||
const allArtifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {
|
const { data } = await github.rest.actions.listWorkflowRunArtifacts({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
run_id: context.payload.workflow_run.id
|
run_id: context.payload.workflow_run.id
|
||||||
});
|
});
|
||||||
console.log('total = ', allArtifacts.length);
|
console.log('total = ', data.total_count);
|
||||||
const artifacts = allArtifacts.filter(a => a.name.startsWith('${{ inputs.namePrefix }}'));
|
const name = '${{ inputs.name }}';
|
||||||
|
const report = data.artifacts.filter(a => a.name === name)[0];
|
||||||
|
const result = await github.rest.actions.downloadArtifact({
|
||||||
|
...context.repo,
|
||||||
|
artifact_id: report.id,
|
||||||
|
archive_format: 'zip'
|
||||||
|
});
|
||||||
|
console.log('download result', result);
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
for (const artifact of artifacts) {
|
fs.writeFileSync(`${name}.zip`, Buffer.from(result.data));
|
||||||
const result = await github.rest.actions.downloadArtifact({
|
- name: Unzip blob report
|
||||||
...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
|
shell: bash
|
||||||
run: |
|
run: unzip ${{ inputs.name }}.zip -d ${{ inputs.path }}
|
||||||
unzip -n '${{ inputs.path }}/artifacts/*.zip' -d ${{ inputs.path }}
|
|
||||||
rm -rf '${{ inputs.path }}/artifacts'
|
|
||||||
|
|
|
||||||
29
.github/actions/download-blob-report-from-azure/action.yml
vendored
Normal file
29
.github/actions/download-blob-report-from-azure/action.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: 'Download blob report from Azure'
|
||||||
|
description: 'Download blob report from Azure blob storage'
|
||||||
|
inputs:
|
||||||
|
blob_prefix:
|
||||||
|
description: 'Name of the Azure blob storage directory containing blob report'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
output_dir:
|
||||||
|
description: 'Output directory where downloaded blobs will be stored'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: 'blob-report'
|
||||||
|
connection_string:
|
||||||
|
description: 'Azure connection string'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Download Blob Reports from Azure Blob Storage
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
OUTPUT_DIR='${{ inputs.output_dir }}'
|
||||||
|
mkdir -p $OUTPUT_DIR
|
||||||
|
LIST=$(az storage blob list -c '$web' --prefix ${{ inputs.blob_prefix }} --connection-string "${{ inputs.connection_string }}")
|
||||||
|
for name in $(echo $LIST | jq --raw-output '.[].name | select(test("report-.*\\.zip$"))');
|
||||||
|
do
|
||||||
|
az storage blob download -c '$web' --name $name -f $OUTPUT_DIR/$(basename $name) --connection-string "${{ inputs.connection_string }}"
|
||||||
|
done
|
||||||
|
|
@ -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"
|
|
||||||
93
.github/actions/run-test/action.yml
vendored
93
.github/actions/run-test/action.yml
vendored
|
|
@ -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 }}
|
|
||||||
28
.github/actions/upload-blob-report/action.yml
vendored
28
.github/actions/upload-blob-report/action.yml
vendored
|
|
@ -4,31 +4,25 @@ inputs:
|
||||||
report_dir:
|
report_dir:
|
||||||
description: 'Directory containing blob report'
|
description: 'Directory containing blob report'
|
||||||
required: true
|
required: true
|
||||||
default: 'test-results/blob-report'
|
type: string
|
||||||
job_name:
|
default: 'blob-report'
|
||||||
description: 'Unique job name'
|
|
||||||
required: true
|
|
||||||
default: ''
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Integrity check
|
|
||||||
shell: bash
|
|
||||||
run: find "${{ inputs.report_dir }}" -name "*.zip" -exec unzip -t {} \;
|
|
||||||
- name: Upload blob report to GitHub
|
- name: Upload blob report to GitHub
|
||||||
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
if: always() && github.event_name == 'pull_request'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: blob-report-${{ inputs.job_name }}
|
name: all-blob-reports
|
||||||
path: ${{ inputs.report_dir }}/**
|
path: ${{ inputs.report_dir }}
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
- name: Write triggering pull request number in a file
|
- name: Write triggering pull request number in a file
|
||||||
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
if: always() && github.event_name == 'pull_request'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo '${{ github.event.number }}' > pull_request_number.txt;
|
run: echo '${{ github.event.number }}' > pull_request_number.txt;
|
||||||
- name: Upload artifact with the pull request number
|
- name: Upload artifact with the pull request number
|
||||||
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
if: always() && github.event_name == 'pull_request'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: pull-request-${{ inputs.job_name }}
|
name: pull-request
|
||||||
path: pull_request_number.txt
|
path: pull_request_number.txt
|
||||||
|
|
|
||||||
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
|
|
@ -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:
|
|
||||||
- "*"
|
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright-chromium/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright-chromium/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright-core/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright-core/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright-firefox/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright-firefox/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright-test/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright-test/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright-webkit/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright-webkit/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
7
.github/dummy-package-files-for-dependents-analytics/playwright/package.json
vendored
Normal file
7
.github/dummy-package-files-for-dependents-analytics/playwright/package.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
|
|
@ -12,9 +12,6 @@ on:
|
||||||
description: Comma-separated list of commit hashes to cherry-pick
|
description: Comma-separated list of commit hashes to cherry-pick
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
roll:
|
roll:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
@ -26,7 +23,7 @@ jobs:
|
||||||
echo "Version is not a two digit semver version"
|
echo "Version is not a two digit semver version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: release-${{ github.event.inputs.version }}
|
ref: release-${{ github.event.inputs.version }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
@ -60,7 +57,7 @@ jobs:
|
||||||
git checkout -b "$BRANCH_NAME"
|
git checkout -b "$BRANCH_NAME"
|
||||||
git push origin $BRANCH_NAME
|
git push origin $BRANCH_NAME
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
|
||||||
56
.github/workflows/create_test_report.yml
vendored
56
.github/workflows/create_test_report.yml
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
name: Publish Test Results
|
name: Publish Test Results
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: ["tests 1", "tests 2", "tests others"]
|
workflows: ["tests 1", "tests 2"]
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -9,40 +9,31 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
checks: 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' }}
|
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
DEBUG: pw:install
|
DEBUG: pw:install
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
|
||||||
- name: Download blob report artifact
|
- name: Download blob report artifact
|
||||||
uses: ./.github/actions/download-artifact
|
uses: ./.github/actions/download-artifact
|
||||||
with:
|
with:
|
||||||
namePrefix: 'blob-report'
|
name: all-blob-reports
|
||||||
path: 'all-blob-reports'
|
path: all-blob-reports
|
||||||
|
|
||||||
- name: Merge reports
|
- name: Merge reports
|
||||||
run: |
|
run: |
|
||||||
npx playwright merge-reports --config .github/workflows/merge.config.ts ./all-blob-reports
|
npx playwright merge-reports --reporter markdown,html ./all-blob-reports
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=8192
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
|
|
||||||
- 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
|
- name: Upload HTML report to Azure
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -50,16 +41,19 @@ jobs:
|
||||||
azcopy cp --recursive "./playwright-report/*" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR"
|
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"
|
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html"
|
||||||
env:
|
env:
|
||||||
AZCOPY_AUTO_LOGIN_TYPE: AZCLI
|
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 }}'
|
||||||
|
|
||||||
- name: Read pull request number
|
- name: Read pull request number
|
||||||
uses: ./.github/actions/download-artifact
|
uses: ./.github/actions/download-artifact
|
||||||
with:
|
with:
|
||||||
namePrefix: 'pull-request'
|
name: 'pull-request'
|
||||||
path: '.'
|
path: './'
|
||||||
|
|
||||||
- name: Comment on PR
|
- name: Comment on PR
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -121,3 +115,21 @@ jobs:
|
||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
core.info('Posted comment: ' + response.html_url);
|
core.info('Posted comment: ' + response.html_url);
|
||||||
|
|
||||||
|
const check = await github.rest.checks.create({
|
||||||
|
...context.repo,
|
||||||
|
name: 'Merge report (${{ github.event.workflow_run.name }})',
|
||||||
|
head_sha: '${{ github.event.workflow_run.head_sha }}',
|
||||||
|
status: 'completed',
|
||||||
|
conclusion: 'success',
|
||||||
|
details_url: reportUrl,
|
||||||
|
output: {
|
||||||
|
title: 'Test results for "${{ github.event.workflow_run.name }}"',
|
||||||
|
summary: [
|
||||||
|
reportMd,
|
||||||
|
'',
|
||||||
|
'---',
|
||||||
|
`Full [HTML report](${reportUrl}). Merge [workflow run](${mergeWorkflowUrl}).`
|
||||||
|
].join('\n'),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
27
.github/workflows/infra.yml
vendored
27
.github/workflows/infra.yml
vendored
|
|
@ -16,12 +16,13 @@ env:
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
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-deps
|
- run: npx playwright install-deps
|
||||||
|
|
@ -35,27 +36,21 @@ 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:
|
lint-snippets:
|
||||||
name: "Lint snippets"
|
name: "Lint snippets"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
- uses: actions/setup-dotnet@v4
|
- uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 8.0.x
|
||||||
- uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '21'
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: pip install -r utils/doclint/linting-code-snippets/python/requirements.txt
|
- 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
|
- run: node utils/doclint/linting-code-snippets/cli.js
|
||||||
|
|
|
||||||
4
.github/workflows/merge.config.ts
vendored
4
.github/workflows/merge.config.ts
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
export default {
|
|
||||||
testDir: '../../tests',
|
|
||||||
reporter: [[require.resolve('../../packages/playwright/lib/reporters/markdown')], ['html']]
|
|
||||||
};
|
|
||||||
|
|
@ -4,39 +4,30 @@ 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/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@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0];
|
|
||||||
const { data } = await github.rest.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.rest.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 = '';
|
||||||
|
|
@ -54,11 +45,11 @@ 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.rest.issues.update({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
issue_number: issueNumber,
|
issue_number: issueNumber,
|
||||||
body: newBody
|
body: newBody
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
43
.github/workflows/publish_canary.yml
vendored
43
.github/workflows/publish_canary.yml
vendored
|
|
@ -13,19 +13,16 @@ env:
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
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,28 +47,36 @@ 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@v2
|
||||||
|
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
|
- 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')
|
||||||
|
|
|
||||||
37
.github/workflows/publish_release_docker.yml
vendored
37
.github/workflows/publish_release_docker.yml
vendored
|
|
@ -2,6 +2,12 @@ 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]
|
||||||
|
|
||||||
|
|
@ -11,31 +17,28 @@ env:
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
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@v2
|
||||||
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')
|
||||||
|
|
|
||||||
21
.github/workflows/publish_release_driver.yml
vendored
21
.github/workflows/publish_release_driver.yml
vendored
|
|
@ -10,28 +10,21 @@ env:
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
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 }}
|
||||||
|
|
|
||||||
16
.github/workflows/publish_release_npm.yml
vendored
16
.github/workflows/publish_release_npm.yml
vendored
|
|
@ -10,25 +10,23 @@ env:
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
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 }}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,14 @@ 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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
|
- 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:
|
||||||
|
|
|
||||||
|
|
@ -3,54 +3,40 @@ 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:
|
env:
|
||||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
|
- 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}"
|
BRANCH_NAME="roll-into-pw-${{ github.event.client_payload.browser }}/${{ github.event.client_payload.revision }}"
|
||||||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||||
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@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -59,7 +45,7 @@ jobs:
|
||||||
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({
|
await github.rest.issues.addLabels({
|
||||||
owner: 'microsoft',
|
owner: 'microsoft',
|
||||||
|
|
|
||||||
8
.github/workflows/roll_driver_nodejs.yml
vendored
8
.github/workflows/roll_driver_nodejs.yml
vendored
|
|
@ -9,11 +9,9 @@ jobs:
|
||||||
name: Trigger Roll
|
name: Trigger Roll
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
if: github.repository == 'microsoft/playwright'
|
if: github.repository == 'microsoft/playwright'
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
- run: node utils/build/update-playwright-driver-version.mjs
|
- run: node utils/build/update-playwright-driver-version.mjs
|
||||||
|
|
@ -35,7 +33,7 @@ jobs:
|
||||||
git push origin $BRANCH_NAME
|
git push origin $BRANCH_NAME
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
|
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
|
||||||
71
.github/workflows/tests_bidi.yml
vendored
71
.github/workflows/tests_bidi.yml
vendored
|
|
@ -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
|
|
||||||
15
.github/workflows/tests_components.yml
vendored
15
.github/workflows/tests_components.yml
vendored
|
|
@ -19,23 +19,18 @@ env:
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
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
|
||||||
|
|
|
||||||
49
.github/workflows/tests_electron.yml
vendored
Normal file
49
.github/workflows/tests_electron.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
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@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
166
.github/workflows/tests_others.yml
vendored
166
.github/workflows/tests_others.yml
vendored
|
|
@ -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:
|
|
||||||
207
.github/workflows/tests_primary.yml
vendored
207
.github/workflows/tests_primary.yml
vendored
|
|
@ -22,117 +22,138 @@ 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
|
||||||
|
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
|
||||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||||
|
|
||||||
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-22.04]
|
||||||
node-version: [18]
|
node-version: [16]
|
||||||
include:
|
include:
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
node-version: 18
|
||||||
|
browser: chromium
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
node-version: 20
|
node-version: 20
|
||||||
browser: chromium
|
browser: chromium
|
||||||
- os: ubuntu-22.04
|
|
||||||
node-version: 22
|
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
- run: npm ci
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-*
|
env:
|
||||||
bot-name: "${{ matrix.browser }}-${{ matrix.os }}-node${{ matrix.node-version }}"
|
DEBUG: pw:install
|
||||||
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
|
- run: npm run build
|
||||||
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
|
- 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:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
|
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: chromium-tip-of-tree
|
node-version: 16
|
||||||
command: npm run test -- --project=chromium-*
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.os }}-chromium-tip-of-tree"
|
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 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.os }}-chromium-tip-of-tree"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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: [16]
|
||||||
shardIndex: [1, 2]
|
shard: [1/2, 2/2]
|
||||||
shardTotal: [2]
|
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
node-version: 20
|
node-version: 18
|
||||||
shardIndex: 1
|
shard: 1/2
|
||||||
shardTotal: 2
|
- os: ubuntu-latest
|
||||||
|
node-version: 18
|
||||||
|
shard: 2/2
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
node-version: 20
|
node-version: 20
|
||||||
shardIndex: 2
|
shard: 1/2
|
||||||
shardTotal: 2
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
node-version: 22
|
node-version: 20
|
||||||
shardIndex: 1
|
shard: 2/2
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{matrix.node-version}}
|
node-version: ${{matrix.node-version}}
|
||||||
command: npm run ttest -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.os }}-node${{ matrix.node-version }}-${{ matrix.shardIndex }}"
|
|
||||||
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 -- --shard ${{ matrix.shard }}
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
|
if: matrix.os != 'ubuntu-latest'
|
||||||
|
- run: xvfb-run npm run ttest -- --shard ${{ matrix.shard }}
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
DEBUG: pw:install
|
DEBUG: pw:install
|
||||||
|
|
@ -141,35 +162,31 @@ jobs:
|
||||||
- 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:
|
env:
|
||||||
PWTEST_BOT_NAME: "web-components-html-reporter"
|
PWTEST_BLOB_REPORT_NAME: "web-components-html-reporter"
|
||||||
- name: Upload blob report
|
- name: Upload blob report
|
||||||
if: ${{ !cancelled() }}
|
if: always()
|
||||||
uses: ./.github/actions/upload-blob-report
|
uses: ./.github/actions/upload-blob-report
|
||||||
with:
|
with:
|
||||||
report_dir: packages/html-reporter/blob-report
|
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()
|
||||||
env:
|
env:
|
||||||
PWTEST_BOT_NAME: "web-components-web"
|
PWTEST_BLOB_REPORT_NAME: "web-components-web"
|
||||||
- name: Upload blob report
|
- name: Upload blob report
|
||||||
if: ${{ !cancelled() }}
|
if: always()
|
||||||
uses: ./.github/actions/upload-blob-report
|
uses: ./.github/actions/upload-blob-report
|
||||||
with:
|
with:
|
||||||
report_dir: packages/web/blob-report
|
report_dir: packages/web/blob-report
|
||||||
job_name: "web-components-web"
|
|
||||||
|
|
||||||
test_vscode_extension:
|
test_vscode_extension:
|
||||||
name: VSCode Extension
|
name: VSCode Extension
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
PWTEST_BOT_NAME: "vscode-extension"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
DEBUG: pw:install
|
DEBUG: pw:install
|
||||||
|
|
@ -188,17 +205,18 @@ jobs:
|
||||||
working-directory: ./playwright-vscode
|
working-directory: ./playwright-vscode
|
||||||
- name: Run extension tests
|
- name: Run extension tests
|
||||||
run: npm run test -- --workers=1
|
run: npm run test -- --workers=1
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "vscode-extension"
|
||||||
working-directory: ./playwright-vscode
|
working-directory: ./playwright-vscode
|
||||||
- name: Upload blob report
|
- name: Upload blob report
|
||||||
if: ${{ !cancelled() }}
|
if: always()
|
||||||
uses: ./.github/actions/upload-blob-report
|
uses: ./.github/actions/upload-blob-report
|
||||||
with:
|
with:
|
||||||
report_dir: playwright-vscode/blob-report
|
report_dir: ./playwright-vscode/blob-report
|
||||||
job_name: ${{ env.PWTEST_BOT_NAME }}
|
|
||||||
|
|
||||||
test_package_installations:
|
test_package_installations:
|
||||||
name: "Installation Test ${{ matrix.os }}"
|
name: "Installation Test ${{ matrix.os }}"
|
||||||
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -206,27 +224,32 @@ jobs:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
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@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- run: npm ci
|
||||||
|
env:
|
||||||
|
DEBUG: pw:install
|
||||||
|
- run: npm run build
|
||||||
|
- run: npx playwright install-deps
|
||||||
- run: npm install -g yarn@1
|
- run: npm install -g yarn@1
|
||||||
- run: npm install -g pnpm@8
|
- run: npm install -g pnpm@8
|
||||||
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
|
- run: npm run itest
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: matrix.os != 'ubuntu-latest'
|
||||||
run: |
|
env:
|
||||||
if grep -q "Ubuntu 24" /etc/os-release; then
|
PWTEST_BLOB_REPORT_NAME: "package-installations-${{ matrix.os }}"
|
||||||
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run itest
|
||||||
fi
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "package-installations-${{ matrix.os }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: ./.github/actions/run-test
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
with:
|
with:
|
||||||
command: npm run itest
|
report_dir: blob-report
|
||||||
bot-name: "package-installations-${{ matrix.os }}"
|
|
||||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
|
||||||
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 }}
|
|
||||||
|
|
|
||||||
879
.github/workflows/tests_secondary.yml
vendored
879
.github/workflows/tests_secondary.yml
vendored
|
|
@ -17,162 +17,205 @@ 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
|
||||||
|
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
|
||||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||||
|
|
||||||
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-20.04, ubuntu-22.04]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
node-version: 16
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-*
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.browser }}-${{ matrix.os }}"
|
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 }}
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-${{ matrix.os }}"
|
||||||
|
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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-12, macos-13]
|
||||||
# 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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
node-version: 16
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-*
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.browser }}-${{ matrix.os }}"
|
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: npm run test -- --project=${{ matrix.browser }}
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-${{ matrix.os }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
node-version: 16
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-* ${{ matrix.browser == 'firefox' && '--workers 1' || '' }}
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.browser }}-windows-latest"
|
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: npm run test -- --project=${{ matrix.browser }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-windows-latest"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
test-package-installations-other-node-versions:
|
test-package-installations-other-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: 18
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
node_version: 22
|
node_version: 20
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- run: npm install -g yarn@1
|
- uses: actions/setup-node@v3
|
||||||
- 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 ci
|
||||||
bot-name: "package-installations-${{ 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 }}
|
- run: npm run build
|
||||||
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
|
- run: npx playwright install-deps
|
||||||
|
- run: npm install -g yarn@1
|
||||||
|
- run: npm install -g pnpm@8
|
||||||
|
- 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-20.04, ubuntu-22.04, 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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
node-version: 16
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-* --headed
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.browser }}-headed-${{ matrix.os }}"
|
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 }} --headed
|
||||||
|
if: always() && startsWith(matrix.os, 'ubuntu-')
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-headed-${{ matrix.os }}"
|
||||||
|
- run: npm run test -- --project=${{ matrix.browser }} --headed
|
||||||
|
if: always() && !startsWith(matrix.os, 'ubuntu-')
|
||||||
|
env:
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-headed-${{ matrix.os }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: chromium
|
node-version: 16
|
||||||
command: npm run ctest
|
- run: npm ci
|
||||||
bot-name: "${{ matrix.mode }}"
|
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 chromium
|
||||||
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
|
||||||
env:
|
env:
|
||||||
PWTEST_MODE: ${{ matrix.mode }}
|
PWTEST_MODE: ${{ matrix.mode }}
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.mode }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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 +227,613 @@ 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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium ${{ matrix.channel }}
|
node-version: 16
|
||||||
command: npm run test -- --project=${{ matrix.browser }}-*
|
- run: npm ci
|
||||||
bot-name: "tracing-${{ matrix.channel || matrix.browser }}"
|
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 ${{ 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 }}
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "tracing-${{ matrix.channel || matrix.browser }}"
|
||||||
test_chromium_channels:
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
name: Test ${{ matrix.channel }} on ${{ matrix.runs-on }}
|
if: always()
|
||||||
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
|
shell: bash
|
||||||
runs-on: ${{ matrix.runs-on }}
|
- name: Upload blob report
|
||||||
strategy:
|
if: always()
|
||||||
fail-fast: false
|
uses: ./.github/actions/upload-blob-report
|
||||||
matrix:
|
|
||||||
channel: [chrome, chrome-beta, msedge, msedge-beta, msedge-dev]
|
|
||||||
runs-on: [ubuntu-20.04, macos-latest, windows-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: ./.github/actions/run-test
|
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.channel }}
|
report_dir: blob-report
|
||||||
command: npm run ctest
|
|
||||||
bot-name: ${{ matrix.channel }}-${{ matrix.runs-on }}
|
chrome_stable_linux:
|
||||||
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
|
name: "Chrome Stable (Linux)"
|
||||||
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
|
runs-on: ubuntu-20.04
|
||||||
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- run: npm ci
|
||||||
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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-stable-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
chrome_stable_win:
|
||||||
|
name: "Chrome Stable (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-stable-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
chrome_stable_mac:
|
||||||
|
name: "Chrome Stable (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-stable-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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]
|
os: [ubuntu-20.04, macos-12, windows-latest]
|
||||||
headed: ['--headed', '']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: chromium-tip-of-tree
|
node-version: 16
|
||||||
command: npm run ctest -- ${{ matrix.headed }}
|
- run: npm ci
|
||||||
bot-name: "chromium-tip-of-tree-${{ matrix.os }}${{ matrix.headed }}"
|
env:
|
||||||
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
|
- run: npm run build
|
||||||
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
|
- 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-20.04'
|
||||||
env:
|
env:
|
||||||
PWTEST_CHANNEL: chromium-tip-of-tree
|
PWTEST_CHANNEL: chromium-tip-of-tree
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "tip-of-tree-${{ matrix.os }}"
|
||||||
chromium_tot_headless_shell:
|
- run: npm run ctest
|
||||||
name: Chromium tip-of-tree headless-shell-${{ matrix.os }}
|
if: matrix.os != 'ubuntu-20.04'
|
||||||
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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "tip-of-tree-${{ matrix.os }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: firefox-beta chromium
|
node-version: 16
|
||||||
command: npm run ftest
|
- run: npm ci
|
||||||
bot-name: "firefox-beta-${{ matrix.os }}"
|
env:
|
||||||
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
|
- run: npm run build
|
||||||
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "tip-of-tree-headed-${{ matrix.os }}"
|
||||||
|
- run: npm run ctest -- --headed
|
||||||
|
if: matrix.os != 'ubuntu-latest'
|
||||||
|
env:
|
||||||
|
PWTEST_CHANNEL: chromium-tip-of-tree
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "tip-of-tree-headed-${{ matrix.os }}"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
firefox_beta_linux:
|
||||||
|
name: "Firefox Beta (Linux)"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "firefox-beta-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
firefox_beta_win:
|
||||||
|
name: "Firefox Beta (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "firefox-beta-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
firefox_beta_mac:
|
||||||
|
name: "Firefox Beta (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "firefox-beta-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_stable_mac:
|
||||||
|
name: "Edge Stable (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-stable-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_stable_win:
|
||||||
|
name: "Edge Stable (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-stable-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_stable_linux:
|
||||||
|
name: "Edge Stable (Linux)"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-stable-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_beta_mac:
|
||||||
|
name: "Edge Beta (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-beta-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_beta_win:
|
||||||
|
name: "Edge Beta (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-beta-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_beta_linux:
|
||||||
|
name: "Edge Beta (Linux)"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-beta-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_dev_mac:
|
||||||
|
name: "Edge Dev (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-dev-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_dev_win:
|
||||||
|
name: "Edge Dev (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-dev-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
edge_dev_linux:
|
||||||
|
name: "Edge Dev (Linux)"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "edge-dev-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
chrome_beta_linux:
|
||||||
|
name: "Chrome Beta (Linux)"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-beta-linux"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
chrome_beta_win:
|
||||||
|
name: "Chrome Beta (Win)"
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-beta-windows"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
|
chrome_beta_mac:
|
||||||
|
name: "Chrome Beta (Mac)"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- 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
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "chrome-beta-mac"
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
||||||
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@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 16
|
||||||
- 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:
|
test_linux_chromium_headless_new:
|
||||||
name: Test channel=chromium
|
name: Linux Chromium Headless New
|
||||||
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.runs-on }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
# TODO: this should pass --no-shell.
|
node-version: 16
|
||||||
# However, codegen tests do not inherit the channel and try to launch headless shell.
|
- run: npm ci
|
||||||
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:
|
env:
|
||||||
PWTEST_CHANNEL: chromium
|
DEBUG: pw:install
|
||||||
|
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
|
||||||
|
env:
|
||||||
|
PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1
|
||||||
|
PWTEST_BLOB_REPORT_NAME: "headless-new"
|
||||||
|
- run: node tests/config/checkCoverage.js chromium
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
- name: Upload blob report
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/actions/upload-blob-report
|
||||||
|
with:
|
||||||
|
report_dir: blob-report
|
||||||
|
|
|
||||||
20
.github/workflows/tests_service.yml
vendored
20
.github/workflows/tests_service.yml
vendored
|
|
@ -17,24 +17,24 @@ jobs:
|
||||||
browser: [chromium, firefox, webkit]
|
browser: [chromium, firefox, webkit]
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --workers=10 --retries=0
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --workers=10 --retries=0
|
||||||
env:
|
env:
|
||||||
PWTEST_MODE: service2
|
PWTEST_MODE: service2
|
||||||
PWTEST_TRACE: 1
|
PWTEST_TRACE: 1
|
||||||
PWTEST_BOT_NAME: "${{ matrix.browser }}-${{ matrix.service-os }}-service"
|
PWTEST_BLOB_REPORT_NAME: "${{ matrix.browser }}-${{ matrix.service-os }}-service"
|
||||||
PLAYWRIGHT_SERVICE_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_KEY }}
|
PLAYWRIGHT_SERVICE_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_KEY }}
|
||||||
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
|
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
|
||||||
PLAYWRIGHT_SERVICE_OS: ${{ matrix.service-os }}
|
PLAYWRIGHT_SERVICE_OS: ${{ matrix.service-os }}
|
||||||
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
|
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
|
||||||
- name: Upload blob report to GitHub
|
- name: Upload blob report to GitHub
|
||||||
if: ${{ !cancelled() }}
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: all-blob-reports
|
name: all-blob-reports
|
||||||
path: blob-report
|
path: blob-report
|
||||||
|
|
@ -43,17 +43,17 @@ jobs:
|
||||||
merge_reports:
|
merge_reports:
|
||||||
name: "Merge reports"
|
name: "Merge reports"
|
||||||
needs: [test]
|
needs: [test]
|
||||||
if: ${{ !cancelled() }}
|
if: always()
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- name: Download blob report artifact
|
- name: Download blob report artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: all-blob-reports
|
name: all-blob-reports
|
||||||
path: all-blob-reports
|
path: all-blob-reports
|
||||||
|
|
|
||||||
49
.github/workflows/tests_stress.yml
vendored
Normal file
49
.github/workflows/tests_stress.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: "stress"
|
||||||
|
|
||||||
|
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_components:
|
||||||
|
name: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
- run: npm i -g npm@8
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npx playwright install --with-deps
|
||||||
|
- run: npx playwright install firefox-asan
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
- run: npm run stest contexts -- --project=chromium
|
||||||
|
if: always()
|
||||||
|
- run: npm run stest browsers -- --project=chromium
|
||||||
|
if: always()
|
||||||
|
- run: npm run stest contexts -- --project=webkit
|
||||||
|
if: always()
|
||||||
|
- run: npm run stest browsers -- --project=webkit
|
||||||
|
if: always()
|
||||||
|
- run: npm run stest contexts -- --project=firefox
|
||||||
|
if: always()
|
||||||
|
- run: npm run stest browsers -- --project=firefox
|
||||||
|
if: always()
|
||||||
27
.github/workflows/tests_video.yml
vendored
27
.github/workflows/tests_video.yml
vendored
|
|
@ -9,30 +9,33 @@ 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
|
||||||
|
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
|
||||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||||
|
|
||||||
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]
|
os: [ubuntu-20.04, 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
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/run-test
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
browsers-to-install: ${{ matrix.browser }} chromium
|
node-version: 16
|
||||||
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()
|
||||||
|
shell: bash
|
||||||
|
|
|
||||||
45
.github/workflows/tests_webview2.yml
vendored
Normal file
45
.github/workflows/tests_webview2.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: "WebView2 Tests"
|
||||||
|
|
||||||
|
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 }}
|
||||||
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test_webview2:
|
||||||
|
name: WebView2
|
||||||
|
runs-on: windows-2022
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
- uses: actions/setup-dotnet@v2
|
||||||
|
with:
|
||||||
|
dotnet-version: '6.0.x'
|
||||||
|
- run: npm i -g npm@8
|
||||||
|
- run: npm ci
|
||||||
|
env:
|
||||||
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
|
- run: npm run build
|
||||||
|
- run: dotnet build
|
||||||
|
working-directory: tests/webview2/webview2-app/
|
||||||
|
- run: npm run webview2test
|
||||||
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
30
.github/workflows/trigger_build_chromium_with_symbols.yml
vendored
Normal file
30
.github/workflows/trigger_build_chromium_with_symbols.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: "Trigger: Chromium with Symbols Builds"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trigger:
|
||||||
|
name: "trigger"
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
- name: Get Chromium revision
|
||||||
|
id: chromium-version
|
||||||
|
run: |
|
||||||
|
REVISION=$(node -e "console.log(require('./packages/playwright-core/browsers.json').browsers.find(b => b.name === 'chromium-with-symbols').revision)")
|
||||||
|
echo "REVISION=$REVISION" >> $GITHUB_OUTPUT
|
||||||
|
- 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\": {\"revision\": \"${CHROMIUM_REVISION}\"}}" \
|
||||||
|
https://api.github.com/repos/microsoft/playwright-browsers/dispatches
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
CHROMIUM_REVISION: ${{ steps.chromium-version.outputs.REVISION }}
|
||||||
2
.github/workflows/trigger_tests.yml
vendored
2
.github/workflows/trigger_tests.yml
vendored
|
|
@ -9,7 +9,7 @@ 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 \
|
||||||
|
|
|
||||||
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -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/
|
||||||
|
|
@ -33,6 +31,4 @@ test-results
|
||||||
/tests/installation/output/
|
/tests/installation/output/
|
||||||
/tests/installation/.registry.json
|
/tests/installation/.registry.json
|
||||||
.cache/
|
.cache/
|
||||||
.eslintcache
|
.eslintcache
|
||||||
playwright.env
|
|
||||||
/firefox/
|
|
||||||
244
CONTRIBUTING.md
244
CONTRIBUTING.md
|
|
@ -1,87 +1,88 @@
|
||||||
# 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.
|
We strongly recommend that you open an issue before beginning any code modifications. This is particularly important if the changes involve complex logic or if the existing code isn't immediately clear. By doing so, we can discuss and agree upon the best approach to address a bug or implement a feature, ensuring that our efforts are aligned.
|
||||||
|
|
||||||
## Make a change
|
### Getting Code
|
||||||
|
|
||||||
|
Make sure you're running Node.js 16+ and NPM 8+, to verify and upgrade NPM do:
|
||||||
|
|
||||||
Make sure you're running Node.js 20 or later.
|
|
||||||
```bash
|
```bash
|
||||||
node --version
|
node --version
|
||||||
|
npm --version
|
||||||
|
npm i -g npm@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
1. Clone this repository
|
||||||
|
|
||||||
```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 ci
|
||||||
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, don’t 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 +93,144 @@ 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**
|
To build the documentation site locally and test how your changes will look in practice:
|
||||||
|
|
||||||
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.
|
1. Clone the [microsoft/playwright.dev](https://github.com/microsoft/playwright.dev) repo
|
||||||
|
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
|
||||||
|
1. Follow [the playwright.dev README instructions to "run dev server"](https://github.com/microsoft/playwright.dev/#run-dev-server) to view your changes
|
||||||
|
|
||||||
**Custom browser build**
|
### Adding New 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
npx playwright install
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
|
||||||
|
Be sure to run `npm run build` or let `npm run watch` run before you re-run the
|
||||||
|
tests after making your changes to check them.
|
||||||
|
|
||||||
|
- To run all tests in Chromium
|
||||||
|
```bash
|
||||||
|
npm run ctest # also `ftest` for firefox and `wtest` for WebKit
|
||||||
|
```
|
||||||
|
|
||||||
|
- To run the Playwright test runner tests
|
||||||
|
```bash
|
||||||
|
npm run ttest
|
||||||
|
npm run ttest -- --grep "specific test"
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
# How to File a Bug Report That Actually Gets Resolved
|
|
||||||
|
|
||||||
Make sure you’re 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 can’t reproduce them ourselves.
|
|
||||||
- We can’t 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 Overflow’s 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 it’s unlikely we can assist.
|
|
||||||
11
README.md
11
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# 🎭 Playwright
|
# 🎭 Playwright
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[](https://webkit.org/)<!-- GEN:stop --> [](https://aka.ms/playwright/discord)
|
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[](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)
|
||||||
|
|
||||||
|
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
||||||
|
|
||||||
| | 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 -->117.0.5938.62<!-- 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 -->17.0<!-- 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 -->117.0<!-- 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 browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||||
|
|
||||||
|
|
@ -46,6 +46,7 @@ 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
|
||||||
|
|
@ -162,7 +163,7 @@ 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/)
|
||||||
* [Contribution guide](CONTRIBUTING.md)
|
* [Contribution guide](CONTRIBUTING.md)
|
||||||
* [Changelog](https://github.com/microsoft/playwright/releases)
|
* [Changelog](https://github.com/microsoft/playwright/releases)
|
||||||
|
|
|
||||||
16
SECURITY.md
16
SECURITY.md
|
|
@ -1,20 +1,20 @@
|
||||||
<!-- 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).
|
||||||
|
|
||||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
|
|
@ -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 -->
|
||||||
|
|
|
||||||
17
SUPPORT.md
17
SUPPORT.md
|
|
@ -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
|
|
||||||
|
|
@ -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": [
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
REMOTE_URL="https://github.com/mozilla/gecko-dev"
|
REMOTE_URL="https://github.com/mozilla/gecko-dev"
|
||||||
BASE_BRANCH="release"
|
BASE_BRANCH="release"
|
||||||
BASE_REVISION="5cfa81898f6eef8fb1abe463e5253cea5bc17f3f"
|
BASE_REVISION="2be4fd198990dc742793fd1ba611888fb640e7f7"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
const uuidGen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
|
const uuidGen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
class Helper {
|
class Helper {
|
||||||
decorateAsEventEmitter(objectToDecorate) {
|
decorateAsEventEmitter(objectToDecorate) {
|
||||||
|
|
@ -23,16 +24,6 @@ class Helper {
|
||||||
return allBrowsingContexts;
|
return allBrowsingContexts;
|
||||||
}
|
}
|
||||||
|
|
||||||
awaitTopic(topic) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
const listener = () => {
|
|
||||||
Services.obs.removeObserver(listener, topic);
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
Services.obs.addObserver(listener, topic);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
toProtocolNavigationId(loadIdentifier) {
|
toProtocolNavigationId(loadIdentifier) {
|
||||||
return `nav-${loadIdentifier}`;
|
return `nav-${loadIdentifier}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
||||||
const { ChannelEventSinkFactory } = ChromeUtils.import("chrome://remote/content/cdp/observers/ChannelEventSink.jsm");
|
const { ChannelEventSinkFactory } = ChromeUtils.import("chrome://remote/content/cdp/observers/ChannelEventSink.jsm");
|
||||||
|
|
||||||
|
|
@ -111,7 +112,7 @@ class NetworkRequest {
|
||||||
this._frameId = helper.browsingContextToFrameId(browsingContext);
|
this._frameId = helper.browsingContextToFrameId(browsingContext);
|
||||||
|
|
||||||
this.requestId = httpChannel.channelId + '';
|
this.requestId = httpChannel.channelId + '';
|
||||||
this.navigationId = httpChannel.isMainDocumentChannel && loadInfo ? helper.toProtocolNavigationId(loadInfo.jugglerLoadIdentifier) : undefined;
|
this.navigationId = httpChannel.isMainDocumentChannel ? helper.toProtocolNavigationId(browsingContext.jugglerCurrentLoadIdentifier) : undefined;
|
||||||
|
|
||||||
this._redirectedIndex = 0;
|
this._redirectedIndex = 0;
|
||||||
if (redirectedFrom) {
|
if (redirectedFrom) {
|
||||||
|
|
@ -145,13 +146,9 @@ class NetworkRequest {
|
||||||
}
|
}
|
||||||
this._expectingInterception = false;
|
this._expectingInterception = false;
|
||||||
this._expectingResumedRequest = undefined; // { method, headers, postData }
|
this._expectingResumedRequest = undefined; // { method, headers, postData }
|
||||||
this._overriddenHeadersForRedirect = redirectedFrom?._overriddenHeadersForRedirect;
|
|
||||||
this._sentOnResponse = false;
|
this._sentOnResponse = false;
|
||||||
this._fulfilled = false;
|
|
||||||
|
|
||||||
if (this._overriddenHeadersForRedirect)
|
if (this._pageNetwork)
|
||||||
overrideRequestHeaders(httpChannel, this._overriddenHeadersForRedirect);
|
|
||||||
else if (this._pageNetwork)
|
|
||||||
appendExtraHTTPHeaders(httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
|
appendExtraHTTPHeaders(httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
|
||||||
|
|
||||||
this._responseBodyChunks = [];
|
this._responseBodyChunks = [];
|
||||||
|
|
@ -198,7 +195,6 @@ class NetworkRequest {
|
||||||
|
|
||||||
// Public interception API.
|
// Public interception API.
|
||||||
fulfill(status, statusText, headers, base64body) {
|
fulfill(status, statusText, headers, base64body) {
|
||||||
this._fulfilled = true;
|
|
||||||
this._interceptedChannel.synthesizeStatus(status, statusText);
|
this._interceptedChannel.synthesizeStatus(status, statusText);
|
||||||
for (const header of headers) {
|
for (const header of headers) {
|
||||||
this._interceptedChannel.synthesizeHeader(header.name, header.value);
|
this._interceptedChannel.synthesizeHeader(header.name, header.value);
|
||||||
|
|
@ -233,13 +229,16 @@ class NetworkRequest {
|
||||||
if (!this._expectingResumedRequest)
|
if (!this._expectingResumedRequest)
|
||||||
return;
|
return;
|
||||||
const { method, headers, postData } = this._expectingResumedRequest;
|
const { method, headers, postData } = this._expectingResumedRequest;
|
||||||
this._overriddenHeadersForRedirect = headers;
|
|
||||||
this._expectingResumedRequest = undefined;
|
this._expectingResumedRequest = undefined;
|
||||||
|
|
||||||
if (headers)
|
if (headers) {
|
||||||
overrideRequestHeaders(this.httpChannel, headers);
|
for (const header of requestHeaders(this.httpChannel))
|
||||||
else if (this._pageNetwork)
|
this.httpChannel.setRequestHeader(header.name, '', false /* merge */);
|
||||||
|
for (const header of headers)
|
||||||
|
this.httpChannel.setRequestHeader(header.name, header.value, false /* merge */);
|
||||||
|
} else if (this._pageNetwork) {
|
||||||
appendExtraHTTPHeaders(this.httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
|
appendExtraHTTPHeaders(this.httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
|
||||||
|
}
|
||||||
if (method)
|
if (method)
|
||||||
this.httpChannel.requestMethod = method;
|
this.httpChannel.requestMethod = method;
|
||||||
if (postData !== undefined)
|
if (postData !== undefined)
|
||||||
|
|
@ -364,6 +363,13 @@ class NetworkRequest {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const browserContext = pageNetwork._target.browserContext();
|
||||||
|
if (browserContext.crossProcessCookie.settings.onlineOverride === 'offline') {
|
||||||
|
// Implement offline.
|
||||||
|
this.abort(Cr.NS_ERROR_OFFLINE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ok, so now we have intercepted the request, let's issue onRequest.
|
// Ok, so now we have intercepted the request, let's issue onRequest.
|
||||||
// If interception has been disabled while we were intercepting, resume and forget.
|
// If interception has been disabled while we were intercepting, resume and forget.
|
||||||
const interceptionEnabled = this._shouldIntercept();
|
const interceptionEnabled = this._shouldIntercept();
|
||||||
|
|
@ -453,6 +459,8 @@ class NetworkRequest {
|
||||||
const browserContext = pageNetwork._target.browserContext();
|
const browserContext = pageNetwork._target.browserContext();
|
||||||
if (browserContext.requestInterceptionEnabled)
|
if (browserContext.requestInterceptionEnabled)
|
||||||
return true;
|
return true;
|
||||||
|
if (browserContext.crossProcessCookie.settings.onlineOverride === 'offline')
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -551,11 +559,7 @@ class NetworkRequest {
|
||||||
|
|
||||||
_sendOnRequestFinished() {
|
_sendOnRequestFinished() {
|
||||||
const pageNetwork = this._pageNetwork;
|
const pageNetwork = this._pageNetwork;
|
||||||
// Undefined |responseEndTime| means there has been no response yet.
|
if (pageNetwork) {
|
||||||
// This happens when request interception API is used to redirect
|
|
||||||
// the request to a different URL.
|
|
||||||
// In this case, we should not emit "requestFinished" event.
|
|
||||||
if (pageNetwork && this.httpChannel.responseEndTime !== undefined) {
|
|
||||||
let protocolVersion = undefined;
|
let protocolVersion = undefined;
|
||||||
try {
|
try {
|
||||||
protocolVersion = this.httpChannel.protocolVersion;
|
protocolVersion = this.httpChannel.protocolVersion;
|
||||||
|
|
@ -598,8 +602,6 @@ class NetworkObserver {
|
||||||
proxyFilter.onProxyFilterResult(defaultProxyInfo);
|
proxyFilter.onProxyFilterResult(defaultProxyInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this._targetRegistry.shouldBustHTTPAuthCacheForProxy(proxy))
|
|
||||||
Services.obs.notifyObservers(null, "net:clear-active-logins");
|
|
||||||
proxyFilter.onProxyFilterResult(protocolProxyService.newProxyInfo(
|
proxyFilter.onProxyFilterResult(protocolProxyService.newProxyInfo(
|
||||||
proxy.type,
|
proxy.type,
|
||||||
proxy.host,
|
proxy.host,
|
||||||
|
|
@ -725,7 +727,6 @@ function readRequestPostData(httpChannel) {
|
||||||
if (!iStream)
|
if (!iStream)
|
||||||
return undefined;
|
return undefined;
|
||||||
const isSeekableStream = iStream instanceof Ci.nsISeekableStream;
|
const isSeekableStream = iStream instanceof Ci.nsISeekableStream;
|
||||||
const isTellableStream = iStream instanceof Ci.nsITellableStream;
|
|
||||||
|
|
||||||
// For some reason, we cannot rewind back big streams,
|
// For some reason, we cannot rewind back big streams,
|
||||||
// so instead we should clone them.
|
// so instead we should clone them.
|
||||||
|
|
@ -734,9 +735,7 @@ function readRequestPostData(httpChannel) {
|
||||||
iStream = iStream.clone();
|
iStream = iStream.clone();
|
||||||
|
|
||||||
let prevOffset;
|
let prevOffset;
|
||||||
// Surprisingly, stream might implement `nsITellableStream` without
|
if (isSeekableStream) {
|
||||||
// implementing the `tell` method.
|
|
||||||
if (isSeekableStream && isTellableStream && iStream.tell) {
|
|
||||||
prevOffset = iStream.tell();
|
prevOffset = iStream.tell();
|
||||||
iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
|
iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -769,20 +768,6 @@ function requestHeaders(httpChannel) {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearRequestHeaders(httpChannel) {
|
|
||||||
for (const header of requestHeaders(httpChannel)) {
|
|
||||||
// We cannot remove the "host" header.
|
|
||||||
if (header.name.toLowerCase() === 'host')
|
|
||||||
continue;
|
|
||||||
httpChannel.setRequestHeader(header.name, '', false /* merge */);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function overrideRequestHeaders(httpChannel, headers) {
|
|
||||||
clearRequestHeaders(httpChannel);
|
|
||||||
appendExtraHTTPHeaders(httpChannel, headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
function causeTypeToString(causeType) {
|
function causeTypeToString(causeType) {
|
||||||
for (let key in Ci.nsIContentPolicy) {
|
for (let key in Ci.nsIContentPolicy) {
|
||||||
if (Ci.nsIContentPolicy[key] === causeType)
|
if (Ci.nsIContentPolicy[key] === causeType)
|
||||||
|
|
@ -815,8 +800,7 @@ class ResponseStorage {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let encodings = [];
|
let encodings = [];
|
||||||
// Note: fulfilled request comes with decoded body right away.
|
if ((request.httpChannel instanceof Ci.nsIEncodedChannel) && request.httpChannel.contentEncodings && !request.httpChannel.applyConversion) {
|
||||||
if ((request.httpChannel instanceof Ci.nsIEncodedChannel) && request.httpChannel.contentEncodings && !request.httpChannel.applyConversion && !request._fulfilled) {
|
|
||||||
const encodingHeader = request.httpChannel.getResponseHeader("Content-Encoding");
|
const encodingHeader = request.httpChannel.getResponseHeader("Content-Encoding");
|
||||||
encodings = encodingHeader.split(/\s*\t*,\s*\t*/);
|
encodings = encodingHeader.split(/\s*\t*,\s*\t*/);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,29 @@
|
||||||
const SIMPLE_CHANNEL_MESSAGE_NAME = 'juggler:simplechannel';
|
const SIMPLE_CHANNEL_MESSAGE_NAME = 'juggler:simplechannel';
|
||||||
|
|
||||||
class SimpleChannel {
|
class SimpleChannel {
|
||||||
constructor(name, uid) {
|
static createForActor(actor) {
|
||||||
|
const channel = new SimpleChannel('');
|
||||||
|
channel.bindToActor(actor);
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
static createForMessageManager(name, mm) {
|
||||||
|
const channel = new SimpleChannel(name);
|
||||||
|
|
||||||
|
const messageListener = {
|
||||||
|
receiveMessage: message => channel._onMessage(message.data)
|
||||||
|
};
|
||||||
|
mm.addMessageListener(SIMPLE_CHANNEL_MESSAGE_NAME, messageListener);
|
||||||
|
|
||||||
|
channel.setTransport({
|
||||||
|
sendMessage: obj => mm.sendAsyncMessage(SIMPLE_CHANNEL_MESSAGE_NAME, obj),
|
||||||
|
dispose: () => mm.removeMessageListener(SIMPLE_CHANNEL_MESSAGE_NAME, messageListener),
|
||||||
|
});
|
||||||
|
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(name) {
|
||||||
this._name = name;
|
this._name = name;
|
||||||
this._messageId = 0;
|
this._messageId = 0;
|
||||||
this._connectorId = 0;
|
this._connectorId = 0;
|
||||||
|
|
@ -23,13 +45,6 @@ class SimpleChannel {
|
||||||
this._ready = false;
|
this._ready = false;
|
||||||
this._paused = false;
|
this._paused = false;
|
||||||
this._disposed = false;
|
this._disposed = false;
|
||||||
|
|
||||||
this._bufferedResponses = new Map();
|
|
||||||
// This is a "unique" identifier of this end of the channel. Two SimpleChannel instances
|
|
||||||
// on the same end of the channel (e.g. two content processes) must not have the same id.
|
|
||||||
// This way, the other end can distinguish between the old peer with a new transport and a new peer.
|
|
||||||
this._uid = uid;
|
|
||||||
this._connectedToUID = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bindToActor(actor) {
|
bindToActor(actor) {
|
||||||
|
|
@ -58,12 +73,12 @@ class SimpleChannel {
|
||||||
// 1. There are two channel ends in different processes.
|
// 1. There are two channel ends in different processes.
|
||||||
// 2. Both ends start in the `ready = false` state, meaning that they will
|
// 2. Both ends start in the `ready = false` state, meaning that they will
|
||||||
// not send any messages over transport.
|
// not send any messages over transport.
|
||||||
// 3. Once channel end is created, it sends { ack: `READY` } message to the other end.
|
// 3. Once channel end is created, it sends `READY` message to the other end.
|
||||||
// 4. Eventually, at least one of the ends receives { ack: `READY` } message and responds with
|
// 4. Eventually, at least one of the ends receives `READY` message and responds with
|
||||||
// { ack: `READY_ACK` }. We assume at least one of the ends will receive { ack: "READY" } event from the other, since
|
// `READY_ACK`. We assume at least one of the ends will receive "READY" event from the other, since
|
||||||
// channel ends have a "parent-child" relation, i.e. one end is always created before the other one.
|
// channel ends have a "parent-child" relation, i.e. one end is always created before the other one.
|
||||||
// 5. Once channel end receives either { ack: `READY` } or { ack: `READY_ACK` }, it transitions to `ready` state.
|
// 5. Once channel end receives either `READY` or `READY_ACK`, it transitions to `ready` state.
|
||||||
this.transport.sendMessage({ ack: 'READY', uid: this._uid });
|
this.transport.sendMessage('READY');
|
||||||
}
|
}
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
|
|
@ -161,33 +176,15 @@ class SimpleChannel {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onMessage(data) {
|
_onMessage(data) {
|
||||||
if (data?.ack === 'READY') {
|
if (data === 'READY') {
|
||||||
// The "READY" and "READY_ACK" messages are a part of initialization sequence.
|
this.transport.sendMessage('READY_ACK');
|
||||||
// This sequence happens when:
|
|
||||||
// 1. A new SimpleChannel instance is getting initialized on the other end.
|
|
||||||
// In this case, it will have a different UID and we must clear
|
|
||||||
// `this._bufferedResponses` since they are no longer relevant.
|
|
||||||
// 2. A new transport is assigned to communicate between 2 SimpleChannel instances.
|
|
||||||
// In this case, we MUST NOT clear `this._bufferedResponses` since they are used
|
|
||||||
// to address the double-dispatch issue.
|
|
||||||
if (this._connectedToUID !== data.uid)
|
|
||||||
this._bufferedResponses.clear();
|
|
||||||
this._connectedToUID = data.uid;
|
|
||||||
this.transport.sendMessage({ ack: 'READY_ACK', uid: this._uid });
|
|
||||||
this._markAsReady();
|
this._markAsReady();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data?.ack === 'READY_ACK') {
|
if (data === 'READY_ACK') {
|
||||||
if (this._connectedToUID !== data.uid)
|
|
||||||
this._bufferedResponses.clear();
|
|
||||||
this._connectedToUID = data.uid;
|
|
||||||
this._markAsReady();
|
this._markAsReady();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data?.ack === 'RESPONSE_ACK') {
|
|
||||||
this._bufferedResponses.delete(data.responseId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this._paused)
|
if (this._paused)
|
||||||
this._bufferedIncomingMessages.push(data);
|
this._bufferedIncomingMessages.push(data);
|
||||||
else
|
else
|
||||||
|
|
@ -196,11 +193,12 @@ class SimpleChannel {
|
||||||
|
|
||||||
async _onMessageInternal(data) {
|
async _onMessageInternal(data) {
|
||||||
if (data.responseId) {
|
if (data.responseId) {
|
||||||
this.transport.sendMessage({ ack: 'RESPONSE_ACK', responseId: data.responseId });
|
|
||||||
const message = this._pendingMessages.get(data.responseId);
|
const message = this._pendingMessages.get(data.responseId);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
// During cross-process navigation, we might receive a response for
|
// During corss-process navigation, we might receive a response for
|
||||||
// the message sent by another process.
|
// the message sent by another process.
|
||||||
|
// TODO: consider events that are marked as "no-response" to avoid
|
||||||
|
// unneeded responses altogether.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._pendingMessages.delete(data.responseId);
|
this._pendingMessages.delete(data.responseId);
|
||||||
|
|
@ -209,17 +207,6 @@ class SimpleChannel {
|
||||||
else
|
else
|
||||||
message.resolve(data.result);
|
message.resolve(data.result);
|
||||||
} else if (data.requestId) {
|
} else if (data.requestId) {
|
||||||
// When the underlying transport gets replaced, some responses might
|
|
||||||
// not get delivered. As a result, sender will repeat the same request once
|
|
||||||
// a new transport gets set.
|
|
||||||
//
|
|
||||||
// If this request was already processed, we can fulfill it with the cached response
|
|
||||||
// and fast-return.
|
|
||||||
if (this._bufferedResponses.has(data.requestId)) {
|
|
||||||
this.transport.sendMessage(this._bufferedResponses.get(data.requestId));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const namespace = data.namespace;
|
const namespace = data.namespace;
|
||||||
const handler = this._handlers.get(namespace);
|
const handler = this._handlers.get(namespace);
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
|
|
@ -231,20 +218,12 @@ class SimpleChannel {
|
||||||
this.transport.sendMessage({responseId: data.requestId, error: `error in channel "${this._name}": No method "${data.methodName}" in namespace "${namespace}"`});
|
this.transport.sendMessage({responseId: data.requestId, error: `error in channel "${this._name}": No method "${data.methodName}" in namespace "${namespace}"`});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let response;
|
|
||||||
const connectedToUID = this._connectedToUID;
|
|
||||||
try {
|
try {
|
||||||
const result = await method.call(handler, ...data.params);
|
const result = await method.call(handler, ...data.params);
|
||||||
response = {responseId: data.requestId, result};
|
this.transport.sendMessage({responseId: data.requestId, result});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
response = {responseId: data.requestId, error: `error in channel "${this._name}": exception while running method "${data.methodName}" in namespace "${namespace}": ${error.message} ${error.stack}`};
|
this.transport.sendMessage({responseId: data.requestId, error: `error in channel "${this._name}": exception while running method "${data.methodName}" in namespace "${namespace}": ${error.message} ${error.stack}`});
|
||||||
}
|
return;
|
||||||
// The connection might have changed during the ASYNCHRONOUS handler execution.
|
|
||||||
// We only need to buffer & send response if we are connected to the same
|
|
||||||
// end.
|
|
||||||
if (connectedToUID === this._connectedToUID) {
|
|
||||||
this._bufferedResponses.set(data.requestId, response);
|
|
||||||
this.transport.sendMessage(response);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dump(`WARNING: unknown message in channel "${this._name}": ${JSON.stringify(data)}\n`);
|
dump(`WARNING: unknown message in channel "${this._name}": ${JSON.stringify(data)}\n`);
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@
|
||||||
|
|
||||||
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js');
|
const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js');
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
|
const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
|
||||||
const {ContextualIdentityService} = ChromeUtils.import("resource://gre/modules/ContextualIdentityService.jsm");
|
const {ContextualIdentityService} = ChromeUtils.import("resource://gre/modules/ContextualIdentityService.jsm");
|
||||||
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
||||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||||
|
|
||||||
const Cr = Components.results;
|
const Cr = Components.results;
|
||||||
|
|
||||||
|
|
@ -21,8 +23,6 @@ const ALL_PERMISSIONS = [
|
||||||
'desktop-notification',
|
'desktop-notification',
|
||||||
];
|
];
|
||||||
|
|
||||||
let globalTabAndWindowActivationChain = Promise.resolve();
|
|
||||||
|
|
||||||
class DownloadInterceptor {
|
class DownloadInterceptor {
|
||||||
constructor(registry) {
|
constructor(registry) {
|
||||||
this._registry = registry
|
this._registry = registry
|
||||||
|
|
@ -116,7 +116,6 @@ class TargetRegistry {
|
||||||
this._browserToTarget = new Map();
|
this._browserToTarget = new Map();
|
||||||
this._browserIdToTarget = new Map();
|
this._browserIdToTarget = new Map();
|
||||||
|
|
||||||
this._proxiesWithClashingAuthCacheKeys = new Set();
|
|
||||||
this._browserProxy = null;
|
this._browserProxy = null;
|
||||||
|
|
||||||
// Cleanup containers from previous runs (if any)
|
// Cleanup containers from previous runs (if any)
|
||||||
|
|
@ -186,7 +185,7 @@ class TargetRegistry {
|
||||||
domWindow = appWindow;
|
domWindow = appWindow;
|
||||||
appWindow = null;
|
appWindow = null;
|
||||||
}
|
}
|
||||||
if (!domWindow.isChromeWindow)
|
if (!(domWindow instanceof Ci.nsIDOMChromeWindow))
|
||||||
return;
|
return;
|
||||||
// In persistent mode, window might be opened long ago and might be
|
// In persistent mode, window might be opened long ago and might be
|
||||||
// already initialized.
|
// already initialized.
|
||||||
|
|
@ -214,7 +213,7 @@ class TargetRegistry {
|
||||||
|
|
||||||
const onCloseWindow = window => {
|
const onCloseWindow = window => {
|
||||||
const domWindow = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
|
const domWindow = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
|
||||||
if (!domWindow.isChromeWindow)
|
if (!(domWindow instanceof Ci.nsIDOMChromeWindow))
|
||||||
return;
|
return;
|
||||||
if (!domWindow.gBrowser)
|
if (!domWindow.gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
@ -235,50 +234,12 @@ class TargetRegistry {
|
||||||
onOpenWindow(win);
|
onOpenWindow(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Firefox uses nsHttpAuthCache to cache authentication to the proxy.
|
|
||||||
// If we're provided with a single proxy with a multiple different authentications, then
|
|
||||||
// we should clear the nsHttpAuthCache on every request.
|
|
||||||
shouldBustHTTPAuthCacheForProxy(proxy) {
|
|
||||||
return this._proxiesWithClashingAuthCacheKeys.has(proxy);
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateProxiesWithSameAuthCacheAndDifferentCredentials() {
|
|
||||||
const proxyIdToCredentials = new Map();
|
|
||||||
const allProxies = [...this._browserContextIdToBrowserContext.values()].map(bc => bc._proxy).filter(Boolean);
|
|
||||||
if (this._browserProxy)
|
|
||||||
allProxies.push(this._browserProxy);
|
|
||||||
const proxyAuthCacheKeyAndProxy = allProxies.map(proxy => [
|
|
||||||
JSON.stringify({
|
|
||||||
type: proxy.type,
|
|
||||||
host: proxy.host,
|
|
||||||
port: proxy.port,
|
|
||||||
}),
|
|
||||||
proxy,
|
|
||||||
]);
|
|
||||||
this._proxiesWithClashingAuthCacheKeys.clear();
|
|
||||||
|
|
||||||
proxyAuthCacheKeyAndProxy.sort(([cacheKey1], [cacheKey2]) => cacheKey1 < cacheKey2 ? -1 : 1);
|
|
||||||
for (let i = 0; i < proxyAuthCacheKeyAndProxy.length - 1; ++i) {
|
|
||||||
const [cacheKey1, proxy1] = proxyAuthCacheKeyAndProxy[i];
|
|
||||||
const [cacheKey2, proxy2] = proxyAuthCacheKeyAndProxy[i + 1];
|
|
||||||
if (cacheKey1 !== cacheKey2)
|
|
||||||
continue;
|
|
||||||
if (proxy1.username === proxy2.username && proxy1.password === proxy2.password)
|
|
||||||
continue;
|
|
||||||
// `proxy1` and `proxy2` have the same caching key, but serve different credentials.
|
|
||||||
// We have to bust HTTP Auth Cache everytime there's a request that will use either of the proxies.
|
|
||||||
this._proxiesWithClashingAuthCacheKeys.add(proxy1);
|
|
||||||
this._proxiesWithClashingAuthCacheKeys.add(proxy2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async cancelDownload(options) {
|
async cancelDownload(options) {
|
||||||
this._downloadInterceptor.cancelDownload(options.uuid);
|
this._downloadInterceptor.cancelDownload(options.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBrowserProxy(proxy) {
|
setBrowserProxy(proxy) {
|
||||||
this._browserProxy = proxy;
|
this._browserProxy = proxy;
|
||||||
this._updateProxiesWithSameAuthCacheAndDifferentCredentials();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getProxyInfo(channel) {
|
getProxyInfo(channel) {
|
||||||
|
|
@ -389,12 +350,11 @@ class PageTarget {
|
||||||
this._openerId = opener ? opener.id() : undefined;
|
this._openerId = opener ? opener.id() : undefined;
|
||||||
this._actor = undefined;
|
this._actor = undefined;
|
||||||
this._actorSequenceNumber = 0;
|
this._actorSequenceNumber = 0;
|
||||||
this._channel = new SimpleChannel(`browser::page[${this._targetId}]`, 'target-' + this._targetId);
|
this._channel = new SimpleChannel(`browser::page[${this._targetId}]`);
|
||||||
this._videoRecordingInfo = undefined;
|
this._videoRecordingInfo = undefined;
|
||||||
this._screencastRecordingInfo = undefined;
|
this._screencastRecordingInfo = undefined;
|
||||||
this._dialogs = new Map();
|
this._dialogs = new Map();
|
||||||
this.forcedColors = 'none';
|
this.forcedColors = 'no-override';
|
||||||
this.disableCache = false;
|
|
||||||
this.mediumOverride = '';
|
this.mediumOverride = '';
|
||||||
this.crossProcessCookie = {
|
this.crossProcessCookie = {
|
||||||
initScripts: [],
|
initScripts: [],
|
||||||
|
|
@ -407,7 +367,7 @@ class PageTarget {
|
||||||
onLocationChange: (aWebProgress, aRequest, aLocation) => this._onNavigated(aLocation),
|
onLocationChange: (aWebProgress, aRequest, aLocation) => this._onNavigated(aLocation),
|
||||||
};
|
};
|
||||||
this._eventListeners = [
|
this._eventListeners = [
|
||||||
helper.addObserver(this._updateModalDialogs.bind(this), 'common-dialog-loaded'),
|
helper.addObserver(this._updateModalDialogs.bind(this), 'tabmodal-dialog-loaded'),
|
||||||
helper.addProgressListener(tab.linkedBrowser, navigationListener, Ci.nsIWebProgress.NOTIFY_LOCATION),
|
helper.addProgressListener(tab.linkedBrowser, navigationListener, Ci.nsIWebProgress.NOTIFY_LOCATION),
|
||||||
helper.addEventListener(this._linkedBrowser, 'DOMModalDialogClosed', event => this._updateModalDialogs()),
|
helper.addEventListener(this._linkedBrowser, 'DOMModalDialogClosed', event => this._updateModalDialogs()),
|
||||||
helper.addEventListener(this._linkedBrowser, 'WillChangeBrowserRemoteness', event => this._willChangeBrowserRemoteness()),
|
helper.addEventListener(this._linkedBrowser, 'WillChangeBrowserRemoteness', event => this._willChangeBrowserRemoteness()),
|
||||||
|
|
@ -421,27 +381,21 @@ class PageTarget {
|
||||||
this._registry.emit(TargetRegistry.Events.TargetCreated, this);
|
this._registry.emit(TargetRegistry.Events.TargetCreated, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
async activateAndRun(callback = () => {}, { muteNotificationsPopup = false } = {}) {
|
async activateAndRun(callback = () => {}) {
|
||||||
const ownerWindow = this._tab.linkedBrowser.ownerGlobal;
|
const ownerWindow = this._tab.linkedBrowser.ownerGlobal;
|
||||||
const tabBrowser = ownerWindow.gBrowser;
|
const tabBrowser = ownerWindow.gBrowser;
|
||||||
// Serialize all tab-switching commands per tabbed browser
|
// Serialize all tab-switching commands per tabbed browser
|
||||||
// to disallow concurrent tab switching.
|
// to disallow concurrent tab switching.
|
||||||
const result = globalTabAndWindowActivationChain.then(async () => {
|
const result = (tabBrowser.__serializedChain ?? Promise.resolve()).then(async () => {
|
||||||
this._window.focus();
|
this._window.focus();
|
||||||
if (tabBrowser.selectedTab !== this._tab) {
|
if (tabBrowser.selectedTab !== this._tab) {
|
||||||
const promise = helper.awaitEvent(ownerWindow, 'TabSwitchDone');
|
const promise = helper.awaitEvent(ownerWindow, 'TabSwitchDone');
|
||||||
tabBrowser.selectedTab = this._tab;
|
tabBrowser.selectedTab = this._tab;
|
||||||
await promise;
|
await promise;
|
||||||
}
|
}
|
||||||
const notificationsPopup = muteNotificationsPopup ? this._linkedBrowser?.ownerDocument.getElementById('notification-popup') : null;
|
await callback();
|
||||||
notificationsPopup?.style.setProperty('pointer-events', 'none');
|
|
||||||
try {
|
|
||||||
await callback();
|
|
||||||
} finally {
|
|
||||||
notificationsPopup?.style.removeProperty('pointer-events');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
globalTabAndWindowActivationChain = result.catch(error => { /* swallow errors to keep chain running */ });
|
tabBrowser.__serializedChain = result.catch(error => { /* swallow errors to keep chain running */ });
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -500,25 +454,6 @@ class PageTarget {
|
||||||
this.updateColorSchemeOverride(browsingContext);
|
this.updateColorSchemeOverride(browsingContext);
|
||||||
this.updateReducedMotionOverride(browsingContext);
|
this.updateReducedMotionOverride(browsingContext);
|
||||||
this.updateForcedColorsOverride(browsingContext);
|
this.updateForcedColorsOverride(browsingContext);
|
||||||
this.updateForceOffline(browsingContext);
|
|
||||||
this.updateCacheDisabled(browsingContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateForceOffline(browsingContext = undefined) {
|
|
||||||
(browsingContext || this._linkedBrowser.browsingContext).forceOffline = this._browserContext.forceOffline;
|
|
||||||
}
|
|
||||||
|
|
||||||
setCacheDisabled(disabled) {
|
|
||||||
this.disableCache = disabled;
|
|
||||||
this.updateCacheDisabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCacheDisabled(browsingContext = this._linkedBrowser.browsingContext) {
|
|
||||||
const enableFlags = Ci.nsIRequest.LOAD_NORMAL;
|
|
||||||
const disableFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE |
|
|
||||||
Ci.nsIRequest.INHIBIT_CACHING;
|
|
||||||
|
|
||||||
browsingContext.defaultLoadFlags = (this._browserContext.disableCache || this.disableCache) ? disableFlags : enableFlags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTouchOverride(browsingContext = undefined) {
|
updateTouchOverride(browsingContext = undefined) {
|
||||||
|
|
@ -538,7 +473,7 @@ class PageTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateModalDialogs() {
|
_updateModalDialogs() {
|
||||||
const prompts = new Set(this._linkedBrowser.tabDialogBox.getContentDialogManager().dialogs.map(dialog => dialog.frameContentWindow.Dialog));
|
const prompts = new Set(this._linkedBrowser.tabModalPromptBox ? this._linkedBrowser.tabModalPromptBox.listPrompts() : []);
|
||||||
for (const dialog of this._dialogs.values()) {
|
for (const dialog of this._dialogs.values()) {
|
||||||
if (!prompts.has(dialog.prompt())) {
|
if (!prompts.has(dialog.prompt())) {
|
||||||
this._dialogs.delete(dialog.id());
|
this._dialogs.delete(dialog.id());
|
||||||
|
|
@ -635,8 +570,7 @@ class PageTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateForcedColorsOverride(browsingContext = undefined) {
|
updateForcedColorsOverride(browsingContext = undefined) {
|
||||||
const isActive = this.forcedColors === 'active' || this._browserContext.forcedColors === 'active';
|
(browsingContext || this._linkedBrowser.browsingContext).forcedColorsOverride = (this.forcedColors !== 'no-override' ? this.forcedColors : this._browserContext.forcedColors) || 'no-override';
|
||||||
(browsingContext || this._linkedBrowser.browsingContext).forcedColorsOverride = isActive ? 'active' : 'none';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setInterceptFileChooserDialog(enabled) {
|
async setInterceptFileChooserDialog(enabled) {
|
||||||
|
|
@ -716,7 +650,7 @@ class PageTarget {
|
||||||
// NSWindow.windowNumber may be -1, so we wait until the window is known
|
// NSWindow.windowNumber may be -1, so we wait until the window is known
|
||||||
// to be initialized and visible.
|
// to be initialized and visible.
|
||||||
await this.windowReady();
|
await this.windowReady();
|
||||||
const file = PathUtils.join(dir, helper.generateId() + '.webm');
|
const file = OS.Path.join(dir, helper.generateId() + '.webm');
|
||||||
if (width < 10 || width > 10000 || height < 10 || height > 10000)
|
if (width < 10 || width > 10000 || height < 10 || height > 10000)
|
||||||
throw new Error("Invalid size");
|
throw new Error("Invalid size");
|
||||||
|
|
||||||
|
|
@ -799,15 +733,12 @@ class PageTarget {
|
||||||
// Close context menu, if any, since it might capture mouse events on Linux
|
// Close context menu, if any, since it might capture mouse events on Linux
|
||||||
// and prevent browser shutdown on MacOS.
|
// and prevent browser shutdown on MacOS.
|
||||||
const doc = this._linkedBrowser.ownerDocument;
|
const doc = this._linkedBrowser.ownerDocument;
|
||||||
const contextMenu = doc.getElementById('contentAreaContextMenu');
|
const contextMenu = doc.getElementById("contentAreaContextMenu");
|
||||||
if (contextMenu)
|
if (contextMenu)
|
||||||
contextMenu.hidePopup();
|
contextMenu.hidePopup();
|
||||||
const autocompletePopup = doc.getElementById('PopupAutoComplete');
|
const autocompletePopup = doc.getElementById("PopupAutoComplete");
|
||||||
if (autocompletePopup)
|
if (autocompletePopup)
|
||||||
autocompletePopup.hidePopup();
|
autocompletePopup.hidePopup();
|
||||||
const selectPopup = doc.getElementById('ContentSelectDropdown')?.menupopup;
|
|
||||||
if (selectPopup)
|
|
||||||
selectPopup.hidePopup()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
@ -859,8 +790,8 @@ function fromProtocolReducedMotion(reducedMotion) {
|
||||||
function fromProtocolForcedColors(forcedColors) {
|
function fromProtocolForcedColors(forcedColors) {
|
||||||
if (forcedColors === 'active' || forcedColors === 'none')
|
if (forcedColors === 'active' || forcedColors === 'none')
|
||||||
return forcedColors;
|
return forcedColors;
|
||||||
if (!forcedColors)
|
if (forcedColors === null)
|
||||||
return 'none';
|
return undefined;
|
||||||
throw new Error('Unknown forced colors: ' + forcedColors);
|
throw new Error('Unknown forced colors: ' + forcedColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -891,10 +822,8 @@ class BrowserContext {
|
||||||
this.defaultUserAgent = null;
|
this.defaultUserAgent = null;
|
||||||
this.defaultPlatform = null;
|
this.defaultPlatform = null;
|
||||||
this.touchOverride = false;
|
this.touchOverride = false;
|
||||||
this.forceOffline = false;
|
|
||||||
this.disableCache = false;
|
|
||||||
this.colorScheme = 'none';
|
this.colorScheme = 'none';
|
||||||
this.forcedColors = 'none';
|
this.forcedColors = 'no-override';
|
||||||
this.reducedMotion = 'none';
|
this.reducedMotion = 'none';
|
||||||
this.videoRecordingOptions = undefined;
|
this.videoRecordingOptions = undefined;
|
||||||
this.crossProcessCookie = {
|
this.crossProcessCookie = {
|
||||||
|
|
@ -946,14 +875,12 @@ class BrowserContext {
|
||||||
}
|
}
|
||||||
this._registry._browserContextIdToBrowserContext.delete(this.browserContextId);
|
this._registry._browserContextIdToBrowserContext.delete(this.browserContextId);
|
||||||
this._registry._userContextIdToBrowserContext.delete(this.userContextId);
|
this._registry._userContextIdToBrowserContext.delete(this.userContextId);
|
||||||
this._registry._updateProxiesWithSameAuthCacheAndDifferentCredentials();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setProxy(proxy) {
|
setProxy(proxy) {
|
||||||
// Clear AuthCache.
|
// Clear AuthCache.
|
||||||
Services.obs.notifyObservers(null, "net:clear-active-logins");
|
Services.obs.notifyObservers(null, "net:clear-active-logins");
|
||||||
this._proxy = proxy;
|
this._proxy = proxy;
|
||||||
this._registry._updateProxiesWithSameAuthCacheAndDifferentCredentials();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setIgnoreHTTPSErrors(ignoreHTTPSErrors) {
|
setIgnoreHTTPSErrors(ignoreHTTPSErrors) {
|
||||||
|
|
@ -990,18 +917,6 @@ class BrowserContext {
|
||||||
page.updateTouchOverride();
|
page.updateTouchOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
setForceOffline(forceOffline) {
|
|
||||||
this.forceOffline = forceOffline;
|
|
||||||
for (const page of this.pages)
|
|
||||||
page.updateForceOffline();
|
|
||||||
}
|
|
||||||
|
|
||||||
setCacheDisabled(disabled) {
|
|
||||||
this.disableCache = disabled;
|
|
||||||
for (const page of this.pages)
|
|
||||||
page.updateCacheDisabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
async setDefaultViewport(viewport) {
|
async setDefaultViewport(viewport) {
|
||||||
this.defaultViewportSize = viewport ? viewport.viewportSize : undefined;
|
this.defaultViewportSize = viewport ? viewport.viewportSize : undefined;
|
||||||
this.deviceScaleFactor = viewport ? viewport.deviceScaleFactor : undefined;
|
this.deviceScaleFactor = viewport ? viewport.deviceScaleFactor : undefined;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ var EXPORTED_SYMBOLS = ["Juggler", "JugglerFactory"];
|
||||||
|
|
||||||
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
const {ComponentUtils} = ChromeUtils.import("resource://gre/modules/ComponentUtils.jsm");
|
const {ComponentUtils} = ChromeUtils.import("resource://gre/modules/ComponentUtils.jsm");
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {Dispatcher} = ChromeUtils.import("chrome://juggler/content/protocol/Dispatcher.js");
|
const {Dispatcher} = ChromeUtils.import("chrome://juggler/content/protocol/Dispatcher.js");
|
||||||
const {BrowserHandler} = ChromeUtils.import("chrome://juggler/content/protocol/BrowserHandler.js");
|
const {BrowserHandler} = ChromeUtils.import("chrome://juggler/content/protocol/BrowserHandler.js");
|
||||||
const {NetworkObserver} = ChromeUtils.import("chrome://juggler/content/NetworkObserver.js");
|
const {NetworkObserver} = ChromeUtils.import("chrome://juggler/content/NetworkObserver.js");
|
||||||
|
|
@ -105,10 +106,7 @@ class Juggler {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Force create hidden window here, otherwise its creation later closes the web socket!
|
// Force create hidden window here, otherwise its creation later closes the web socket!
|
||||||
// Since https://phabricator.services.mozilla.com/D219834, hiddenDOMWindow is only available on MacOS.
|
Services.appShell.hiddenDOMWindow;
|
||||||
if (Services.appShell.hasHiddenWindow) {
|
|
||||||
Services.appShell.hiddenDOMWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
let pipeStopped = false;
|
let pipeStopped = false;
|
||||||
let browserHandler;
|
let browserHandler;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ class FrameTree {
|
||||||
Ci.nsISupportsWeakReference,
|
Ci.nsISupportsWeakReference,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
this._addedScrollbarsStylesheetSymbol = Symbol('_addedScrollbarsStylesheetSymbol');
|
||||||
|
|
||||||
this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
|
this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
|
||||||
this._wdmListener = {
|
this._wdmListener = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
|
QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
|
||||||
|
|
@ -128,12 +130,24 @@ class FrameTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDOMWindowCreated(window) {
|
_onDOMWindowCreated(window) {
|
||||||
|
if (!window[this._addedScrollbarsStylesheetSymbol] && this.scrollbarsHidden) {
|
||||||
|
const styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
|
||||||
|
const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||||
|
const uri = ioService.newURI('chrome://juggler/content/content/hidden-scrollbars.css', null, null);
|
||||||
|
const sheet = styleSheetService.preloadSheet(uri, styleSheetService.AGENT_SHEET);
|
||||||
|
window.windowUtils.addSheet(sheet, styleSheetService.AGENT_SHEET);
|
||||||
|
window[this._addedScrollbarsStylesheetSymbol] = true;
|
||||||
|
}
|
||||||
const frame = this.frameForDocShell(window.docShell);
|
const frame = this.frameForDocShell(window.docShell);
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return;
|
return;
|
||||||
frame._onGlobalObjectCleared();
|
frame._onGlobalObjectCleared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setScrollbarsHidden(hidden) {
|
||||||
|
this.scrollbarsHidden = hidden;
|
||||||
|
}
|
||||||
|
|
||||||
setJavaScriptDisabled(javaScriptDisabled) {
|
setJavaScriptDisabled(javaScriptDisabled) {
|
||||||
this._javaScriptDisabled = javaScriptDisabled;
|
this._javaScriptDisabled = javaScriptDisabled;
|
||||||
for (const frame of this.frames())
|
for (const frame of this.frames())
|
||||||
|
|
@ -643,7 +657,7 @@ class Worker {
|
||||||
|
|
||||||
workerDebugger.initialize('chrome://juggler/content/content/WorkerMain.js');
|
workerDebugger.initialize('chrome://juggler/content/content/WorkerMain.js');
|
||||||
|
|
||||||
this._channel = new SimpleChannel(`content::worker[${this._workerId}]`, 'worker-' + this._workerId);
|
this._channel = new SimpleChannel(`content::worker[${this._workerId}]`);
|
||||||
this._channel.setTransport({
|
this._channel.setTransport({
|
||||||
sendMessage: obj => workerDebugger.postMessage(JSON.stringify(obj)),
|
sendMessage: obj => workerDebugger.postMessage(JSON.stringify(obj)),
|
||||||
dispose: () => {},
|
dispose: () => {},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { Helper } = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const { Helper } = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
|
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const { initialize } = ChromeUtils.import('chrome://juggler/content/content/main.js');
|
const { initialize } = ChromeUtils.import('chrome://juggler/content/content/main.js');
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
|
|
@ -8,8 +9,6 @@ const helper = new Helper();
|
||||||
|
|
||||||
let sameProcessInstanceNumber = 0;
|
let sameProcessInstanceNumber = 0;
|
||||||
|
|
||||||
const topBrowingContextToAgents = new Map();
|
|
||||||
|
|
||||||
class JugglerFrameChild extends JSWindowActorChild {
|
class JugglerFrameChild extends JSWindowActorChild {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -18,66 +17,46 @@ class JugglerFrameChild extends JSWindowActorChild {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEvent(aEvent) {
|
handleEvent(aEvent) {
|
||||||
const agents = this._agents();
|
if (this._agents && aEvent.type === 'DOMWillOpenModalDialog') {
|
||||||
if (!agents)
|
this._agents.channel.pause();
|
||||||
return;
|
|
||||||
if (aEvent.type === 'DOMWillOpenModalDialog') {
|
|
||||||
agents.channel.pause();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aEvent.type === 'DOMModalDialogClosed') {
|
if (this._agents && aEvent.type === 'DOMModalDialogClosed') {
|
||||||
agents.channel.resumeSoon();
|
this._agents.channel.resumeSoon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aEvent.target === this.document) {
|
if (this._agents && aEvent.target === this.document)
|
||||||
agents.pageAgent.onWindowEvent(aEvent);
|
this._agents.pageAgent.onWindowEvent(aEvent);
|
||||||
agents.frameTree.onWindowEvent(aEvent);
|
if (this._agents && aEvent.target === this.document)
|
||||||
}
|
this._agents.frameTree.onWindowEvent(aEvent);
|
||||||
}
|
|
||||||
|
|
||||||
_agents() {
|
|
||||||
return topBrowingContextToAgents.get(this.browsingContext.top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCreated() {
|
actorCreated() {
|
||||||
this.actorName = `content::${this.browsingContext.browserId}/${this.browsingContext.id}/${++sameProcessInstanceNumber}`;
|
this.actorName = `content::${this.browsingContext.browserId}/${this.browsingContext.id}/${++sameProcessInstanceNumber}`;
|
||||||
|
|
||||||
this._eventListeners.push(helper.addEventListener(this.contentWindow, 'load', event => {
|
this._eventListeners.push(helper.addEventListener(this.contentWindow, 'load', event => {
|
||||||
this._agents()?.pageAgent.onWindowEvent(event);
|
this._agents?.pageAgent.onWindowEvent(event);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (this.document.documentURI.startsWith('moz-extension://'))
|
if (this.document.documentURI.startsWith('moz-extension://'))
|
||||||
return;
|
return;
|
||||||
|
this._agents = initialize(this.browsingContext, this.docShell, this);
|
||||||
|
}
|
||||||
|
|
||||||
// Child frame events will be forwarded to related top-level agents.
|
_dispose() {
|
||||||
if (this.browsingContext.parent)
|
helper.removeListeners(this._eventListeners);
|
||||||
return;
|
// We do not cleanup since agents are shared for all frames in the process.
|
||||||
|
|
||||||
let agents = topBrowingContextToAgents.get(this.browsingContext);
|
// TODO: restore the cleanup.
|
||||||
if (!agents) {
|
// Reset transport so that all messages will be pending and will not throw any errors.
|
||||||
agents = initialize(this.browsingContext, this.docShell);
|
// this._channel.resetTransport();
|
||||||
topBrowingContextToAgents.set(this.browsingContext, agents);
|
// this._agents.pageAgent.dispose();
|
||||||
}
|
// this._agents.frameTree.dispose();
|
||||||
agents.channel.bindToActor(this);
|
// this._agents = undefined;
|
||||||
agents.actor = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
didDestroy() {
|
didDestroy() {
|
||||||
helper.removeListeners(this._eventListeners);
|
this._dispose();
|
||||||
|
|
||||||
if (this.browsingContext.parent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const agents = topBrowingContextToAgents.get(this.browsingContext);
|
|
||||||
// The agents are already re-bound to a new actor.
|
|
||||||
if (agents?.actor !== this)
|
|
||||||
return;
|
|
||||||
|
|
||||||
topBrowingContextToAgents.delete(this.browsingContext);
|
|
||||||
|
|
||||||
agents.channel.resetTransport();
|
|
||||||
agents.pageAgent.dispose();
|
|
||||||
agents.frameTree.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveMessage() { }
|
receiveMessage() { }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
const Cr = Components.results;
|
const Cr = Components.results;
|
||||||
|
|
@ -62,6 +63,7 @@ class PageAgent {
|
||||||
|
|
||||||
const docShell = frameTree.mainFrame().docShell();
|
const docShell = frameTree.mainFrame().docShell();
|
||||||
this._docShell = docShell;
|
this._docShell = docShell;
|
||||||
|
this._initialDPPX = docShell.contentViewer.overrideDPPX;
|
||||||
|
|
||||||
// Dispatch frameAttached events for all initial frames
|
// Dispatch frameAttached events for all initial frames
|
||||||
for (const frame of this._frameTree.frames()) {
|
for (const frame of this._frameTree.frames()) {
|
||||||
|
|
@ -120,8 +122,7 @@ class PageAgent {
|
||||||
// After the dragStart event is dispatched and handled by Web,
|
// After the dragStart event is dispatched and handled by Web,
|
||||||
// it might or might not create a new drag session, depending on its preventing default.
|
// it might or might not create a new drag session, depending on its preventing default.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const session = this._getCurrentDragSession();
|
this._browserPage.emit('pageInputEvent', { type: 'juggler-drag-finalized', dragSessionStarted: !!dragService.getCurrentSession() });
|
||||||
this._browserPage.emit('pageInputEvent', { type: 'juggler-drag-finalized', dragSessionStarted: !!session });
|
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -153,6 +154,7 @@ class PageAgent {
|
||||||
getFullAXTree: this._getFullAXTree.bind(this),
|
getFullAXTree: this._getFullAXTree.bind(this),
|
||||||
insertText: this._insertText.bind(this),
|
insertText: this._insertText.bind(this),
|
||||||
scrollIntoViewIfNeeded: this._scrollIntoViewIfNeeded.bind(this),
|
scrollIntoViewIfNeeded: this._scrollIntoViewIfNeeded.bind(this),
|
||||||
|
setCacheDisabled: this._setCacheDisabled.bind(this),
|
||||||
setFileInputFiles: this._setFileInputFiles.bind(this),
|
setFileInputFiles: this._setFileInputFiles.bind(this),
|
||||||
evaluate: this._runtime.evaluate.bind(this._runtime),
|
evaluate: this._runtime.evaluate.bind(this._runtime),
|
||||||
callFunction: this._runtime.callFunction.bind(this._runtime),
|
callFunction: this._runtime.callFunction.bind(this._runtime),
|
||||||
|
|
@ -162,6 +164,15 @@ class PageAgent {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setCacheDisabled({cacheDisabled}) {
|
||||||
|
const enable = Ci.nsIRequest.LOAD_NORMAL;
|
||||||
|
const disable = Ci.nsIRequest.LOAD_BYPASS_CACHE |
|
||||||
|
Ci.nsIRequest.INHIBIT_CACHING;
|
||||||
|
|
||||||
|
const docShell = this._frameTree.mainFrame().docShell();
|
||||||
|
docShell.defaultLoadFlags = cacheDisabled ? disable : enable;
|
||||||
|
}
|
||||||
|
|
||||||
_emitAllEvents(frame) {
|
_emitAllEvents(frame) {
|
||||||
this._browserPage.emit('pageEventFired', {
|
this._browserPage.emit('pageEventFired', {
|
||||||
frameId: frame.id(),
|
frameId: frame.id(),
|
||||||
|
|
@ -371,19 +382,8 @@ class PageAgent {
|
||||||
const unsafeObject = frame.unsafeObject(objectId);
|
const unsafeObject = frame.unsafeObject(objectId);
|
||||||
if (!unsafeObject)
|
if (!unsafeObject)
|
||||||
throw new Error('Object is not input!');
|
throw new Error('Object is not input!');
|
||||||
let nsFiles;
|
const nsFiles = await Promise.all(files.map(filePath => File.createFromFileName(filePath)));
|
||||||
if (unsafeObject.webkitdirectory) {
|
|
||||||
nsFiles = await new Directory(files[0]).getFiles(true);
|
|
||||||
} else {
|
|
||||||
nsFiles = await Promise.all(files.map(filePath => File.createFromFileName(filePath)));
|
|
||||||
}
|
|
||||||
unsafeObject.mozSetFileArray(nsFiles);
|
unsafeObject.mozSetFileArray(nsFiles);
|
||||||
const events = [
|
|
||||||
new (frame.domWindow().Event)('input', { bubbles: true, cancelable: true, composed: true }),
|
|
||||||
new (frame.domWindow().Event)('change', { bubbles: true, cancelable: true, composed: true }),
|
|
||||||
];
|
|
||||||
for (const event of events)
|
|
||||||
unsafeObject.dispatchEvent(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getContentQuads({objectId, frameId}) {
|
_getContentQuads({objectId, frameId}) {
|
||||||
|
|
@ -464,6 +464,10 @@ class PageAgent {
|
||||||
async _dispatchKeyEvent({type, keyCode, code, key, repeat, location, text}) {
|
async _dispatchKeyEvent({type, keyCode, code, key, repeat, location, text}) {
|
||||||
const frame = this._frameTree.mainFrame();
|
const frame = this._frameTree.mainFrame();
|
||||||
const tip = frame.textInputProcessor();
|
const tip = frame.textInputProcessor();
|
||||||
|
if (key === 'Meta' && Services.appinfo.OS !== 'Darwin')
|
||||||
|
key = 'OS';
|
||||||
|
else if (key === 'OS' && Services.appinfo.OS === 'Darwin')
|
||||||
|
key = 'Meta';
|
||||||
let keyEvent = new (frame.domWindow().KeyboardEvent)("", {
|
let keyEvent = new (frame.domWindow().KeyboardEvent)("", {
|
||||||
key,
|
key,
|
||||||
code,
|
code,
|
||||||
|
|
@ -515,26 +519,75 @@ class PageAgent {
|
||||||
false /* aIgnoreRootScrollFrame */,
|
false /* aIgnoreRootScrollFrame */,
|
||||||
true /* aFlushLayout */);
|
true /* aFlushLayout */);
|
||||||
|
|
||||||
await this._dispatchTouchEvent({
|
const {defaultPrevented: startPrevented} = await this._dispatchTouchEvent({
|
||||||
type: 'touchstart',
|
type: 'touchstart',
|
||||||
modifiers,
|
modifiers,
|
||||||
touchPoints: [{x, y}]
|
touchPoints: [{x, y}]
|
||||||
});
|
});
|
||||||
await this._dispatchTouchEvent({
|
const {defaultPrevented: endPrevented} = await this._dispatchTouchEvent({
|
||||||
type: 'touchend',
|
type: 'touchend',
|
||||||
modifiers,
|
modifiers,
|
||||||
touchPoints: [{x, y}]
|
touchPoints: [{x, y}]
|
||||||
});
|
});
|
||||||
}
|
if (startPrevented || endPrevented)
|
||||||
|
return;
|
||||||
|
|
||||||
_getCurrentDragSession() {
|
|
||||||
const frame = this._frameTree.mainFrame();
|
const frame = this._frameTree.mainFrame();
|
||||||
const domWindow = frame?.domWindow();
|
const winUtils = frame.domWindow().windowUtils;
|
||||||
return domWindow ? dragService.getCurrentSession(domWindow) : undefined;
|
winUtils.jugglerSendMouseEvent(
|
||||||
|
'mousemove',
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
0 /*button*/,
|
||||||
|
0 /*clickCount*/,
|
||||||
|
modifiers,
|
||||||
|
false /*aIgnoreRootScrollFrame*/,
|
||||||
|
0.0 /*pressure*/,
|
||||||
|
5 /*inputSource*/,
|
||||||
|
true /*isDOMEventSynthesized*/,
|
||||||
|
false /*isWidgetEventSynthesized*/,
|
||||||
|
0 /*buttons*/,
|
||||||
|
winUtils.DEFAULT_MOUSE_POINTER_ID /* pointerIdentifier */,
|
||||||
|
true /*disablePointerEvent*/
|
||||||
|
);
|
||||||
|
|
||||||
|
winUtils.jugglerSendMouseEvent(
|
||||||
|
'mousedown',
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
0 /*button*/,
|
||||||
|
1 /*clickCount*/,
|
||||||
|
modifiers,
|
||||||
|
false /*aIgnoreRootScrollFrame*/,
|
||||||
|
0.0 /*pressure*/,
|
||||||
|
5 /*inputSource*/,
|
||||||
|
true /*isDOMEventSynthesized*/,
|
||||||
|
false /*isWidgetEventSynthesized*/,
|
||||||
|
1 /*buttons*/,
|
||||||
|
winUtils.DEFAULT_MOUSE_POINTER_ID /*pointerIdentifier*/,
|
||||||
|
true /*disablePointerEvent*/,
|
||||||
|
);
|
||||||
|
|
||||||
|
winUtils.jugglerSendMouseEvent(
|
||||||
|
'mouseup',
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
0 /*button*/,
|
||||||
|
1 /*clickCount*/,
|
||||||
|
modifiers,
|
||||||
|
false /*aIgnoreRootScrollFrame*/,
|
||||||
|
0.0 /*pressure*/,
|
||||||
|
5 /*inputSource*/,
|
||||||
|
true /*isDOMEventSynthesized*/,
|
||||||
|
false /*isWidgetEventSynthesized*/,
|
||||||
|
0 /*buttons*/,
|
||||||
|
winUtils.DEFAULT_MOUSE_POINTER_ID /*pointerIdentifier*/,
|
||||||
|
true /*disablePointerEvent*/,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _dispatchDragEvent({type, x, y, modifiers}) {
|
async _dispatchDragEvent({type, x, y, modifiers}) {
|
||||||
const session = this._getCurrentDragSession();
|
const session = dragService.getCurrentSession();
|
||||||
const dropEffect = session.dataTransfer.dropEffect;
|
const dropEffect = session.dataTransfer.dropEffect;
|
||||||
|
|
||||||
if ((type === 'drop' && dropEffect !== 'none') || type === 'dragover') {
|
if ((type === 'drop' && dropEffect !== 'none') || type === 'dragover') {
|
||||||
|
|
@ -558,8 +611,9 @@ class PageAgent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === 'dragend') {
|
if (type === 'dragend') {
|
||||||
const session = this._getCurrentDragSession();
|
const session = dragService.getCurrentSession();
|
||||||
session?.endDragSession(true);
|
if (session)
|
||||||
|
dragService.endDragSession(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ class Runtime {
|
||||||
if (isWorker) {
|
if (isWorker) {
|
||||||
this._registerWorkerConsoleHandler();
|
this._registerWorkerConsoleHandler();
|
||||||
} else {
|
} else {
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
this._registerConsoleServiceListener(Services);
|
this._registerConsoleServiceListener(Services);
|
||||||
this._registerConsoleAPIListener(Services);
|
this._registerConsoleAPIListener(Services);
|
||||||
}
|
}
|
||||||
|
|
@ -239,8 +240,8 @@ class Runtime {
|
||||||
return {success: true, obj: obj.promiseValue};
|
return {success: true, obj: obj.promiseValue};
|
||||||
if (obj.promiseState === 'rejected') {
|
if (obj.promiseState === 'rejected') {
|
||||||
const debuggee = executionContext._debuggee;
|
const debuggee = executionContext._debuggee;
|
||||||
exceptionDetails.text = debuggee.executeInGlobalWithBindings('e.message', {e: obj.promiseReason}, {useInnerBindings: true}).return;
|
exceptionDetails.text = debuggee.executeInGlobalWithBindings('e.message', {e: obj.promiseReason}).return;
|
||||||
exceptionDetails.stack = debuggee.executeInGlobalWithBindings('e.stack', {e: obj.promiseReason}, {useInnerBindings: true}).return;
|
exceptionDetails.stack = debuggee.executeInGlobalWithBindings('e.stack', {e: obj.promiseReason}).return;
|
||||||
return {success: false, obj: null};
|
return {success: false, obj: null};
|
||||||
}
|
}
|
||||||
let resolve, reject;
|
let resolve, reject;
|
||||||
|
|
@ -267,8 +268,8 @@ class Runtime {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
const debuggee = pendingPromise.executionContext._debuggee;
|
const debuggee = pendingPromise.executionContext._debuggee;
|
||||||
pendingPromise.exceptionDetails.text = debuggee.executeInGlobalWithBindings('e.message', {e: obj.promiseReason}, {useInnerBindings: true}).return;
|
pendingPromise.exceptionDetails.text = debuggee.executeInGlobalWithBindings('e.message', {e: obj.promiseReason}).return;
|
||||||
pendingPromise.exceptionDetails.stack = debuggee.executeInGlobalWithBindings('e.stack', {e: obj.promiseReason}, {useInnerBindings: true}).return;
|
pendingPromise.exceptionDetails.stack = debuggee.executeInGlobalWithBindings('e.stack', {e: obj.promiseReason}).return;
|
||||||
pendingPromise.resolve({success: false, obj: null});
|
pendingPromise.resolve({success: false, obj: null});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -441,7 +442,7 @@ class ExecutionContext {
|
||||||
_instanceOf(debuggerObj, rawObj, className) {
|
_instanceOf(debuggerObj, rawObj, className) {
|
||||||
if (this._domWindow)
|
if (this._domWindow)
|
||||||
return rawObj instanceof this._domWindow[className];
|
return rawObj instanceof this._domWindow[className];
|
||||||
return this._debuggee.executeInGlobalWithBindings('o instanceof this[className]', {o: debuggerObj, className: this._debuggee.makeDebuggeeValue(className)}, {useInnerBindings: true}).return;
|
return this._debuggee.executeInGlobalWithBindings('o instanceof this[className]', {o: debuggerObj, className: this._debuggee.makeDebuggeeValue(className)}).return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_createRemoteObject(debuggerObj) {
|
_createRemoteObject(debuggerObj) {
|
||||||
|
|
@ -531,7 +532,7 @@ class ExecutionContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
_serialize(obj) {
|
_serialize(obj) {
|
||||||
const result = this._debuggee.executeInGlobalWithBindings('stringify(e)', {e: obj, stringify: this._jsonStringifyObject}, {useInnerBindings: true});
|
const result = this._debuggee.executeInGlobalWithBindings('stringify(e)', {e: obj, stringify: this._jsonStringifyObject});
|
||||||
if (result.throw)
|
if (result.throw)
|
||||||
throw new Error('Object is not serializable');
|
throw new Error('Object is not serializable');
|
||||||
return result.return === undefined ? undefined : JSON.parse(result.return);
|
return result.return === undefined ? undefined : JSON.parse(result.return);
|
||||||
|
|
@ -560,12 +561,15 @@ class ExecutionContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getResult(completionValue, exceptionDetails = {}) {
|
_getResult(completionValue, exceptionDetails = {}) {
|
||||||
if (!completionValue)
|
if (!completionValue) {
|
||||||
throw new Error('evaluation terminated');
|
exceptionDetails.text = 'Evaluation terminated!';
|
||||||
|
exceptionDetails.stack = '';
|
||||||
|
return {success: false, obj: null};
|
||||||
|
}
|
||||||
if (completionValue.throw) {
|
if (completionValue.throw) {
|
||||||
if (this._debuggee.executeInGlobalWithBindings('e instanceof Error', {e: completionValue.throw}, {useInnerBindings: true}).return) {
|
if (this._debuggee.executeInGlobalWithBindings('e instanceof Error', {e: completionValue.throw}).return) {
|
||||||
exceptionDetails.text = this._debuggee.executeInGlobalWithBindings('e.message', {e: completionValue.throw}, {useInnerBindings: true}).return;
|
exceptionDetails.text = this._debuggee.executeInGlobalWithBindings('e.message', {e: completionValue.throw}).return;
|
||||||
exceptionDetails.stack = this._debuggee.executeInGlobalWithBindings('e.stack', {e: completionValue.throw}, {useInnerBindings: true}).return;
|
exceptionDetails.stack = this._debuggee.executeInGlobalWithBindings('e.stack', {e: completionValue.throw}).return;
|
||||||
} else {
|
} else {
|
||||||
exceptionDetails.value = this._serialize(completionValue.throw);
|
exceptionDetails.value = this._serialize(completionValue.throw);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
loadSubScript('chrome://juggler/content/content/Runtime.js');
|
loadSubScript('chrome://juggler/content/content/Runtime.js');
|
||||||
loadSubScript('chrome://juggler/content/SimpleChannel.js');
|
loadSubScript('chrome://juggler/content/SimpleChannel.js');
|
||||||
|
|
||||||
// SimpleChannel in worker is never replaced: its lifetime matches the lifetime
|
const channel = new SimpleChannel('worker::worker');
|
||||||
// of the worker itself, so anything would work as a unique identifier.
|
|
||||||
const channel = new SimpleChannel('worker::content', 'unique_identifier');
|
|
||||||
const eventListener = event => channel._onMessage(JSON.parse(event.data));
|
const eventListener = event => channel._onMessage(JSON.parse(event.data));
|
||||||
this.addEventListener('message', eventListener);
|
this.addEventListener('message', eventListener);
|
||||||
channel.setTransport({
|
channel.setTransport({
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,30 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
const {FrameTree} = ChromeUtils.import('chrome://juggler/content/content/FrameTree.js');
|
const {FrameTree} = ChromeUtils.import('chrome://juggler/content/content/FrameTree.js');
|
||||||
const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js');
|
const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js');
|
||||||
const {PageAgent} = ChromeUtils.import('chrome://juggler/content/content/PageAgent.js');
|
const {PageAgent} = ChromeUtils.import('chrome://juggler/content/content/PageAgent.js');
|
||||||
|
|
||||||
|
const browsingContextToAgents = new Map();
|
||||||
const helper = new Helper();
|
const helper = new Helper();
|
||||||
|
|
||||||
function initialize(browsingContext, docShell) {
|
function initialize(browsingContext, docShell, actor) {
|
||||||
const data = { channel: undefined, pageAgent: undefined, frameTree: undefined, failedToOverrideTimezone: false };
|
if (browsingContext.parent) {
|
||||||
|
// For child frames, return agents from the main frame.
|
||||||
|
return browsingContextToAgents.get(browsingContext.top);
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = browsingContextToAgents.get(browsingContext);
|
||||||
|
if (data) {
|
||||||
|
// Rebind from one main frame actor to another one.
|
||||||
|
data.channel.bindToActor(actor);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = { channel: undefined, pageAgent: undefined, frameTree: undefined, failedToOverrideTimezone: false };
|
||||||
|
browsingContextToAgents.set(browsingContext, data);
|
||||||
|
|
||||||
const applySetting = {
|
const applySetting = {
|
||||||
geolocation: (geolocation) => {
|
geolocation: (geolocation) => {
|
||||||
|
|
@ -33,6 +48,15 @@ function initialize(browsingContext, docShell) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onlineOverride: (onlineOverride) => {
|
||||||
|
if (!onlineOverride) {
|
||||||
|
docShell.onlineOverride = Ci.nsIDocShell.ONLINE_OVERRIDE_NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
docShell.onlineOverride = onlineOverride === 'online' ?
|
||||||
|
Ci.nsIDocShell.ONLINE_OVERRIDE_ONLINE : Ci.nsIDocShell.ONLINE_OVERRIDE_OFFLINE;
|
||||||
|
},
|
||||||
|
|
||||||
bypassCSP: (bypassCSP) => {
|
bypassCSP: (bypassCSP) => {
|
||||||
docShell.bypassCSPEnabled = bypassCSP;
|
docShell.bypassCSPEnabled = bypassCSP;
|
||||||
},
|
},
|
||||||
|
|
@ -45,6 +69,10 @@ function initialize(browsingContext, docShell) {
|
||||||
docShell.languageOverride = locale;
|
docShell.languageOverride = locale;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
scrollbarsHidden: (hidden) => {
|
||||||
|
data.frameTree.setScrollbarsHidden(hidden);
|
||||||
|
},
|
||||||
|
|
||||||
javaScriptDisabled: (javaScriptDisabled) => {
|
javaScriptDisabled: (javaScriptDisabled) => {
|
||||||
data.frameTree.setJavaScriptDisabled(javaScriptDisabled);
|
data.frameTree.setJavaScriptDisabled(javaScriptDisabled);
|
||||||
},
|
},
|
||||||
|
|
@ -65,7 +93,7 @@ function initialize(browsingContext, docShell) {
|
||||||
for (const { worldName, name, script } of [...contextCrossProcessCookie.bindings, ...pageCrossProcessCookie.bindings])
|
for (const { worldName, name, script } of [...contextCrossProcessCookie.bindings, ...pageCrossProcessCookie.bindings])
|
||||||
data.frameTree.addBinding(worldName, name, script);
|
data.frameTree.addBinding(worldName, name, script);
|
||||||
data.frameTree.setInitScripts([...contextCrossProcessCookie.initScripts, ...pageCrossProcessCookie.initScripts]);
|
data.frameTree.setInitScripts([...contextCrossProcessCookie.initScripts, ...pageCrossProcessCookie.initScripts]);
|
||||||
data.channel = new SimpleChannel('', 'process-' + Services.appinfo.processID);
|
data.channel = SimpleChannel.createForActor(actor);
|
||||||
data.pageAgent = new PageAgent(data.channel, data.frameTree);
|
data.pageAgent = new PageAgent(data.channel, data.frameTree);
|
||||||
docShell.fileInputInterceptionEnabled = !!pageCrossProcessCookie.interceptFileChooserDialog;
|
docShell.fileInputInterceptionEnabled = !!pageCrossProcessCookie.interceptFileChooserDialog;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
|
const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {TargetRegistry} = ChromeUtils.import("chrome://juggler/content/TargetRegistry.js");
|
const {TargetRegistry} = ChromeUtils.import("chrome://juggler/content/TargetRegistry.js");
|
||||||
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
const {PageHandler} = ChromeUtils.import("chrome://juggler/content/protocol/PageHandler.js");
|
const {PageHandler} = ChromeUtils.import("chrome://juggler/content/protocol/PageHandler.js");
|
||||||
|
|
@ -186,10 +187,6 @@ class BrowserHandler {
|
||||||
this._targetRegistry.browserContextForId(browserContextId).requestInterceptionEnabled = enabled;
|
this._targetRegistry.browserContextForId(browserContextId).requestInterceptionEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
['Browser.setCacheDisabled']({browserContextId, cacheDisabled}) {
|
|
||||||
this._targetRegistry.browserContextForId(browserContextId).setCacheDisabled(cacheDisabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
['Browser.setIgnoreHTTPSErrors']({browserContextId, ignoreHTTPSErrors}) {
|
['Browser.setIgnoreHTTPSErrors']({browserContextId, ignoreHTTPSErrors}) {
|
||||||
this._targetRegistry.browserContextForId(browserContextId).setIgnoreHTTPSErrors(nullToUndefined(ignoreHTTPSErrors));
|
this._targetRegistry.browserContextForId(browserContextId).setIgnoreHTTPSErrors(nullToUndefined(ignoreHTTPSErrors));
|
||||||
}
|
}
|
||||||
|
|
@ -203,8 +200,7 @@ class BrowserHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Browser.setOnlineOverride']({browserContextId, override}) {
|
async ['Browser.setOnlineOverride']({browserContextId, override}) {
|
||||||
const forceOffline = override === 'offline';
|
await this._targetRegistry.browserContextForId(browserContextId).applySetting('onlineOverride', nullToUndefined(override));
|
||||||
await this._targetRegistry.browserContextForId(browserContextId).setForceOffline(forceOffline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Browser.setColorScheme']({browserContextId, colorScheme}) {
|
async ['Browser.setColorScheme']({browserContextId, colorScheme}) {
|
||||||
|
|
@ -255,6 +251,10 @@ class BrowserHandler {
|
||||||
await this._targetRegistry.browserContextForId(browserContextId).setDefaultViewport(nullToUndefined(viewport));
|
await this._targetRegistry.browserContextForId(browserContextId).setDefaultViewport(nullToUndefined(viewport));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async ['Browser.setScrollbarsHidden']({browserContextId, hidden}) {
|
||||||
|
await this._targetRegistry.browserContextForId(browserContextId).applySetting('scrollbarsHidden', nullToUndefined(hidden));
|
||||||
|
}
|
||||||
|
|
||||||
async ['Browser.setInitScripts']({browserContextId, scripts}) {
|
async ['Browser.setInitScripts']({browserContextId, scripts}) {
|
||||||
await this._targetRegistry.browserContextForId(browserContextId).setInitScripts(scripts);
|
await this._targetRegistry.browserContextForId(browserContextId).setInitScripts(scripts);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {Helper, EventWatcher} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
const {Helper, EventWatcher} = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
||||||
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm');
|
||||||
const {NetworkObserver, PageNetwork} = ChromeUtils.import('chrome://juggler/content/NetworkObserver.js');
|
const {NetworkObserver, PageNetwork} = ChromeUtils.import('chrome://juggler/content/NetworkObserver.js');
|
||||||
const {PageTarget} = ChromeUtils.import('chrome://juggler/content/TargetRegistry.js');
|
const {PageTarget} = ChromeUtils.import('chrome://juggler/content/TargetRegistry.js');
|
||||||
|
|
@ -256,13 +257,6 @@ class PageHandler {
|
||||||
return await this._contentPage.send('disposeObject', options);
|
return await this._contentPage.send('disposeObject', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Heap.collectGarbage']() {
|
|
||||||
Services.obs.notifyObservers(null, "child-gc-request");
|
|
||||||
Cu.forceGC();
|
|
||||||
Services.obs.notifyObservers(null, "child-cc-request");
|
|
||||||
Cu.forceCC();
|
|
||||||
}
|
|
||||||
|
|
||||||
async ['Network.getResponseBody']({requestId}) {
|
async ['Network.getResponseBody']({requestId}) {
|
||||||
return this._pageNetwork.getResponseBody(requestId);
|
return this._pageNetwork.getResponseBody(requestId);
|
||||||
}
|
}
|
||||||
|
|
@ -309,8 +303,8 @@ class PageHandler {
|
||||||
await this._pageTarget.activateAndRun(() => {});
|
await this._pageTarget.activateAndRun(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Page.setCacheDisabled']({cacheDisabled}) {
|
async ['Page.setCacheDisabled'](options) {
|
||||||
return await this._pageTarget.setCacheDisabled(cacheDisabled);
|
return await this._contentPage.send('setCacheDisabled', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Page.addBinding']({ worldName, name, script }) {
|
async ['Page.addBinding']({ worldName, name, script }) {
|
||||||
|
|
@ -401,7 +395,7 @@ class PageHandler {
|
||||||
'nsIReferrerInfo',
|
'nsIReferrerInfo',
|
||||||
'init'
|
'init'
|
||||||
);
|
);
|
||||||
referrerInfo = new ReferrerInfo(Ci.nsIReferrerInfo.UNSAFE_URL, true, referrerURI);
|
referrerInfo = new ReferrerInfo(Ci.nsIHttpChannel.REFERRER_POLICY_UNSET, true, referrerURI);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(`Invalid referer: "${referer}"`);
|
throw new Error(`Invalid referer: "${referer}"`);
|
||||||
}
|
}
|
||||||
|
|
@ -495,9 +489,6 @@ class PageHandler {
|
||||||
this._pageTarget._linkedBrowser.scrollRectIntoViewIfNeeded(x, y, 0, 0);
|
this._pageTarget._linkedBrowser.scrollRectIntoViewIfNeeded(x, y, 0, 0);
|
||||||
// 2. Get element's bounding box in the browser after the scroll is completed.
|
// 2. Get element's bounding box in the browser after the scroll is completed.
|
||||||
const boundingBox = this._pageTarget._linkedBrowser.getBoundingClientRect();
|
const boundingBox = this._pageTarget._linkedBrowser.getBoundingClientRect();
|
||||||
// 3. Make sure compositor is flushed after scrolling.
|
|
||||||
if (win.windowUtils.flushApzRepaints())
|
|
||||||
await helper.awaitTopic('apz-repaints-flushed');
|
|
||||||
|
|
||||||
const watcher = new EventWatcher(this._pageEventSink, types, this._pendingEventWatchers);
|
const watcher = new EventWatcher(this._pageEventSink, types, this._pendingEventWatchers);
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
@ -610,7 +601,7 @@ class PageHandler {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, { muteNotificationsPopup: true });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Page.dispatchWheelEvent']({x, y, button, deltaX, deltaY, deltaZ, modifiers }) {
|
async ['Page.dispatchWheelEvent']({x, y, button, deltaX, deltaY, deltaZ, modifiers }) {
|
||||||
|
|
@ -618,7 +609,7 @@ class PageHandler {
|
||||||
const lineOrPageDeltaX = deltaX > 0 ? Math.floor(deltaX) : Math.ceil(deltaX);
|
const lineOrPageDeltaX = deltaX > 0 ? Math.floor(deltaX) : Math.ceil(deltaX);
|
||||||
const lineOrPageDeltaY = deltaY > 0 ? Math.floor(deltaY) : Math.ceil(deltaY);
|
const lineOrPageDeltaY = deltaY > 0 ? Math.floor(deltaY) : Math.ceil(deltaY);
|
||||||
|
|
||||||
await this._pageTarget.activateAndRun(async () => {
|
await this._pageTarget.activateAndRun(() => {
|
||||||
this._pageTarget.ensureContextMenuClosed();
|
this._pageTarget.ensureContextMenuClosed();
|
||||||
|
|
||||||
// 1. Scroll element to the desired location first; the coordinates are relative to the element.
|
// 1. Scroll element to the desired location first; the coordinates are relative to the element.
|
||||||
|
|
@ -627,10 +618,6 @@ class PageHandler {
|
||||||
const boundingBox = this._pageTarget._linkedBrowser.getBoundingClientRect();
|
const boundingBox = this._pageTarget._linkedBrowser.getBoundingClientRect();
|
||||||
|
|
||||||
const win = this._pageTarget._window;
|
const win = this._pageTarget._window;
|
||||||
// 3. Make sure compositor is flushed after scrolling.
|
|
||||||
if (win.windowUtils.flushApzRepaints())
|
|
||||||
await helper.awaitTopic('apz-repaints-flushed');
|
|
||||||
|
|
||||||
win.windowUtils.sendWheelEvent(
|
win.windowUtils.sendWheelEvent(
|
||||||
x + boundingBox.left,
|
x + boundingBox.left,
|
||||||
y + boundingBox.top,
|
y + boundingBox.top,
|
||||||
|
|
@ -642,7 +629,7 @@ class PageHandler {
|
||||||
lineOrPageDeltaX,
|
lineOrPageDeltaX,
|
||||||
lineOrPageDeltaY,
|
lineOrPageDeltaY,
|
||||||
0 /* options */);
|
0 /* options */);
|
||||||
}, { muteNotificationsPopup: true });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async ['Page.insertText'](options) {
|
async ['Page.insertText'](options) {
|
||||||
|
|
|
||||||
|
|
@ -322,12 +322,6 @@ const Browser = {
|
||||||
enabled: t.Boolean,
|
enabled: t.Boolean,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'setCacheDisabled': {
|
|
||||||
params: {
|
|
||||||
browserContextId: t.Optional(t.String),
|
|
||||||
cacheDisabled: t.Boolean,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'setGeolocationOverride': {
|
'setGeolocationOverride': {
|
||||||
params: {
|
params: {
|
||||||
browserContextId: t.Optional(t.String),
|
browserContextId: t.Optional(t.String),
|
||||||
|
|
@ -394,6 +388,12 @@ const Browser = {
|
||||||
viewport: t.Nullable(pageTypes.Viewport),
|
viewport: t.Nullable(pageTypes.Viewport),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'setScrollbarsHidden': {
|
||||||
|
params: {
|
||||||
|
browserContextId: t.Optional(t.String),
|
||||||
|
hidden: t.Boolean,
|
||||||
|
}
|
||||||
|
},
|
||||||
'setInitScripts': {
|
'setInitScripts': {
|
||||||
params: {
|
params: {
|
||||||
browserContextId: t.Optional(t.String),
|
browserContextId: t.Optional(t.String),
|
||||||
|
|
@ -481,17 +481,6 @@ const Browser = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const Heap = {
|
|
||||||
targets: ['page'],
|
|
||||||
types: {},
|
|
||||||
events: {},
|
|
||||||
methods: {
|
|
||||||
'collectGarbage': {
|
|
||||||
params: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const Network = {
|
const Network = {
|
||||||
targets: ['page'],
|
targets: ['page'],
|
||||||
types: networkTypes,
|
types: networkTypes,
|
||||||
|
|
@ -1007,7 +996,7 @@ const Accessibility = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.protocol = {
|
this.protocol = {
|
||||||
domains: {Browser, Heap, Page, Runtime, Network, Accessibility},
|
domains: {Browser, Page, Runtime, Network, Accessibility},
|
||||||
};
|
};
|
||||||
this.checkScheme = checkScheme;
|
this.checkScheme = checkScheme;
|
||||||
this.EXPORTED_SYMBOLS = ['protocol', 'checkScheme'];
|
this.EXPORTED_SYMBOLS = ['protocol', 'checkScheme'];
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,6 @@ void HeadlessWindowCapturer::RegisterCaptureDataCallback(rtc::VideoSinkInterface
|
||||||
rtc::CritScope lock2(&_callBackCs);
|
rtc::CritScope lock2(&_callBackCs);
|
||||||
_dataCallBacks.insert(dataCallback);
|
_dataCallBacks.insert(dataCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeadlessWindowCapturer::RegisterCaptureDataCallback(webrtc::RawVideoSinkInterface* dataCallback) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void HeadlessWindowCapturer::DeRegisterCaptureDataCallback(rtc::VideoSinkInterface<webrtc::VideoFrame>* dataCallback) {
|
void HeadlessWindowCapturer::DeRegisterCaptureDataCallback(rtc::VideoSinkInterface<webrtc::VideoFrame>* dataCallback) {
|
||||||
rtc::CritScope lock2(&_callBackCs);
|
rtc::CritScope lock2(&_callBackCs);
|
||||||
auto it = _dataCallBacks.find(dataCallback);
|
auto it = _dataCallBacks.find(dataCallback);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ class HeadlessWindowCapturer : public webrtc::VideoCaptureModuleEx {
|
||||||
int32_t StopCaptureIfAllClientsClose() override;
|
int32_t StopCaptureIfAllClientsClose() override;
|
||||||
|
|
||||||
void RegisterRawFrameCallback(webrtc::RawFrameCallback* rawFrameCallback) override;
|
void RegisterRawFrameCallback(webrtc::RawFrameCallback* rawFrameCallback) override;
|
||||||
void RegisterCaptureDataCallback(webrtc::RawVideoSinkInterface* dataCallback) override;
|
|
||||||
void DeRegisterRawFrameCallback(webrtc::RawFrameCallback* rawFrameCallback) override;
|
void DeRegisterRawFrameCallback(webrtc::RawFrameCallback* rawFrameCallback) override;
|
||||||
|
|
||||||
int32_t SetCaptureRotation(webrtc::VideoRotation) override { return -1; }
|
int32_t SetCaptureRotation(webrtc::VideoRotation) override { return -1; }
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,8 @@ public:
|
||||||
* amount of lines and columns to retain semantic of U and V planes which
|
* amount of lines and columns to retain semantic of U and V planes which
|
||||||
* contain only 1/4 of pixel information.
|
* contain only 1/4 of pixel information.
|
||||||
*/
|
*/
|
||||||
int yuvTopOffset = m_margin.top + (m_margin.top & 1);
|
int yuvTopOffset = m_margin.top & 1 ? m_margin.top + 1 : m_margin.top;
|
||||||
int yuvLeftOffset = m_margin.left + (m_margin.left & 1);
|
int yuvLeftOffset = m_margin.left & 1 ? m_margin.left + 1 : m_margin.left;
|
||||||
|
|
||||||
double src_width = src->width() - yuvLeftOffset;
|
double src_width = src->width() - yuvLeftOffset;
|
||||||
double src_height = src->height() - yuvTopOffset;
|
double src_height = src->height() - yuvTopOffset;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
|
||||||
capability.height = 960;
|
capability.height = 960;
|
||||||
capability.maxFPS = ScreencastEncoder::fps;
|
capability.maxFPS = ScreencastEncoder::fps;
|
||||||
capability.videoType = webrtc::VideoType::kI420;
|
capability.videoType = webrtc::VideoType::kI420;
|
||||||
int error = mCaptureModule->StartCaptureCounted(capability);
|
int error = mCaptureModule->StartCapture(capability);
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "StartCapture error %d\n", error);
|
fprintf(stderr, "StartCapture error %d\n", error);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -152,7 +152,7 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
|
||||||
mCaptureModule->DeRegisterCaptureDataCallback(this);
|
mCaptureModule->DeRegisterCaptureDataCallback(this);
|
||||||
else
|
else
|
||||||
mCaptureModule->DeRegisterRawFrameCallback(this);
|
mCaptureModule->DeRegisterRawFrameCallback(this);
|
||||||
mCaptureModule->StopCaptureCounted();
|
mCaptureModule->StopCapture();
|
||||||
if (mEncoder) {
|
if (mEncoder) {
|
||||||
mEncoder->finish([this, protect = RefPtr{this}] {
|
mEncoder->finish([this, protect = RefPtr{this}] {
|
||||||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -3,10 +3,6 @@
|
||||||
// =================================================================
|
// =================================================================
|
||||||
// THESE ARE THE PROPERTIES THAT MUST BE ENABLED FOR JUGGLER TO WORK
|
// THESE ARE THE PROPERTIES THAT MUST BE ENABLED FOR JUGGLER TO WORK
|
||||||
// =================================================================
|
// =================================================================
|
||||||
pref("dom.input_events.security.minNumTicks", 0);
|
|
||||||
pref("dom.input_events.security.minTimeElapsedInMS", 0);
|
|
||||||
|
|
||||||
pref("dom.iframe_lazy_loading.enabled", false);
|
|
||||||
|
|
||||||
pref("datareporting.policy.dataSubmissionEnabled", false);
|
pref("datareporting.policy.dataSubmissionEnabled", false);
|
||||||
pref("datareporting.policy.dataSubmissionPolicyAccepted", false);
|
pref("datareporting.policy.dataSubmissionPolicyAccepted", false);
|
||||||
|
|
@ -15,9 +11,6 @@ pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
|
||||||
// Force pdfs into downloads.
|
// Force pdfs into downloads.
|
||||||
pref("pdfjs.disabled", true);
|
pref("pdfjs.disabled", true);
|
||||||
|
|
||||||
// This preference breaks our authentication flow.
|
|
||||||
pref("network.auth.use_redirect_for_retries", false);
|
|
||||||
|
|
||||||
// Disable cross-process iframes, but not cross-process navigations.
|
// Disable cross-process iframes, but not cross-process navigations.
|
||||||
pref("fission.webContentIsolationStrategy", 0);
|
pref("fission.webContentIsolationStrategy", 0);
|
||||||
|
|
||||||
|
|
@ -47,9 +40,6 @@ pref("permissions.isolateBy.userContext", true);
|
||||||
// |Page.setFileInputFiles| protocol method.
|
// |Page.setFileInputFiles| protocol method.
|
||||||
pref("dom.file.createInChild", true);
|
pref("dom.file.createInChild", true);
|
||||||
|
|
||||||
// Allow uploading directorys in content process.
|
|
||||||
pref("dom.filesystem.pathcheck.disabled", true);
|
|
||||||
|
|
||||||
// Do not warn when closing all open tabs
|
// Do not warn when closing all open tabs
|
||||||
pref("browser.tabs.warnOnClose", false);
|
pref("browser.tabs.warnOnClose", false);
|
||||||
|
|
||||||
|
|
@ -100,16 +90,14 @@ pref("extensions.formautofill.addresses.supported", "off");
|
||||||
// firefox behavior with other browser defaults.
|
// firefox behavior with other browser defaults.
|
||||||
pref("security.enterprise_roots.enabled", true);
|
pref("security.enterprise_roots.enabled", true);
|
||||||
|
|
||||||
// There's a security features warning that might be shown on certain Linux distributions & configurations:
|
|
||||||
// https://support.mozilla.org/en-US/kb/install-firefox-linux#w_security-features-warning
|
|
||||||
// This notification should never be shown in automation scenarios.
|
|
||||||
pref("security.sandbox.warn_unprivileged_namespaces", false);
|
|
||||||
|
|
||||||
// Avoid stalling on shutdown, after "xpcom-will-shutdown" phase.
|
// Avoid stalling on shutdown, after "xpcom-will-shutdown" phase.
|
||||||
// This at least happens when shutting down soon after launching.
|
// This at least happens when shutting down soon after launching.
|
||||||
// See AppShutdown.cpp for more details on shutdown phases.
|
// See AppShutdown.cpp for more details on shutdown phases.
|
||||||
pref("toolkit.shutdown.fastShutdownStage", 3);
|
pref("toolkit.shutdown.fastShutdownStage", 3);
|
||||||
|
|
||||||
|
// @see https://github.com/microsoft/playwright/issues/8178
|
||||||
|
pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", true);
|
||||||
|
|
||||||
// Use light theme by default.
|
// Use light theme by default.
|
||||||
pref("ui.systemUsesDarkTheme", 0);
|
pref("ui.systemUsesDarkTheme", 0);
|
||||||
|
|
||||||
|
|
@ -120,20 +108,9 @@ pref("prompts.contentPromptSubDialog", false);
|
||||||
// Do not use system colors - they are affected by themes.
|
// Do not use system colors - they are affected by themes.
|
||||||
pref("ui.use_standins_for_native_colors", true);
|
pref("ui.use_standins_for_native_colors", true);
|
||||||
|
|
||||||
// Turn off the Push service.
|
|
||||||
pref("dom.push.serverURL", "");
|
pref("dom.push.serverURL", "");
|
||||||
// Prevent Remote Settings (firefox.settings.services.mozilla.com) to issue non local connections.
|
// This setting breaks settings loading.
|
||||||
pref("services.settings.server", "");
|
pref("services.settings.server", "");
|
||||||
// Prevent location.services.mozilla.com to issue non local connections.
|
|
||||||
pref("browser.region.network.url", "");
|
|
||||||
pref("browser.pocket.enabled", false);
|
|
||||||
pref("browser.newtabpage.activity-stream.feeds.topsites", false);
|
|
||||||
// Disable sponsored tiles from "Mozilla Tiles Service"
|
|
||||||
pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);
|
|
||||||
// required to prevent non-local access to push.services.mozilla.com
|
|
||||||
pref("dom.push.connection.enabled", false);
|
|
||||||
// Prevent contile.services.mozilla.com to issue non local connections.
|
|
||||||
pref("browser.topsites.contile.enabled", false);
|
|
||||||
pref("browser.safebrowsing.provider.mozilla.updateURL", "");
|
pref("browser.safebrowsing.provider.mozilla.updateURL", "");
|
||||||
pref("browser.library.activity-stream.enabled", false);
|
pref("browser.library.activity-stream.enabled", false);
|
||||||
pref("browser.search.geoSpecificDefaults", false);
|
pref("browser.search.geoSpecificDefaults", false);
|
||||||
|
|
@ -328,8 +305,3 @@ pref("extensions.blocklist.enabled", false);
|
||||||
// Force Firefox Devtools to open in a separate window.
|
// Force Firefox Devtools to open in a separate window.
|
||||||
pref("devtools.toolbox.host", "window");
|
pref("devtools.toolbox.host", "window");
|
||||||
|
|
||||||
// Disable auto translations
|
|
||||||
pref("browser.translations.enable", false);
|
|
||||||
|
|
||||||
// Disable spell check
|
|
||||||
pref("layout.spellcheckDefault", 0);
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
REMOTE_URL="https://github.com/WebKit/WebKit.git"
|
REMOTE_URL="https://github.com/WebKit/WebKit.git"
|
||||||
BASE_BRANCH="main"
|
BASE_BRANCH="main"
|
||||||
BASE_REVISION="76c95d6131edd36775a5eac01e297926fc974be8"
|
BASE_REVISION="3f4f70663d6e5255db11dc794a86522336a07a23"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
#import <WebKit/WKUserContentControllerPrivate.h>
|
#import <WebKit/WKUserContentControllerPrivate.h>
|
||||||
#import <WebKit/WKWebViewConfigurationPrivate.h>
|
#import <WebKit/WKWebViewConfigurationPrivate.h>
|
||||||
#import <WebKit/WKWebViewPrivate.h>
|
#import <WebKit/WKWebViewPrivate.h>
|
||||||
#import <WebKit/WKWebpagePreferencesPrivate.h>
|
|
||||||
#import <WebKit/WKWebsiteDataStorePrivate.h>
|
#import <WebKit/WKWebsiteDataStorePrivate.h>
|
||||||
#import <WebKit/WebNSURLExtras.h>
|
#import <WebKit/WebNSURLExtras.h>
|
||||||
#import <WebKit/WebKit.h>
|
#import <WebKit/WebKit.h>
|
||||||
|
|
@ -98,7 +97,7 @@ const NSActivityOptions ActivityOptions =
|
||||||
|
|
||||||
for (NSString *argument in subArray) {
|
for (NSString *argument in subArray) {
|
||||||
if (![argument hasPrefix:@"--"])
|
if (![argument hasPrefix:@"--"])
|
||||||
_initialURL = [argument copy];
|
_initialURL = argument;
|
||||||
if ([argument hasPrefix:@"--user-data-dir="]) {
|
if ([argument hasPrefix:@"--user-data-dir="]) {
|
||||||
NSRange range = NSMakeRange(16, [argument length] - 16);
|
NSRange range = NSMakeRange(16, [argument length] - 16);
|
||||||
_userDataDir = [[argument substringWithRange:range] copy];
|
_userDataDir = [[argument substringWithRange:range] copy];
|
||||||
|
|
@ -231,7 +230,7 @@ const NSActivityOptions ActivityOptions =
|
||||||
configuration = [[WKWebViewConfiguration alloc] init];
|
configuration = [[WKWebViewConfiguration alloc] init];
|
||||||
configuration.websiteDataStore = [self persistentDataStore];
|
configuration.websiteDataStore = [self persistentDataStore];
|
||||||
configuration._controlledByAutomation = true;
|
configuration._controlledByAutomation = true;
|
||||||
configuration.preferences.elementFullscreenEnabled = YES;
|
configuration.preferences._fullScreenEnabled = YES;
|
||||||
configuration.preferences._developerExtrasEnabled = YES;
|
configuration.preferences._developerExtrasEnabled = YES;
|
||||||
configuration.preferences._mediaDevicesEnabled = YES;
|
configuration.preferences._mediaDevicesEnabled = YES;
|
||||||
configuration.preferences._mockCaptureDevicesEnabled = YES;
|
configuration.preferences._mockCaptureDevicesEnabled = YES;
|
||||||
|
|
@ -241,8 +240,6 @@ const NSActivityOptions ActivityOptions =
|
||||||
configuration.preferences._hiddenPageDOMTimerThrottlingAutoIncreases = NO;
|
configuration.preferences._hiddenPageDOMTimerThrottlingAutoIncreases = NO;
|
||||||
configuration.preferences._pageVisibilityBasedProcessSuppressionEnabled = NO;
|
configuration.preferences._pageVisibilityBasedProcessSuppressionEnabled = NO;
|
||||||
configuration.preferences._domTimersThrottlingEnabled = NO;
|
configuration.preferences._domTimersThrottlingEnabled = NO;
|
||||||
// Do not auto play audio and video with sound.
|
|
||||||
configuration.defaultWebpagePreferences._autoplayPolicy = _WKWebsiteAutoplayPolicyAllowWithoutSound;
|
|
||||||
_WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
|
_WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
|
||||||
processConfiguration.forceOverlayScrollbars = YES;
|
processConfiguration.forceOverlayScrollbars = YES;
|
||||||
configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease];
|
configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease];
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ list(APPEND Playwright_PRIVATE_LIBRARIES
|
||||||
)
|
)
|
||||||
|
|
||||||
WEBKIT_EXECUTABLE_DECLARE(Playwright)
|
WEBKIT_EXECUTABLE_DECLARE(Playwright)
|
||||||
|
WEBKIT_WRAP_EXECUTABLE(Playwright
|
||||||
|
SOURCES ${TOOLS_DIR}/win/DLLLauncher/DLLLauncherMain.cpp Playwright.rc
|
||||||
|
LIBRARIES shlwapi
|
||||||
|
)
|
||||||
WEBKIT_EXECUTABLE(Playwright)
|
WEBKIT_EXECUTABLE(Playwright)
|
||||||
|
|
||||||
set_target_properties(Playwright PROPERTIES WIN32_EXECUTABLE ON)
|
set_target_properties(Playwright PROPERTIES WIN32_EXECUTABLE ON)
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,14 @@ void computeFullDesktopFrame()
|
||||||
s_windowSize.cy = scaleFactor * (desktop.bottom - desktop.top);
|
s_windowSize.cy = scaleFactor * (desktop.bottom - desktop.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
|
||||||
|
{
|
||||||
|
if (reason == DLL_PROCESS_ATTACH)
|
||||||
|
hInst = dllInstance;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool getAppDataFolder(_bstr_t& directory)
|
bool getAppDataFolder(_bstr_t& directory)
|
||||||
{
|
{
|
||||||
wchar_t appDataDirectory[MAX_PATH];
|
wchar_t appDataDirectory[MAX_PATH];
|
||||||
|
|
|
||||||
76
browser_patches/webkit/embedder/Playwright/win/Playwright.rc
Normal file
76
browser_patches/webkit/embedder/Playwright/win/Playwright.rc
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "PlaywrightResource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
#include "windows.h"
|
||||||
|
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDI_PLAYWRIGHT ICON "Playwright.ico"
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"PlaywrightResource.\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"#include ""windows.h""\r\n"
|
||||||
|
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
@ -70,7 +70,6 @@ static void configureDataStore(WKWebsiteDataStoreRef dataStore) {
|
||||||
|
|
||||||
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpstrCmdLine, _In_ int nCmdShow)
|
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpstrCmdLine, _In_ int nCmdShow)
|
||||||
{
|
{
|
||||||
hInst = hInstance;
|
|
||||||
#ifdef _CRTDBG_MAP_ALLOC
|
#ifdef _CRTDBG_MAP_ALLOC
|
||||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
||||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||||
|
|
@ -166,3 +165,8 @@ exit:
|
||||||
|
|
||||||
return static_cast<int>(msg.wParam);
|
return static_cast<int>(msg.wParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
|
||||||
|
{
|
||||||
|
return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
|
||||||
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
function getWebkitCheckoutPath() {
|
|
||||||
echo ${WK_CHECKOUT_PATH:-"$HOME/webkit"}
|
|
||||||
}
|
|
||||||
|
|
||||||
function runOSX() {
|
function runOSX() {
|
||||||
# if script is run as-is
|
# if script is run as-is
|
||||||
WK_CHECKOUT_PATH=$(getWebkitCheckoutPath)
|
if [[ -f "${SCRIPT_PATH}/EXPECTED_BUILDS" && -n "$WK_CHECKOUT_PATH" && -d "$WK_CHECKOUT_PATH/WebKitBuild/Release/Playwright.app" ]]; then
|
||||||
if [[ -f "${SCRIPT_PATH}/EXPECTED_BUILDS" && -d "$WK_CHECKOUT_PATH/WebKitBuild/Release/Playwright.app" ]]; then
|
|
||||||
DYLIB_PATH="$WK_CHECKOUT_PATH/WebKitBuild/Release"
|
DYLIB_PATH="$WK_CHECKOUT_PATH/WebKitBuild/Release"
|
||||||
|
elif [[ -f "${SCRIPT_PATH}/EXPECTED_BUILDS" && -d "$HOME/webkit/WebKitBuild/Release/Playwright.app" ]]; then
|
||||||
|
DYLIB_PATH="$HOME/webkit/WebKitBuild/Release"
|
||||||
elif [[ -d $SCRIPT_PATH/Playwright.app ]]; then
|
elif [[ -d $SCRIPT_PATH/Playwright.app ]]; then
|
||||||
DYLIB_PATH="$SCRIPT_PATH"
|
DYLIB_PATH="$SCRIPT_PATH"
|
||||||
elif [[ -d $SCRIPT_PATH/WebKitBuild/Release/Playwright.app ]]; then
|
elif [[ -d $SCRIPT_PATH/WebKitBuild/Release/Playwright.app ]]; then
|
||||||
|
|
@ -26,30 +23,29 @@ function runLinux() {
|
||||||
GIO_DIR="";
|
GIO_DIR="";
|
||||||
LD_PATH="";
|
LD_PATH="";
|
||||||
BUNDLE_DIR="";
|
BUNDLE_DIR="";
|
||||||
DEPENDENCIES_FOLDER="WebKitBuild/DependenciesGTK";
|
DEPENDENCIES_FOLDER="DependenciesGTK";
|
||||||
MINIBROWSER_FOLDER="minibrowser-gtk";
|
MINIBROWSER_FOLDER="minibrowser-gtk";
|
||||||
BUILD_FOLDER="WebKitBuild/GTK";
|
BUILD_FOLDER="WebKitBuild/GTK";
|
||||||
if [[ "$*" == *--headless* ]]; then
|
if [[ "$*" == *--headless* ]]; then
|
||||||
DEPENDENCIES_FOLDER="WebKitBuild/DependenciesWPE";
|
DEPENDENCIES_FOLDER="DependenciesWPE";
|
||||||
MINIBROWSER_FOLDER="minibrowser-wpe";
|
MINIBROWSER_FOLDER="minibrowser-wpe";
|
||||||
BUILD_FOLDER="WebKitBuild/WPE";
|
BUILD_FOLDER="WebKitBuild/WPE";
|
||||||
fi
|
fi
|
||||||
# Setting extra environment variables like LD_LIBRARY_PATH or WEBKIT_INJECTED_BUNDLE_PATH
|
# Setting extra environment variables like LD_LIBRARY_PATH or WEBKIT_INJECTED_BUNDLE_PATH
|
||||||
# is only needed when calling MiniBrowser from the build folder. The MiniBrowser from
|
# is only needed when calling MiniBrowser from the build folder. The MiniBrowser from
|
||||||
# the zip bundle wrapper already sets itself the needed env variables.
|
# the zip bundle wrapper already sets itself the needed env variables.
|
||||||
WK_CHECKOUT_PATH=$(getWebkitCheckoutPath)
|
|
||||||
if [[ -d $SCRIPT_PATH/$MINIBROWSER_FOLDER ]]; then
|
if [[ -d $SCRIPT_PATH/$MINIBROWSER_FOLDER ]]; then
|
||||||
MINIBROWSER="$SCRIPT_PATH/$MINIBROWSER_FOLDER/MiniBrowser"
|
MINIBROWSER="$SCRIPT_PATH/$MINIBROWSER_FOLDER/MiniBrowser"
|
||||||
elif [[ -d $WK_CHECKOUT_PATH/$BUILD_FOLDER ]]; then
|
elif [[ -d $HOME/webkit/$BUILD_FOLDER ]]; then
|
||||||
LD_PATH="$WK_CHECKOUT_PATH/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/checkout/$BUILD_FOLDER/Release/bin"
|
LD_PATH="$HOME/webkit/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/checkout/$BUILD_FOLDER/Release/bin"
|
||||||
GIO_DIR="$WK_CHECKOUT_PATH/$DEPENDENCIES_FOLDER/Root/lib/gio/modules"
|
GIO_DIR="$HOME/webkit/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib/gio/modules"
|
||||||
BUNDLE_DIR="$WK_CHECKOUT_PATH/$BUILD_FOLDER/Release/lib"
|
BUNDLE_DIR="$HOME/webkit/$BUILD_FOLDER/Release/lib"
|
||||||
MINIBROWSER="$WK_CHECKOUT_PATH/$BUILD_FOLDER/Release/bin/MiniBrowser"
|
MINIBROWSER="$HOME/webkit/$BUILD_FOLDER/Release/bin/MiniBrowser"
|
||||||
elif [[ -f $SCRIPT_PATH/MiniBrowser ]]; then
|
elif [[ -f $SCRIPT_PATH/MiniBrowser ]]; then
|
||||||
MINIBROWSER="$SCRIPT_PATH/MiniBrowser"
|
MINIBROWSER="$SCRIPT_PATH/MiniBrowser"
|
||||||
elif [[ -d $SCRIPT_PATH/$BUILD_FOLDER ]]; then
|
elif [[ -d $SCRIPT_PATH/$BUILD_FOLDER ]]; then
|
||||||
LD_PATH="$SCRIPT_PATH/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/$BUILD_FOLDER/Release/bin"
|
LD_PATH="$SCRIPT_PATH/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/$BUILD_FOLDER/Release/bin"
|
||||||
GIO_DIR="$SCRIPT_PATH/$DEPENDENCIES_FOLDER/Root/lib/gio/modules"
|
GIO_DIR="$SCRIPT_PATH/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib/gio/modules"
|
||||||
BUNDLE_DIR="$SCRIPT_PATH/$BUILD_FOLDER/Release/lib"
|
BUNDLE_DIR="$SCRIPT_PATH/$BUILD_FOLDER/Release/lib"
|
||||||
MINIBROWSER="$SCRIPT_PATH/$BUILD_FOLDER/Release/bin/MiniBrowser"
|
MINIBROWSER="$SCRIPT_PATH/$BUILD_FOLDER/Release/bin/MiniBrowser"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
|
|
@ -39,4 +39,5 @@ fi
|
||||||
|
|
||||||
# create a TMP directory to copy all necessary files
|
# create a TMP directory to copy all necessary files
|
||||||
cd ./x64/Release
|
cd ./x64/Release
|
||||||
7z a "$ZIP_PATH" ./PrintDeps.exe
|
zip $ZIP_PATH ./PrintDeps.exe
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: accessibility-testing
|
||||||
title: "Accessibility testing"
|
title: "Accessibility testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to test your application for many types of accessibility issues.
|
Playwright can be used to test your application for many types of accessibility issues.
|
||||||
|
|
||||||
A few examples of problems this can catch include:
|
A few examples of problems this can catch include:
|
||||||
|
|
@ -14,6 +12,8 @@ A few examples of problems this can catch include:
|
||||||
|
|
||||||
The following examples rely on the [`com.deque.html.axe-core/playwright`](https://mvnrepository.com/artifact/com.deque.html.axe-core/playwright) Maven package which adds support for running the [axe accessibility testing engine](https://www.deque.com/axe/) as part of your Playwright tests.
|
The following examples rely on the [`com.deque.html.axe-core/playwright`](https://mvnrepository.com/artifact/com.deque.html.axe-core/playwright) Maven package which adds support for running the [axe accessibility testing engine](https://www.deque.com/axe/) as part of your Playwright tests.
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
Automated accessibility tests can detect some common accessibility problems such as missing or invalid properties. But many accessibility problems can only be discovered through manual testing. We recommend using a combination of automated testing, manual accessibility assessments, and inclusive user testing.
|
Automated accessibility tests can detect some common accessibility problems such as missing or invalid properties. But many accessibility problems can only be discovered through manual testing. We recommend using a combination of automated testing, manual accessibility assessments, and inclusive user testing.
|
||||||
|
|
@ -70,24 +70,22 @@ For example, you can use [`AxeBuilder.include()`](https://github.com/dequelabs/a
|
||||||
`AxeBuilder.analyze()` will scan the page *in its current state* when you call it. To scan parts of a page that are revealed based on UI interactions, use [Locators](./locators.md) to interact with the page before invoking `analyze()`:
|
`AxeBuilder.analyze()` will scan the page *in its current state* when you call it. To scan parts of a page that are revealed based on UI interactions, use [Locators](./locators.md) to interact with the page before invoking `analyze()`:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class HomepageTests {
|
@Test
|
||||||
@Test
|
void navigationMenuFlyoutShouldNotHaveAutomaticallyDetectableAccessibilityViolations() throws Exception {
|
||||||
void navigationMenuFlyoutShouldNotHaveAutomaticallyDetectableAccessibilityViolations() throws Exception {
|
page.navigate("https://your-site.com/");
|
||||||
page.navigate("https://your-site.com/");
|
|
||||||
|
|
||||||
page.locator("button[aria-label=\"Navigation Menu\"]").click();
|
page.locator("button[aria-label=\"Navigation Menu\"]").click();
|
||||||
|
|
||||||
// It is important to waitFor() the page to be in the desired
|
// It is important to waitFor() the page to be in the desired
|
||||||
// state *before* running analyze(). Otherwise, axe might not
|
// state *before* running analyze(). Otherwise, axe might not
|
||||||
// find all the elements your test expects it to scan.
|
// find all the elements your test expects it to scan.
|
||||||
page.locator("#navigation-menu-flyout").waitFor();
|
page.locator("#navigation-menu-flyout").waitFor();
|
||||||
|
|
||||||
AxeResults accessibilityScanResults = new AxeBuilder(page)
|
AxeResults accessibilityScanResults = new AxeBuilder(page)
|
||||||
.include(Arrays.asList("#navigation-menu-flyout"))
|
.include(Arrays.asList("#navigation-menu-flyout"))
|
||||||
.analyze();
|
.analyze();
|
||||||
|
|
||||||
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
|
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -135,7 +133,7 @@ If the element in question is used repeatedly in many pages, consider [using a t
|
||||||
|
|
||||||
### Disabling individual scan rules
|
### Disabling individual scan rules
|
||||||
|
|
||||||
If your application contains many different preexisting violations of a specific rule, you can use [`AxeBuilder.disableRules()`](https://github.com/dequelabs/axe-core-maven-html/blob/develop/playwright/README.md#axebuilderdisablerulesliststring-rules) to temporarily disable individual rules until you're able to fix the issues.
|
If your application contains many different pre-existing violations of a specific rule, you can use [`AxeBuilder.disableRules()`](https://github.com/dequelabs/axe-core-maven-html/blob/develop/playwright/README.md#axebuilderdisablerulesliststring-rules) to temporarily disable individual rules until you're able to fix the issues.
|
||||||
|
|
||||||
You can find the rule IDs to pass to `disableRules()` in the `id` property of the violations you want to suppress. A [complete list of axe's rules](https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md) can be found in `axe-core`'s documentation.
|
You can find the rule IDs to pass to `disableRules()` in the `id` property of the violations you want to suppress. A [complete list of axe's rules](https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md) can be found in `axe-core`'s documentation.
|
||||||
|
|
||||||
|
|
@ -160,40 +158,38 @@ This approach avoids the downsides of using `AxeBuilder.exclude()` at the cost o
|
||||||
Here is an example of using fingerprints based on only rule IDs and "target" selectors pointing to each violation:
|
Here is an example of using fingerprints based on only rule IDs and "target" selectors pointing to each violation:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class HomepageTests {
|
@Test
|
||||||
@Test
|
shouldOnlyHaveAccessibilityViolationsMatchingKnownFingerprints() throws Exception {
|
||||||
shouldOnlyHaveAccessibilityViolationsMatchingKnownFingerprints() throws Exception {
|
page.navigate("https://your-site.com/");
|
||||||
page.navigate("https://your-site.com/");
|
|
||||||
|
|
||||||
AxeResults accessibilityScanResults = new AxeBuilder(page).analyze();
|
AxeResults accessibilityScanResults = new AxeBuilder(page).analyze();
|
||||||
|
|
||||||
List<ViolationFingerprint> violationFingerprints = fingerprintsFromScanResults(accessibilityScanResults);
|
List<ViolationFingerprint> violationFingerprints = fingerprintsFromScanResults(accessibilityScanResults);
|
||||||
|
|
||||||
assertEquals(Arrays.asList(
|
assertEquals(Arrays.asList(
|
||||||
new ViolationFingerprint("aria-roles", "[span[role=\"invalid\"]]"),
|
new ViolationFingerprint("aria-roles", "[span[role=\"invalid\"]]"),
|
||||||
new ViolationFingerprint("color-contrast", "[li:nth-child(2) > span]"),
|
new ViolationFingerprint("color-contrast", "[li:nth-child(2) > span]"),
|
||||||
new ViolationFingerprint("label", "[input]")
|
new ViolationFingerprint("label", "[input]")
|
||||||
), violationFingerprints);
|
), violationFingerprints);
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can make your "fingerprint" as specific as you like. This one considers a violation to be
|
// You can make your "fingerprint" as specific as you like. This one considers a violation to be
|
||||||
// "the same" if it corresponds the same Axe rule on the same element.
|
// "the same" if it corresponds the same Axe rule on the same element.
|
||||||
//
|
//
|
||||||
// Using a record type makes it easy to compare fingerprints with assertEquals
|
// Using a record type makes it easy to compare fingerprints with assertEquals
|
||||||
public record ViolationFingerprint(String ruleId, String target) { }
|
public record ViolationFingerprint(String ruleId, String target) { }
|
||||||
|
|
||||||
public List<ViolationFingerprint> fingerprintsFromScanResults(AxeResults results) {
|
public List<ViolationFingerprint> fingerprintsFromScanResults(AxeResults results) {
|
||||||
return results.getViolations().stream()
|
return results.getViolations().stream()
|
||||||
// Each violation refers to one rule and multiple "nodes" which violate it
|
// Each violation refers to one rule and multiple "nodes" which violate it
|
||||||
.flatMap(violation -> violation.getNodes().stream()
|
.flatMap(violation -> violation.getNodes().stream()
|
||||||
.map(node -> new ViolationFingerprint(
|
.map(node -> new ViolationFingerprint(
|
||||||
violation.getId(),
|
violation.getId(),
|
||||||
// Each node contains a "target", which is a CSS selector that uniquely identifies it
|
// Each node contains a "target", which is a CSS selector that uniquely identifies it
|
||||||
// If the page involves iframes or shadow DOMs, it may be a chain of CSS selectors
|
// If the page involves iframes or shadow DOMs, it may be a chain of CSS selectors
|
||||||
node.getTarget().toString()
|
node.getTarget().toString()
|
||||||
)))
|
)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -212,11 +208,11 @@ This example fixture creates an `AxeBuilder` object which is pre-configured with
|
||||||
|
|
||||||
```java
|
```java
|
||||||
class AxeTestFixtures extends TestFixtures {
|
class AxeTestFixtures extends TestFixtures {
|
||||||
AxeBuilder makeAxeBuilder() {
|
AxeBuilder makeAxeBuilder() {
|
||||||
return new AxeBuilder(page)
|
return new AxeBuilder(page)
|
||||||
.withTags(new String[]{"wcag2a", "wcag2aa", "wcag21a", "wcag21aa"})
|
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
|
||||||
.exclude("#commonly-reused-element-with-known-issue");
|
.exclude('#commonly-reused-element-with-known-issue');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -233,12 +229,10 @@ public class HomepageTests extends AxeTestFixtures {
|
||||||
AxeResults accessibilityScanResults = makeAxeBuilder()
|
AxeResults accessibilityScanResults = makeAxeBuilder()
|
||||||
// Automatically uses the shared AxeBuilder configuration,
|
// Automatically uses the shared AxeBuilder configuration,
|
||||||
// but supports additional test-specific configuration too
|
// but supports additional test-specific configuration too
|
||||||
.include("#specific-element-under-test")
|
.include('#specific-element-under-test')
|
||||||
.analyze();
|
.analyze();
|
||||||
|
|
||||||
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
|
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See experimental [JUnit integration](./junit.md) to automatically initialize Playwright objects and more.
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: accessibility-testing
|
||||||
title: "Accessibility testing"
|
title: "Accessibility testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to test your application for many types of accessibility issues.
|
Playwright can be used to test your application for many types of accessibility issues.
|
||||||
|
|
||||||
A few examples of problems this can catch include:
|
A few examples of problems this can catch include:
|
||||||
|
|
@ -14,7 +12,7 @@ A few examples of problems this can catch include:
|
||||||
|
|
||||||
The following examples rely on the [`@axe-core/playwright`](https://npmjs.org/@axe-core/playwright) package which adds support for running the [axe accessibility testing engine](https://www.deque.com/axe/) as part of your Playwright tests.
|
The following examples rely on the [`@axe-core/playwright`](https://npmjs.org/@axe-core/playwright) package which adds support for running the [axe accessibility testing engine](https://www.deque.com/axe/) as part of your Playwright tests.
|
||||||
|
|
||||||
:::note[Disclaimer]
|
:::note Disclaimer
|
||||||
Automated accessibility tests can detect some common accessibility problems such as missing or invalid properties. But many accessibility problems can only be discovered through manual testing. We recommend using a combination of automated testing, manual accessibility assessments, and inclusive user testing.
|
Automated accessibility tests can detect some common accessibility problems such as missing or invalid properties. But many accessibility problems can only be discovered through manual testing. We recommend using a combination of automated testing, manual accessibility assessments, and inclusive user testing.
|
||||||
|
|
||||||
For manual assessments, we recommend [Accessibility Insights for Web](https://accessibilityinsights.io/docs/web/overview/?referrer=playwright-accessibility-testing-js), a free and open source dev tool that walks you through assessing a website for [WCAG 2.1 AA](https://www.w3.org/WAI/WCAG21/quickref/?currentsidebar=%23col_customize&levels=aaa) coverage.
|
For manual assessments, we recommend [Accessibility Insights for Web](https://accessibilityinsights.io/docs/web/overview/?referrer=playwright-accessibility-testing-js), a free and open source dev tool that walks you through assessing a website for [WCAG 2.1 AA](https://www.w3.org/WAI/WCAG21/quickref/?currentsidebar=%23col_customize&levels=aaa) coverage.
|
||||||
|
|
@ -147,7 +145,7 @@ If the element in question is used repeatedly in many pages, consider [using a t
|
||||||
|
|
||||||
### Disabling individual scan rules
|
### Disabling individual scan rules
|
||||||
|
|
||||||
If your application contains many different preexisting violations of a specific rule, you can use [`AxeBuilder.disableRules()`](https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/README.md#axebuilderdisablerulesrules-stringarray) to temporarily disable individual rules until you're able to fix the issues.
|
If your application contains many different pre-existing violations of a specific rule, you can use [`AxeBuilder.disableRules()`](https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/README.md#axebuilderdisablerulesrules-stringarray) to temporarily disable individual rules until you're able to fix the issues.
|
||||||
|
|
||||||
You can find the rule IDs to pass to `disableRules()` in the `id` property of the violations you want to suppress. A [complete list of axe's rules](https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md) can be found in `axe-core`'s documentation.
|
You can find the rule IDs to pass to `disableRules()` in the `id` property of the violations you want to suppress. A [complete list of axe's rules](https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md) can be found in `axe-core`'s documentation.
|
||||||
|
|
||||||
|
|
@ -167,7 +165,7 @@ test('should not have any accessibility violations outside of rules with known i
|
||||||
|
|
||||||
### Using snapshots to allow specific known issues
|
### Using snapshots to allow specific known issues
|
||||||
|
|
||||||
If you would like to allow for a more granular set of known issues, you can use [Snapshots](./test-snapshots.md) to verify that a set of preexisting violations has not changed. This approach avoids the downsides of using `AxeBuilder.exclude()` at the cost of slightly more complexity and fragility.
|
If you would like to allow for a more granular set of known issues, you can use [Snapshots](./test-snapshots.md) to verify that a set of pre-existing violations has not changed. This approach avoids the downsides of using `AxeBuilder.exclude()` at the cost of slightly more complexity and fragility.
|
||||||
|
|
||||||
Do not use a snapshot of the entire `accessibilityScanResults.violations` array. It contains implementation details of the elements in question, such as a snippet of their rendered HTML; if you include these in your snapshots, it will make your tests prone to breaking every time one of the components in question changes for an unrelated reason:
|
Do not use a snapshot of the entire `accessibilityScanResults.violations` array. It contains implementation details of the elements in question, such as a snippet of their rendered HTML; if you include these in your snapshots, it will make your tests prone to breaking every time one of the components in question changes for an unrelated reason:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,11 @@ id: actionability
|
||||||
title: "Auto-waiting"
|
title: "Auto-waiting"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright performs a range of actionability checks on the elements before making actions to ensure these actions
|
Playwright performs a range of actionability checks on the elements before making actions to ensure these actions
|
||||||
behave as expected. It auto-waits for all the relevant checks to pass and only then performs the requested action. If the required checks do not pass within the given `timeout`, action fails with the `TimeoutError`.
|
behave as expected. It auto-waits for all the relevant checks to pass and only then performs the requested action. If the required checks do not pass within the given `timeout`, action fails with the `TimeoutError`.
|
||||||
|
|
||||||
For example, for [`method: Locator.click`], Playwright will ensure that:
|
For example, for [`method: Page.click`], Playwright will ensure that:
|
||||||
- locator resolves to exactly one element
|
- element is [Attached] to the DOM
|
||||||
- element is [Visible]
|
- element is [Visible]
|
||||||
- element is [Stable], as in not animating or completed animation
|
- element is [Stable], as in not animating or completed animation
|
||||||
- element [Receives Events], as in not obscured by other elements
|
- element [Receives Events], as in not obscured by other elements
|
||||||
|
|
@ -17,75 +15,72 @@ For example, for [`method: Locator.click`], Playwright will ensure that:
|
||||||
|
|
||||||
Here is the complete list of actionability checks performed for each action:
|
Here is the complete list of actionability checks performed for each action:
|
||||||
|
|
||||||
| Action | [Visible] | [Stable] | [Receives Events] | [Enabled] | [Editable] |
|
| Action | [Attached] | [Visible] | [Stable] | [Receives Events] | [Enabled] | [Editable] |
|
||||||
| :- | :-: | :-: | :-: | :-: | :-: |
|
| :- | :-: | :-: | :-: | :-: | :-: | :-: |
|
||||||
| [`method: Locator.check`] | Yes | Yes | Yes | Yes | - |
|
| check | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.click`] | Yes | Yes | Yes | Yes | - |
|
| click | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.dblclick`] | Yes | Yes | Yes | Yes | - |
|
| dblclick | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.setChecked`] | Yes | Yes | Yes | Yes | - |
|
| setChecked | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.tap`] | Yes | Yes | Yes | Yes | - |
|
| tap | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.uncheck`] | Yes | Yes | Yes | Yes | - |
|
| uncheck | Yes | Yes | Yes | Yes | Yes | - |
|
||||||
| [`method: Locator.hover`] | Yes | Yes | Yes | - | - |
|
| hover | Yes | Yes | Yes | Yes | - | - |
|
||||||
| [`method: Locator.dragTo`] | Yes | Yes | Yes | - | - |
|
| scrollIntoViewIfNeeded | Yes | - | Yes | - | - | - |
|
||||||
| [`method: Locator.screenshot`] | Yes | Yes | - | - | - |
|
| screenshot | Yes | Yes | Yes | - | - | - |
|
||||||
| [`method: Locator.fill`] | Yes | - | - | Yes | Yes |
|
| fill | Yes | Yes | - | - | Yes | Yes |
|
||||||
| [`method: Locator.clear`] | Yes | - | - | Yes | Yes |
|
| selectText | Yes | Yes | - | - | - | - |
|
||||||
| [`method: Locator.selectOption`] | Yes | - | - | Yes | - |
|
| dispatchEvent | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.selectText`] | Yes | - | - | - | - |
|
| focus | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.scrollIntoViewIfNeeded`] | - | Yes | - | - | - |
|
| getAttribute | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.blur`] | - | - | - | - | - |
|
| innerText | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.dispatchEvent`] | - | - | - | - | - |
|
| innerHTML | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.focus`] | - | - | - | - | - |
|
| press | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.press`] | - | - | - | - | - |
|
| setInputFiles | Yes | - | - | - | - | - |
|
||||||
| [`method: Locator.pressSequentially`] | - | - | - | - | - |
|
| selectOption | Yes | Yes | - | - | Yes | - |
|
||||||
| [`method: Locator.setInputFiles`] | - | - | - | - | - |
|
| textContent | Yes | - | - | - | - | - |
|
||||||
|
| type | Yes | - | - | - | - | - |
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
## Forcing actions
|
## Forcing actions
|
||||||
|
|
||||||
Some actions like [`method: Locator.click`] support `force` option that disables non-essential actionability checks,
|
Some actions like [`method: Page.click`] support `force` option that disables non-essential actionability checks,
|
||||||
for example passing truthy `force` to [`method: Locator.click`] method will not check that the target element actually
|
for example passing truthy `force` to [`method: Page.click`] method will not check that the target element actually
|
||||||
receives click events.
|
receives click events.
|
||||||
|
|
||||||
## Assertions
|
## Assertions
|
||||||
|
|
||||||
Playwright includes auto-retrying assertions that remove flakiness by waiting until the condition is met, similarly to auto-waiting before actions.
|
You can check the actionability state of the element using one of the following methods as well. This is typically
|
||||||
|
not necessary, but it helps writing assertive tests that ensure that after certain actions, elements reach
|
||||||
|
actionable state:
|
||||||
|
|
||||||
| Assertion | Description |
|
- [`method: ElementHandle.isChecked`]
|
||||||
| :- | :- |
|
- [`method: ElementHandle.isDisabled`]
|
||||||
| [`method: LocatorAssertions.toBeAttached`] | Element is attached |
|
- [`method: ElementHandle.isEditable`]
|
||||||
| [`method: LocatorAssertions.toBeChecked`] | Checkbox is checked |
|
- [`method: ElementHandle.isEnabled`]
|
||||||
| [`method: LocatorAssertions.toBeDisabled`] | Element is disabled |
|
- [`method: ElementHandle.isHidden`]
|
||||||
| [`method: LocatorAssertions.toBeEditable`] | Element is editable |
|
- [`method: ElementHandle.isVisible`]
|
||||||
| [`method: LocatorAssertions.toBeEmpty`] | Container is empty |
|
- [`method: Page.isChecked`]
|
||||||
| [`method: LocatorAssertions.toBeEnabled`] | Element is enabled |
|
- [`method: Page.isDisabled`]
|
||||||
| [`method: LocatorAssertions.toBeFocused`] | Element is focused |
|
- [`method: Page.isEditable`]
|
||||||
| [`method: LocatorAssertions.toBeHidden`] | Element is not visible |
|
- [`method: Page.isEnabled`]
|
||||||
| [`method: LocatorAssertions.toBeInViewport`] | Element intersects viewport |
|
- [`method: Page.isHidden`]
|
||||||
| [`method: LocatorAssertions.toBeVisible`] | Element is visible |
|
- [`method: Page.isVisible`]
|
||||||
| [`method: LocatorAssertions.toContainText`] | Element contains text |
|
- [`method: Locator.isChecked`]
|
||||||
| [`method: LocatorAssertions.toHaveAttribute`] | Element has a DOM attribute |
|
- [`method: Locator.isDisabled`]
|
||||||
| [`method: LocatorAssertions.toHaveClass`] | Element has a class property |
|
- [`method: Locator.isEditable`]
|
||||||
| [`method: LocatorAssertions.toHaveCount`] | List has exact number of children |
|
- [`method: Locator.isEnabled`]
|
||||||
| [`method: LocatorAssertions.toHaveCSS`] | Element has CSS property |
|
- [`method: Locator.isHidden`]
|
||||||
| [`method: LocatorAssertions.toHaveId`] | Element has an ID |
|
- [`method: Locator.isVisible`]
|
||||||
| [`method: LocatorAssertions.toHaveJSProperty`] | Element has a JavaScript property |
|
|
||||||
| [`method: LocatorAssertions.toHaveText`] | Element matches text |
|
|
||||||
| [`method: LocatorAssertions.toHaveValue`] | Input has a value |
|
|
||||||
| [`method: LocatorAssertions.toHaveValues`] | Select has options selected |
|
|
||||||
| [`method: PageAssertions.toHaveTitle`] | Page has a title |
|
|
||||||
| [`method: PageAssertions.toHaveURL`] | Page has a URL |
|
|
||||||
| [`method: APIResponseAssertions.toBeOK`] | Response has an OK status |
|
|
||||||
|
|
||||||
Learn more in the [assertions guide](./test-assertions.md).
|
<br/>
|
||||||
|
|
||||||
|
## Attached
|
||||||
|
|
||||||
|
Element is considered attached when it is [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
|
||||||
|
|
||||||
## Visible
|
## Visible
|
||||||
|
|
||||||
Element is considered visible when it has non-empty bounding box and does not have `visibility:hidden` computed style.
|
Element is considered visible when it has non-empty bounding box and does not have `visibility:hidden` computed style. Note that elements of zero size or with `display:none` are not considered visible.
|
||||||
|
|
||||||
Note that according to this definition:
|
|
||||||
* Elements of zero size **are not** considered visible.
|
|
||||||
* Elements with `display:none` **are not** considered visible.
|
|
||||||
* Elements with `opacity:0` **are** considered visible.
|
|
||||||
|
|
||||||
## Stable
|
## Stable
|
||||||
|
|
||||||
|
|
@ -93,27 +88,18 @@ Element is considered stable when it has maintained the same bounding box for at
|
||||||
|
|
||||||
## Enabled
|
## Enabled
|
||||||
|
|
||||||
Element is considered enabled when it is **not disabled**.
|
Element is considered enabled unless it is a `<button>`, `<select>`, `<input>` or `<textarea>` with a `disabled` property.
|
||||||
|
|
||||||
Element is **disabled** when:
|
|
||||||
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` with a `[disabled]` attribute;
|
|
||||||
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` that is a part of a `<fieldset>` with a `[disabled]` attribute;
|
|
||||||
- it is a descendant of an element with `[aria-disabled=true]` attribute.
|
|
||||||
|
|
||||||
## Editable
|
## Editable
|
||||||
|
|
||||||
Element is considered editable when it is [enabled] and is **not readonly**.
|
Element is considered editable when it is [enabled] and does not have `readonly` property set.
|
||||||
|
|
||||||
Element is **readonly** when:
|
|
||||||
- it is a `<select>`, `<input>` or `<textarea>` with a `[readonly]` attribute;
|
|
||||||
- it has an `[aria-readonly=true]` attribute and an aria role that [supports it](https://w3c.github.io/aria/#aria-readonly).
|
|
||||||
|
|
||||||
## Receives Events
|
## Receives Events
|
||||||
|
|
||||||
Element is considered receiving pointer events when it is the hit target of the pointer event at the action point. For example, when clicking at the point `(10;10)`, Playwright checks whether some other element (usually an overlay) will instead capture the click at `(10;10)`.
|
Element is considered receiving pointer events when it is the hit target of the pointer event at the action point. For example, when clicking at the point `(10;10)`, Playwright checks whether some other element (usually an overlay) will instead capture the click at `(10;10)`.
|
||||||
|
|
||||||
|
|
||||||
For example, consider a scenario where Playwright will click `Sign Up` button regardless of when the [`method: Locator.click`] call was made:
|
For example, consider a scenario where Playwright will click `Sign Up` button regardless of when the [`method: Page.click`] call was made:
|
||||||
- page is checking that user name is unique and `Sign Up` button is disabled;
|
- page is checking that user name is unique and `Sign Up` button is disabled;
|
||||||
- after checking with the server, the disabled `Sign Up` button is replaced with another one that is now enabled.
|
- after checking with the server, the disabled `Sign Up` button is replaced with another one that is now enabled.
|
||||||
|
|
||||||
|
|
@ -122,3 +108,4 @@ For example, consider a scenario where Playwright will click `Sign Up` button re
|
||||||
[Enabled]: #enabled "Enabled"
|
[Enabled]: #enabled "Enabled"
|
||||||
[Editable]: #editable "Editable"
|
[Editable]: #editable "Editable"
|
||||||
[Receives Events]: #receives-events "Receives Events"
|
[Receives Events]: #receives-events "Receives Events"
|
||||||
|
[Attached]: #attached "Attached"
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: api-testing
|
||||||
title: "API testing"
|
title: "API testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
||||||
your application.
|
your application.
|
||||||
|
|
||||||
|
|
@ -16,7 +14,9 @@ A few examples where it may come in handy:
|
||||||
|
|
||||||
All of that could be achieved via [APIRequestContext] methods.
|
All of that could be achieved via [APIRequestContext] methods.
|
||||||
|
|
||||||
The following examples rely on the [`Microsoft.Playwright.MSTest`](./test-runners.md) package which creates a Playwright and Page instance for each test.
|
The following examples rely on the [`Microsoft.Playwright.NUnit`](./test-runners.md) package which creates a Playwright and Page instance for each test.
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
## Writing API Test
|
## Writing API Test
|
||||||
|
|
||||||
|
|
@ -32,19 +32,22 @@ The following example demonstrates how to use Playwright to test issues creation
|
||||||
GitHub API requires authorization, so we'll configure the token once for all tests. While at it, we'll also set the `baseURL` to simplify the tests.
|
GitHub API requires authorization, so we'll configure the token once for all tests. While at it, we'll also set the `baseURL` to simplify the tests.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Playwright.NUnit;
|
||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using Microsoft.Playwright.MSTest;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests;
|
namespace PlaywrightTests;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string? API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
|
|
||||||
private IAPIRequestContext Request = null!;
|
private IAPIRequestContext Request = null;
|
||||||
|
|
||||||
[TestInitialize]
|
[SetUp]
|
||||||
public async Task SetUpAPITesting()
|
public async Task SetUpAPITesting()
|
||||||
{
|
{
|
||||||
await CreateAPIRequestContext();
|
await CreateAPIRequestContext();
|
||||||
|
|
@ -66,7 +69,7 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCleanup]
|
[TearDown]
|
||||||
public async Task TearDownAPITesting()
|
public async Task TearDownAPITesting()
|
||||||
{
|
{
|
||||||
await Request.DisposeAsync();
|
await Request.DisposeAsync();
|
||||||
|
|
@ -78,34 +81,36 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
|
|
||||||
Now that we initialized request object we can add a few tests that will create new issues in the repository.
|
Now that we initialized request object we can add a few tests that will create new issues in the repository.
|
||||||
```csharp
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Microsoft.Playwright.NUnit;
|
||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using Microsoft.Playwright.MSTest;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests;
|
namespace PlaywrightTests;
|
||||||
|
|
||||||
[TestClass]
|
[TestFixture]
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string REPO = "test";
|
static string REPO = "test-repo-2";
|
||||||
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
||||||
static string? API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
|
|
||||||
private IAPIRequestContext Request = null!;
|
private IAPIRequestContext Request = null;
|
||||||
|
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task ShouldCreateBugReport()
|
public async Task ShouldCreateBugReport()
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>();
|
||||||
{
|
data.Add("title", "[Bug] report 1");
|
||||||
{ "title", "[Bug] report 1" },
|
data.Add("body", "Bug description");
|
||||||
{ "body", "Bug description" }
|
|
||||||
};
|
|
||||||
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(newIssue.Ok);
|
||||||
|
|
||||||
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(issues.Ok);
|
||||||
var issuesJsonResponse = await issues.JsonAsync();
|
var issuesJsonResponse = await issues.JsonAsync();
|
||||||
JsonElement? issue = null;
|
JsonElement? issue = null;
|
||||||
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
||||||
|
|
@ -118,24 +123,23 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.IsNotNull(issue);
|
Assert.NotNull(issue);
|
||||||
Assert.AreEqual("Bug description", issue?.GetProperty("body").GetString());
|
Assert.AreEqual("Bug description", issue?.GetProperty("body").GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task ShouldCreateFeatureRequests()
|
public async Task ShouldCreateFeatureRequests()
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>();
|
||||||
{
|
data.Add("title", "[Feature] request 1");
|
||||||
{ "title", "[Feature] request 1" },
|
data.Add("body", "Feature description");
|
||||||
{ "body", "Feature description" }
|
|
||||||
};
|
|
||||||
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(newIssue.Ok);
|
||||||
|
|
||||||
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(issues.Ok);
|
||||||
var issuesJsonResponse = await issues.JsonAsync();
|
var issuesJsonResponse = await issues.JsonAsync();
|
||||||
|
var issuesJson = (await issues.JsonAsync())?.EnumerateArray();
|
||||||
|
|
||||||
JsonElement? issue = null;
|
JsonElement? issue = null;
|
||||||
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
||||||
|
|
@ -148,7 +152,7 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.IsNotNull(issue);
|
Assert.NotNull(issue);
|
||||||
Assert.AreEqual("Feature description", issue?.GetProperty("body").GetString());
|
Assert.AreEqual("Feature description", issue?.GetProperty("body").GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,47 +165,41 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use `[SetUp]` and `[TearDown]` hooks for that.
|
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use `[SetUp]` and `[TearDown]` hooks for that.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using System.Text.Json;
|
|
||||||
using Microsoft.Playwright;
|
|
||||||
using Microsoft.Playwright.MSTest;
|
|
||||||
|
|
||||||
namespace PlaywrightTests;
|
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
// ...
|
// ...
|
||||||
[TestInitialize]
|
|
||||||
public async Task SetUpAPITesting()
|
|
||||||
{
|
|
||||||
await CreateAPIRequestContext();
|
|
||||||
await CreateTestRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CreateTestRepository()
|
[SetUp]
|
||||||
{
|
public async Task SetUpAPITesting()
|
||||||
var resp = await Request.PostAsync("/user/repos", new()
|
{
|
||||||
{
|
await CreateAPIRequestContext();
|
||||||
DataObject = new Dictionary<string, string>()
|
await CreateTestRepository();
|
||||||
{
|
}
|
||||||
["name"] = REPO,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await Expect(resp).ToBeOKAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCleanup]
|
private async Task CreateTestRepository()
|
||||||
public async Task TearDownAPITesting()
|
{
|
||||||
{
|
var resp = await Request.PostAsync("/user/repos", new()
|
||||||
await DeleteTestRepository();
|
{
|
||||||
await Request.DisposeAsync();
|
DataObject = new Dictionary<string, string>()
|
||||||
}
|
{
|
||||||
|
["name"] = REPO,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Assert.True(resp.Ok);
|
||||||
|
}
|
||||||
|
|
||||||
private async Task DeleteTestRepository()
|
[TearDown]
|
||||||
{
|
public async Task TearDownAPITesting()
|
||||||
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
{
|
||||||
await Expect(resp).ToBeOKAsync();
|
await DeleteTestRepository();
|
||||||
}
|
await Request.DisposeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteTestRepository()
|
||||||
|
{
|
||||||
|
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
||||||
|
Assert.True(resp.Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -210,34 +208,36 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
Here is the complete example of an API test:
|
Here is the complete example of an API test:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Microsoft.Playwright.NUnit;
|
||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using Microsoft.Playwright.MSTest;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests;
|
namespace PlaywrightTests;
|
||||||
|
|
||||||
[TestClass]
|
[TestFixture]
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string REPO = "test-repo-2";
|
static string REPO = "test-repo-2";
|
||||||
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
||||||
static string? API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
|
|
||||||
private IAPIRequestContext Request = null!;
|
private IAPIRequestContext Request = null;
|
||||||
|
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task ShouldCreateBugReport()
|
public async Task ShouldCreateBugReport()
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>();
|
||||||
{
|
data.Add("title", "[Bug] report 1");
|
||||||
{ "title", "[Bug] report 1" },
|
data.Add("body", "Bug description");
|
||||||
{ "body", "Bug description" }
|
|
||||||
};
|
|
||||||
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(newIssue.Ok);
|
||||||
|
|
||||||
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(issues.Ok);
|
||||||
var issuesJsonResponse = await issues.JsonAsync();
|
var issuesJsonResponse = await issues.JsonAsync();
|
||||||
JsonElement? issue = null;
|
JsonElement? issue = null;
|
||||||
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
||||||
|
|
@ -250,24 +250,23 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.IsNotNull(issue);
|
Assert.NotNull(issue);
|
||||||
Assert.AreEqual("Bug description", issue?.GetProperty("body").GetString());
|
Assert.AreEqual("Bug description", issue?.GetProperty("body").GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task ShouldCreateFeatureRequests()
|
public async Task ShouldCreateFeatureRequests()
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>();
|
||||||
{
|
data.Add("title", "[Feature] request 1");
|
||||||
{ "title", "[Feature] request 1" },
|
data.Add("body", "Feature description");
|
||||||
{ "body", "Feature description" }
|
|
||||||
};
|
|
||||||
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(newIssue.Ok);
|
||||||
|
|
||||||
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
var issues = await Request.GetAsync("/repos/" + USER + "/" + REPO + "/issues");
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(issues.Ok);
|
||||||
var issuesJsonResponse = await issues.JsonAsync();
|
var issuesJsonResponse = await issues.JsonAsync();
|
||||||
|
var issuesJson = (await issues.JsonAsync())?.EnumerateArray();
|
||||||
|
|
||||||
JsonElement? issue = null;
|
JsonElement? issue = null;
|
||||||
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
foreach (JsonElement issueObj in issuesJsonResponse?.EnumerateArray())
|
||||||
|
|
@ -280,11 +279,11 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.IsNotNull(issue);
|
Assert.NotNull(issue);
|
||||||
Assert.AreEqual("Feature description", issue?.GetProperty("body").GetString());
|
Assert.AreEqual("Feature description", issue?.GetProperty("body").GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestInitialize]
|
[SetUp]
|
||||||
public async Task SetUpAPITesting()
|
public async Task SetUpAPITesting()
|
||||||
{
|
{
|
||||||
await CreateAPIRequestContext();
|
await CreateAPIRequestContext();
|
||||||
|
|
@ -293,16 +292,14 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
|
|
||||||
private async Task CreateAPIRequestContext()
|
private async Task CreateAPIRequestContext()
|
||||||
{
|
{
|
||||||
var headers = new Dictionary<string, string>
|
var headers = new Dictionary<string, string>();
|
||||||
{
|
// We set this header per GitHub guidelines.
|
||||||
// We set this header per GitHub guidelines.
|
headers.Add("Accept", "application/vnd.github.v3+json");
|
||||||
{ "Accept", "application/vnd.github.v3+json" },
|
// Add authorization token to all requests.
|
||||||
// Add authorization token to all requests.
|
// Assuming personal access token available in the environment.
|
||||||
// Assuming personal access token available in the environment.
|
headers.Add("Authorization", "token " + API_TOKEN);
|
||||||
{ "Authorization", "token " + API_TOKEN }
|
|
||||||
};
|
|
||||||
|
|
||||||
Request = await Playwright.APIRequest.NewContextAsync(new()
|
Request = await this.Playwright.APIRequest.NewContextAsync(new()
|
||||||
{
|
{
|
||||||
// All requests we send go to this API endpoint.
|
// All requests we send go to this API endpoint.
|
||||||
BaseURL = "https://api.github.com",
|
BaseURL = "https://api.github.com",
|
||||||
|
|
@ -319,10 +316,10 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
["name"] = REPO,
|
["name"] = REPO,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await Expect(resp).ToBeOKAsync();
|
Assert.True(resp.Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCleanup]
|
[TearDown]
|
||||||
public async Task TearDownAPITesting()
|
public async Task TearDownAPITesting()
|
||||||
{
|
{
|
||||||
await DeleteTestRepository();
|
await DeleteTestRepository();
|
||||||
|
|
@ -332,7 +329,7 @@ public class TestGitHubAPI : PlaywrightTest
|
||||||
private async Task DeleteTestRepository()
|
private async Task DeleteTestRepository()
|
||||||
{
|
{
|
||||||
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
||||||
await Expect(resp).ToBeOKAsync();
|
Assert.True(resp.Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -345,23 +342,21 @@ project to check that it appears at the top of the list. The check is performed
|
||||||
```csharp
|
```csharp
|
||||||
class TestGitHubAPI : PageTest
|
class TestGitHubAPI : PageTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task LastCreatedIssueShouldBeFirstInTheList()
|
public async Task LastCreatedIssueShouldBeFirstInTheList()
|
||||||
{
|
{
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>();
|
||||||
{
|
data.Add("title", "[Feature] request 1");
|
||||||
{ "title", "[Feature] request 1" },
|
data.Add("body", "Feature description");
|
||||||
{ "body", "Feature description" }
|
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
||||||
};
|
Assert.True(newIssue.Ok);
|
||||||
var newIssue = await Request.PostAsync("/repos/" + USER + "/" + REPO + "/issues", new() { DataObject = data });
|
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
|
||||||
|
|
||||||
// When inheriting from 'PlaywrightTest' it only gives you a Playwright instance. To get a Page instance, either start
|
// When inheriting from 'PlaywrightTest' it only gives you a Playwright instance. To get a Page instance, either start
|
||||||
// a browser, context, and page manually or inherit from 'PageTest' which will launch it for you.
|
// a browser, context, and page manually or inherit from 'PageTest' which will launch it for you.
|
||||||
await Page.GotoAsync("https://github.com/" + USER + "/" + REPO + "/issues");
|
await Page.GotoAsync("https://github.com/" + USER + "/" + REPO + "/issues");
|
||||||
var firstIssue = Page.Locator("a[data-hovercard-type='issue']").First;
|
var firstIssue = Page.Locator("a[data-hovercard-type='issue']").First;
|
||||||
await Expect(firstIssue).ToHaveTextAsync("[Feature] request 1");
|
await Expect(firstIssue).ToHaveTextAsync("[Feature] request 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -371,23 +366,22 @@ The following test creates a new issue via user interface in the browser and the
|
||||||
it was created:
|
it was created:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Make sure to extend from PageTest if you want to use the Page class.
|
|
||||||
class GitHubTests : PageTest
|
class GitHubTests : PageTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Test]
|
||||||
public async Task LastCreatedIssueShouldBeOnTheServer()
|
public async Task LastCreatedIssueShouldBeOnTheServer()
|
||||||
{
|
{
|
||||||
await Page.GotoAsync("https://github.com/" + USER + "/" + REPO + "/issues");
|
await Page.GotoAsync("https://github.com/" + USER + "/" + REPO + "/issues");
|
||||||
await Page.Locator("text=New Issue").ClickAsync();
|
await Page.Locator("text=New Issue").ClickAsync();
|
||||||
await Page.Locator("[aria-label='Title']").FillAsync("Bug report 1");
|
await Page.Locator("[aria-label='Title']").FillAsync("Bug report 1");
|
||||||
await Page.Locator("[aria-label='Comment body']").FillAsync("Bug description");
|
await Page.Locator("[aria-label='Comment body']").FillAsync("Bug description");
|
||||||
await Page.Locator("text=Submit new issue").ClickAsync();
|
await Page.Locator("text=Submit new issue").ClickAsync();
|
||||||
var issueId = Page.Url.Substring(Page.Url.LastIndexOf('/'));
|
String issueId = Page.Url.Substring(Page.Url.LastIndexOf('/'));
|
||||||
|
|
||||||
var newIssue = await Request.GetAsync("https://github.com/" + USER + "/" + REPO + "/issues/" + issueId);
|
var newIssue = await Request.GetAsync("https://github.com/" + USER + "/" + REPO + "/issues/" + issueId);
|
||||||
await Expect(newIssue).ToBeOKAsync();
|
Assert.True(newIssue.Ok);
|
||||||
StringAssert.Contains(await newIssue.TextAsync(), "Bug report 1");
|
StringAssert.Contains(await newIssue.TextAsync(), "Bug report 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: api-testing
|
||||||
title: "API testing"
|
title: "API testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
||||||
your application.
|
your application.
|
||||||
|
|
||||||
|
|
@ -16,6 +14,8 @@ A few examples where it may come in handy:
|
||||||
|
|
||||||
All of that could be achieved via [APIRequestContext] methods.
|
All of that could be achieved via [APIRequestContext] methods.
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
## Writing API Test
|
## Writing API Test
|
||||||
|
|
||||||
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
||||||
|
|
@ -194,7 +194,6 @@ public class TestGitHubAPI {
|
||||||
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use `@BeforeAll` and `@AfterAll` hooks for that.
|
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use `@BeforeAll` and `@AfterAll` hooks for that.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class TestGitHubAPI {
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
void createTestRepository() {
|
void createTestRepository() {
|
||||||
|
|
@ -224,7 +223,6 @@ public class TestGitHubAPI {
|
||||||
disposeAPIRequestContext();
|
disposeAPIRequestContext();
|
||||||
closePlaywright();
|
closePlaywright();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Complete test example
|
### Complete test example
|
||||||
|
|
@ -375,28 +373,24 @@ public class TestGitHubAPI {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See experimental [JUnit integration](./junit.md) to automatically initialize Playwright objects and more.
|
|
||||||
|
|
||||||
## Prepare server state via API calls
|
## Prepare server state via API calls
|
||||||
|
|
||||||
The following test creates a new issue via API and then navigates to the list of all issues in the
|
The following test creates a new issue via API and then navigates to the list of all issues in the
|
||||||
project to check that it appears at the top of the list. The check is performed using [LocatorAssertions].
|
project to check that it appears at the top of the list. The check is performed using [LocatorAssertions].
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class TestGitHubAPI {
|
@Test
|
||||||
@Test
|
void lastCreatedIssueShouldBeFirstInTheList() {
|
||||||
void lastCreatedIssueShouldBeFirstInTheList() {
|
Map<String, String> data = new HashMap<>();
|
||||||
Map<String, String> data = new HashMap<>();
|
data.put("title", "[Feature] request 1");
|
||||||
data.put("title", "[Feature] request 1");
|
data.put("body", "Feature description");
|
||||||
data.put("body", "Feature description");
|
APIResponse newIssue = request.post("/repos/" + USER + "/" + REPO + "/issues",
|
||||||
APIResponse newIssue = request.post("/repos/" + USER + "/" + REPO + "/issues",
|
RequestOptions.create().setData(data));
|
||||||
RequestOptions.create().setData(data));
|
assertTrue(newIssue.ok());
|
||||||
assertTrue(newIssue.ok());
|
|
||||||
|
|
||||||
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
|
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
|
||||||
Locator firstIssue = page.locator("a[data-hovercard-type='issue']").first();
|
Locator firstIssue = page.locator("a[data-hovercard-type='issue']").first();
|
||||||
assertThat(firstIssue).hasText("[Feature] request 1");
|
assertThat(firstIssue).hasText("[Feature] request 1");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -406,20 +400,18 @@ The following test creates a new issue via user interface in the browser and the
|
||||||
it was created:
|
it was created:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class TestGitHubAPI {
|
@Test
|
||||||
@Test
|
void lastCreatedIssueShouldBeOnTheServer() {
|
||||||
void lastCreatedIssueShouldBeOnTheServer() {
|
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
|
||||||
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
|
page.locator("text=New Issue").click();
|
||||||
page.locator("text=New Issue").click();
|
page.locator("[aria-label='Title']").fill("Bug report 1");
|
||||||
page.locator("[aria-label='Title']").fill("Bug report 1");
|
page.locator("[aria-label='Comment body']").fill("Bug description");
|
||||||
page.locator("[aria-label='Comment body']").fill("Bug description");
|
page.locator("text=Submit new issue").click();
|
||||||
page.locator("text=Submit new issue").click();
|
String issueId = page.url().substring(page.url().lastIndexOf('/'));
|
||||||
String issueId = page.url().substring(page.url().lastIndexOf('/'));
|
|
||||||
|
|
||||||
APIResponse newIssue = request.get("https://github.com/" + USER + "/" + REPO + "/issues/" + issueId);
|
APIResponse newIssue = request.get("https://github.com/" + USER + "/" + REPO + "/issues/" + issueId);
|
||||||
assertThat(newIssue).isOK();
|
assertThat(newIssue).isOK();
|
||||||
assertTrue(newIssue.text().contains("Bug report 1"));
|
assertTrue(newIssue.text().contains("Bug report 1"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: api-testing
|
||||||
title: "API testing"
|
title: "API testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
||||||
your application.
|
your application.
|
||||||
|
|
||||||
|
|
@ -16,6 +14,8 @@ A few examples where it may come in handy:
|
||||||
|
|
||||||
All of that could be achieved via [APIRequestContext] methods.
|
All of that could be achieved via [APIRequestContext] methods.
|
||||||
|
|
||||||
|
<!-- TOC3 -->
|
||||||
|
|
||||||
## Writing API Test
|
## Writing API Test
|
||||||
|
|
||||||
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
||||||
|
|
@ -46,24 +46,6 @@ export default defineConfig({
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
**Proxy configuration**
|
|
||||||
|
|
||||||
If your tests need to run behind a proxy, you can specify this in the config and the `request` fixture
|
|
||||||
will pick it up automatically:
|
|
||||||
|
|
||||||
```js title="playwright.config.ts"
|
|
||||||
import { defineConfig } from '@playwright/test';
|
|
||||||
export default defineConfig({
|
|
||||||
use: {
|
|
||||||
proxy: {
|
|
||||||
server: 'http://my-proxy:8080',
|
|
||||||
username: 'user',
|
|
||||||
password: 'secret'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Writing tests
|
### Writing tests
|
||||||
|
|
||||||
Playwright Test comes with the built-in `request` fixture that respects configuration options like `baseURL` or `extraHTTPHeaders` we specified and is ready to send some requests.
|
Playwright Test comes with the built-in `request` fixture that respects configuration options like `baseURL` or `extraHTTPHeaders` we specified and is ready to send some requests.
|
||||||
|
|
@ -329,7 +311,7 @@ test('context request will share cookie storage with its browser context', async
|
||||||
[name, value])
|
[name, value])
|
||||||
)).toEqual(responseCookies);
|
)).toEqual(responseCookies);
|
||||||
|
|
||||||
await route.fulfill({
|
route.fulfill({
|
||||||
response,
|
response,
|
||||||
headers: { ...responseHeaders, foo: 'bar' },
|
headers: { ...responseHeaders, foo: 'bar' },
|
||||||
});
|
});
|
||||||
|
|
@ -373,7 +355,7 @@ test('global context request has isolated cookie storage', async ({
|
||||||
new Map(contextCookies2.map(({ name, value }) => [name, value]))
|
new Map(contextCookies2.map(({ name, value }) => [name, value]))
|
||||||
).toEqual(responseCookies);
|
).toEqual(responseCookies);
|
||||||
|
|
||||||
await route.fulfill({
|
route.fulfill({
|
||||||
response,
|
response,
|
||||||
headers: { ...responseHeaders, foo: 'bar' },
|
headers: { ...responseHeaders, foo: 'bar' },
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ id: api-testing
|
||||||
title: "API testing"
|
title: "API testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
Playwright can be used to get access to the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API of
|
||||||
your application.
|
your application.
|
||||||
|
|
||||||
|
|
@ -18,6 +16,8 @@ All of that could be achieved via [APIRequestContext] methods.
|
||||||
|
|
||||||
The following examples rely on the [`pytest-playwright`](./test-runners.md) package which add Playwright fixtures to the Pytest test-runner.
|
The following examples rely on the [`pytest-playwright`](./test-runners.md) package which add Playwright fixtures to the Pytest test-runner.
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
## Writing API Test
|
## Writing API Test
|
||||||
|
|
||||||
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
[APIRequestContext] can send all kinds of HTTP(S) requests over network.
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ const { _android: android } = require('playwright');
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:
|
||||||
|
|
||||||
|
```bash js
|
||||||
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
|
||||||
|
```
|
||||||
|
|
||||||
## async method: Android.connect
|
## async method: Android.connect
|
||||||
* since: v1.28
|
* since: v1.28
|
||||||
- returns: <[AndroidDevice]>
|
- returns: <[AndroidDevice]>
|
||||||
|
|
@ -202,12 +208,6 @@ Prevents automatic playwright driver installation on attach. Assumes that the dr
|
||||||
Optional device serial number to launch the browser on. If not specified, it will
|
Optional device serial number to launch the browser on. If not specified, it will
|
||||||
throw if multiple devices are connected.
|
throw if multiple devices are connected.
|
||||||
|
|
||||||
### option: Android.launchServer.host
|
|
||||||
* since: v1.45
|
|
||||||
- `host` <[string]>
|
|
||||||
|
|
||||||
Host to use for the web socket. It is optional and if it is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise. Consider hardening it with picking a specific interface.
|
|
||||||
|
|
||||||
### option: Android.launchServer.port
|
### option: Android.launchServer.port
|
||||||
* since: v1.28
|
* since: v1.28
|
||||||
- `port` <[int]>
|
- `port` <[int]>
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ Launches Chrome browser on the device, and returns its persistent context.
|
||||||
|
|
||||||
### option: AndroidDevice.launchBrowser.pkg
|
### option: AndroidDevice.launchBrowser.pkg
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
- `pkg` <[string]>
|
- `command` <[string]>
|
||||||
|
|
||||||
Optional package name to launch instead of default Chrome for Android.
|
Optional package name to launch instead of default Chrome for Android.
|
||||||
|
|
||||||
|
|
@ -177,9 +177,7 @@ Launches a process in the shell on the device and returns a socket to communicat
|
||||||
|
|
||||||
### param: AndroidDevice.open.command
|
### param: AndroidDevice.open.command
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
- `command` <[string]>
|
- `command` <[string]> Shell command to execute.
|
||||||
|
|
||||||
Shell command to execute.
|
|
||||||
|
|
||||||
## async method: AndroidDevice.pinchClose
|
## async method: AndroidDevice.pinchClose
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
|
|
@ -447,7 +445,7 @@ Either a predicate that receives an event or an options object. Optional.
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
- returns: <[AndroidWebView]>
|
- returns: <[AndroidWebView]>
|
||||||
|
|
||||||
This method waits until [AndroidWebView] matching the [`param: selector`] is opened and returns it. If there is already an open [AndroidWebView] matching the [`param: selector`], returns immediately.
|
This method waits until [AndroidWebView] matching the [`option: selector`] is opened and returns it. If there is already an open [AndroidWebView] matching the [`option: selector`], returns immediately.
|
||||||
|
|
||||||
### param: AndroidDevice.webView.selector
|
### param: AndroidDevice.webView.selector
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
|
|
|
||||||
|
|
@ -12,22 +12,12 @@ see [APIRequestContext].
|
||||||
|
|
||||||
Creates new instances of [APIRequestContext].
|
Creates new instances of [APIRequestContext].
|
||||||
|
|
||||||
### option: APIRequest.newContext.clientCertificates = %%-context-option-clientCertificates-%%
|
|
||||||
* since: 1.46
|
|
||||||
|
|
||||||
### option: APIRequest.newContext.useragent = %%-context-option-useragent-%%
|
### option: APIRequest.newContext.useragent = %%-context-option-useragent-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequest.newContext.failOnStatusCode
|
|
||||||
* since: v1.51
|
|
||||||
- `failOnStatusCode` <[boolean]>
|
|
||||||
|
|
||||||
Whether to throw on response codes other than 2xx and 3xx. By default response object is returned
|
|
||||||
for all status codes.
|
|
||||||
|
|
||||||
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
|
|
@ -71,7 +61,6 @@ Methods like [`method: APIRequestContext.get`] take the base URL into considerat
|
||||||
- `localStorage` <[Array]<[Object]>>
|
- `localStorage` <[Array]<[Object]>>
|
||||||
- `name` <[string]>
|
- `name` <[string]>
|
||||||
- `value` <[string]>
|
- `value` <[string]>
|
||||||
- `indexedDB` ?<[Array]<[unknown]>> indexedDB to set for context
|
|
||||||
|
|
||||||
Populates context with given storage state. This option can be used to initialize context with logged-in information
|
Populates context with given storage state. This option can be used to initialize context with logged-in information
|
||||||
obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the
|
obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the
|
||||||
|
|
|
||||||
|
|
@ -138,40 +138,28 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### param: APIRequestContext.delete.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.delete.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.delete.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.delete.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.delete.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.delete.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.delete.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.delete.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.delete.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.delete.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.delete.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.delete.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.delete.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.delete.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.17
|
* since: v1.17
|
||||||
|
|
||||||
### option: APIRequestContext.delete.form = %%-js-fetch-option-form-%%
|
### option: APIRequestContext.delete.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.17
|
|
||||||
|
|
||||||
### option: APIRequestContext.delete.form = %%-python-fetch-option-form-%%
|
|
||||||
* since: v1.17
|
* since: v1.17
|
||||||
|
|
||||||
### option: APIRequestContext.delete.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.delete.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.17
|
* since: v1.17
|
||||||
|
|
||||||
### option: APIRequestContext.delete.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.delete.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.17
|
|
||||||
|
|
||||||
### option: APIRequestContext.delete.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.17
|
* since: v1.17
|
||||||
|
|
||||||
### option: APIRequestContext.delete.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.delete.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -189,31 +177,21 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### option: APIRequestContext.delete.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.delete.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.delete.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.dispose
|
## async method: APIRequestContext.dispose
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`].This method discards all its resources, calling any method on disposed [APIRequestContext] will throw an exception.
|
All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`]. This method
|
||||||
|
discards all stored responses, and makes [`method: APIResponse.body`] throw "Response disposed" error.
|
||||||
### option: APIRequestContext.dispose.reason
|
|
||||||
* since: v1.45
|
|
||||||
- `reason` <[string]>
|
|
||||||
|
|
||||||
The reason to be reported to the operations interrupted by the context disposal.
|
|
||||||
|
|
||||||
## async method: APIRequestContext.fetch
|
## async method: APIRequestContext.fetch
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
||||||
Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
|
Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
|
||||||
context cookies from the response. The method will automatically follow redirects.
|
context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly to the request.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
JSON objects can be passed directly to the request:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
await request.fetch('https://example.com/api/createBook', {
|
await request.fetch('https://example.com/api/createBook', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|
@ -247,17 +225,28 @@ var data = new Dictionary<string, object>() {
|
||||||
await Request.FetchAsync("https://example.com/api/createBook", new() { Method = "post", DataObject = data });
|
await Request.FetchAsync("https://example.com/api/createBook", new() { Method = "post", DataObject = data });
|
||||||
```
|
```
|
||||||
|
|
||||||
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding, by specifiying the `multipart` parameter:
|
The common way to send file(s) in the body of a request is to encode it as form fields with `multipart/form-data` encoding. You can achieve that with Playwright API like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const form = new FormData();
|
// Open file as a stream and pass it to the request:
|
||||||
form.set('name', 'John');
|
const stream = fs.createReadStream('team.csv');
|
||||||
form.append('name', 'Doe');
|
await request.fetch('https://example.com/api/uploadTeamList', {
|
||||||
// Send two file fields with the same name.
|
method: 'post',
|
||||||
form.append('file', new File(['console.log(2024);'], 'f1.js', { type: 'text/javascript' }));
|
multipart: {
|
||||||
form.append('file', new File(['hello'], 'f2.txt', { type: 'text/plain' }));
|
fileField: stream
|
||||||
await request.fetch('https://example.com/api/uploadForm', {
|
}
|
||||||
multipart: form
|
});
|
||||||
|
|
||||||
|
// Or you can pass the file content directly as an object:
|
||||||
|
await request.fetch('https://example.com/api/uploadScript', {
|
||||||
|
method: 'post',
|
||||||
|
multipart: {
|
||||||
|
fileField: {
|
||||||
|
name: 'f.js',
|
||||||
|
mimeType: 'text/javascript',
|
||||||
|
buffer: Buffer.from('console.log(2022);')
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -271,14 +260,15 @@ APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
|
||||||
// Or you can pass the file content directly as FilePayload object:
|
// Or you can pass the file content directly as FilePayload object:
|
||||||
FilePayload filePayload = new FilePayload("f.js", "text/javascript",
|
FilePayload filePayload = new FilePayload("f.js", "text/javascript",
|
||||||
"console.log(2022);".getBytes(StandardCharsets.UTF_8));
|
"console.log(2022);".getBytes(StandardCharsets.UTF_8));
|
||||||
APIResponse response = request.fetch("https://example.com/api/uploadScript",
|
APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
|
||||||
RequestOptions.create().setMethod("post").setMultipart(
|
RequestOptions.create().setMethod("post").setMultipart(
|
||||||
FormData.create().set("fileField", filePayload)));
|
FormData.create().set("fileField", filePayload)));
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
api_request_context.fetch(
|
api_request_context.fetch(
|
||||||
"https://example.com/api/uploadScript", method="post",
|
"https://example.com/api/uploadScrip'",
|
||||||
|
method="post",
|
||||||
multipart={
|
multipart={
|
||||||
"fileField": {
|
"fileField": {
|
||||||
"name": "f.js",
|
"name": "f.js",
|
||||||
|
|
@ -300,28 +290,21 @@ multipart.Set("fileField", file);
|
||||||
await Request.FetchAsync("https://example.com/api/uploadScript", new() { Method = "post", Multipart = multipart });
|
await Request.FetchAsync("https://example.com/api/uploadScript", new() { Method = "post", Multipart = multipart });
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### param: APIRequestContext.fetch.urlOrRequest
|
### param: APIRequestContext.fetch.urlOrRequest
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- `urlOrRequest` <[string]|[Request]>
|
- `urlOrRequest` <[string]|[Request]>
|
||||||
|
|
||||||
Target URL or Request to get all parameters from.
|
Target URL or Request to get all parameters from.
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.fetch.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.fetch.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.fetch.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.fetch.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.method
|
### option: APIRequestContext.fetch.method
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
* langs: js, python, csharp
|
* langs: js, python, csharp
|
||||||
|
|
@ -336,19 +319,13 @@ If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/
|
||||||
### option: APIRequestContext.fetch.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.fetch.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.form = %%-js-fetch-option-form-%%
|
### option: APIRequestContext.fetch.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.form = %%-python-fetch-option-form-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.fetch.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.fetch.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.fetch.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -366,9 +343,6 @@ If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/
|
||||||
### option: APIRequestContext.fetch.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.fetch.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.fetch.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.get
|
## async method: APIRequestContext.get
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
@ -382,24 +356,12 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
Request parameters can be configured with `params` option, they will be serialized into the URL search parameters:
|
Request parameters can be configured with `params` option, they will be serialized into the URL search parameters:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Passing params as object
|
|
||||||
await request.get('https://example.com/api/getText', {
|
await request.get('https://example.com/api/getText', {
|
||||||
params: {
|
params: {
|
||||||
'isbn': '1234',
|
'isbn': '1234',
|
||||||
'page': 23,
|
'page': 23,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Passing params as URLSearchParams
|
|
||||||
const searchParams = new URLSearchParams();
|
|
||||||
searchParams.set('isbn', '1234');
|
|
||||||
searchParams.append('page', 23);
|
|
||||||
searchParams.append('page', 24);
|
|
||||||
await request.get('https://example.com/api/getText', { params: searchParams });
|
|
||||||
|
|
||||||
// Passing params as string
|
|
||||||
const queryString = 'isbn=1234&page=23&page=24';
|
|
||||||
await request.get('https://example.com/api/getText', { params: queryString });
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|
@ -428,40 +390,28 @@ await request.GetAsync("https://example.com/api/getText", new() { Params = query
|
||||||
### param: APIRequestContext.get.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.get.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.get.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.get.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.get.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.get.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.get.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.get.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.get.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.get.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.get.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.get.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.get.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.get.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.get.form = %%-js-fetch-option-form-%%
|
### option: APIRequestContext.get.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.26
|
|
||||||
|
|
||||||
### option: APIRequestContext.get.form = %%-python-fetch-option-form-%%
|
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.get.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.get.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.get.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.get.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.26
|
|
||||||
|
|
||||||
### option: APIRequestContext.get.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.get.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.get.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -479,9 +429,6 @@ await request.GetAsync("https://example.com/api/getText", new() { Params = query
|
||||||
### option: APIRequestContext.get.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.get.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.get.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.head
|
## async method: APIRequestContext.head
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
@ -493,40 +440,28 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### param: APIRequestContext.head.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.head.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.head.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.head.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.head.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.head.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.head.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.head.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.head.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.head.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.head.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.head.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.head.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.head.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.head.form = %%-python-fetch-option-form-%%
|
### option: APIRequestContext.head.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.26
|
|
||||||
|
|
||||||
### option: APIRequestContext.head.form = %%-js-fetch-option-form-%%
|
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.head.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.head.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.head.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.head.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.26
|
|
||||||
|
|
||||||
### option: APIRequestContext.head.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.head.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.head.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -544,9 +479,6 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### option: APIRequestContext.head.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.head.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.head.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.patch
|
## async method: APIRequestContext.patch
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
@ -558,40 +490,28 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### param: APIRequestContext.patch.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.patch.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.patch.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.patch.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.patch.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.patch.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.patch.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.patch.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.patch.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.patch.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.form = %%-js-fetch-option-form-%%
|
### option: APIRequestContext.patch.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.patch.form = %%-python-fetch-option-form-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.patch.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.patch.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.patch.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.patch.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.patch.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -609,9 +529,6 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### option: APIRequestContext.patch.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.patch.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.patch.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.post
|
## async method: APIRequestContext.post
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
@ -650,7 +567,7 @@ api_request_context.post("https://example.com/api/createBook", data=data)
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var data = new Dictionary<string, object>() {
|
var data = new Dictionary<string, object>() {
|
||||||
{ "firstName", "John" },
|
{ "firstNam", "John" },
|
||||||
{ "lastName", "Doe" }
|
{ "lastName", "Doe" }
|
||||||
};
|
};
|
||||||
await request.PostAsync("https://example.com/api/createBook", new() { DataObject = data });
|
await request.PostAsync("https://example.com/api/createBook", new() { DataObject = data });
|
||||||
|
|
@ -688,17 +605,26 @@ formData.Set("body", "John Doe");
|
||||||
await request.PostAsync("https://example.com/api/findBook", new() { Form = formData });
|
await request.PostAsync("https://example.com/api/findBook", new() { Form = formData });
|
||||||
```
|
```
|
||||||
|
|
||||||
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding. Use [FormData] to construct request body and pass it to the request as `multipart` parameter:
|
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding. You can achieve that with Playwright API like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const form = new FormData();
|
// Open file as a stream and pass it to the request:
|
||||||
form.set('name', 'John');
|
const stream = fs.createReadStream('team.csv');
|
||||||
form.append('name', 'Doe');
|
await request.post('https://example.com/api/uploadTeamList', {
|
||||||
// Send two file fields with the same name.
|
multipart: {
|
||||||
form.append('file', new File(['console.log(2024);'], 'f1.js', { type: 'text/javascript' }));
|
fileField: stream
|
||||||
form.append('file', new File(['hello'], 'f2.txt', { type: 'text/plain' }));
|
}
|
||||||
await request.post('https://example.com/api/uploadForm', {
|
});
|
||||||
multipart: form
|
|
||||||
|
// Or you can pass the file content directly as an object:
|
||||||
|
await request.post('https://example.com/api/uploadScript', {
|
||||||
|
multipart: {
|
||||||
|
fileField: {
|
||||||
|
name: 'f.js',
|
||||||
|
mimeType: 'text/javascript',
|
||||||
|
buffer: Buffer.from('console.log(2022);')
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -710,16 +636,16 @@ APIResponse response = request.post("https://example.com/api/uploadTeamList",
|
||||||
FormData.create().set("fileField", file)));
|
FormData.create().set("fileField", file)));
|
||||||
|
|
||||||
// Or you can pass the file content directly as FilePayload object:
|
// Or you can pass the file content directly as FilePayload object:
|
||||||
FilePayload filePayload1 = new FilePayload("f1.js", "text/javascript",
|
FilePayload filePayload = new FilePayload("f.js", "text/javascript",
|
||||||
"console.log(2022);".getBytes(StandardCharsets.UTF_8));
|
"console.log(2022);".getBytes(StandardCharsets.UTF_8));
|
||||||
APIResponse response = request.post("https://example.com/api/uploadScript",
|
APIResponse response = request.post("https://example.com/api/uploadTeamList",
|
||||||
RequestOptions.create().setMultipart(
|
RequestOptions.create().setMultipart(
|
||||||
FormData.create().set("fileField", filePayload)));
|
FormData.create().set("fileField", filePayload)));
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
api_request_context.post(
|
api_request_context.post(
|
||||||
"https://example.com/api/uploadScript'",
|
"https://example.com/api/uploadScrip'",
|
||||||
multipart={
|
multipart={
|
||||||
"fileField": {
|
"fileField": {
|
||||||
"name": "f.js",
|
"name": "f.js",
|
||||||
|
|
@ -744,40 +670,28 @@ await request.PostAsync("https://example.com/api/uploadScript", new() { Multipar
|
||||||
### param: APIRequestContext.post.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.post.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.post.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.post.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.post.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.post.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.post.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.post.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.post.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.post.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.form = %%-js-fetch-option-form-%%
|
### option: APIRequestContext.post.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.post.form = %%-python-fetch-option-form-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.post.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.post.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.post.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.post.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.post.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -795,9 +709,6 @@ await request.PostAsync("https://example.com/api/uploadScript", new() { Multipar
|
||||||
### option: APIRequestContext.post.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.post.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.post.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.put
|
## async method: APIRequestContext.put
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[APIResponse]>
|
- returns: <[APIResponse]>
|
||||||
|
|
@ -809,40 +720,28 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### param: APIRequestContext.put.url = %%-fetch-param-url-%%
|
### param: APIRequestContext.put.url = %%-fetch-param-url-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.params = %%-js-fetch-option-params-%%
|
### param: APIRequestContext.put.params = %%-java-csharp-fetch-params-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### param: APIRequestContext.put.params = %%-java-fetch-params-%%
|
|
||||||
* since: v1.18
|
* since: v1.18
|
||||||
|
|
||||||
### option: APIRequestContext.put.params = %%-python-fetch-option-params-%%
|
### option: APIRequestContext.put.params = %%-js-python-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.params = %%-csharp-fetch-option-params-%%
|
### option: APIRequestContext.put.params = %%-csharp-fetch-option-params-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.paramsString = %%-csharp-fetch-option-paramsString-%%
|
|
||||||
* since: v1.47
|
|
||||||
|
|
||||||
### option: APIRequestContext.put.headers = %%-js-python-csharp-fetch-option-headers-%%
|
### option: APIRequestContext.put.headers = %%-js-python-csharp-fetch-option-headers-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.data = %%-js-python-csharp-fetch-option-data-%%
|
### option: APIRequestContext.put.data = %%-js-python-csharp-fetch-option-data-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.form = %%-python-fetch-option-form-%%
|
### option: APIRequestContext.put.form = %%-js-python-fetch-option-form-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.put.form = %%-js-fetch-option-form-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.form = %%-csharp-fetch-option-form-%%
|
### option: APIRequestContext.put.form = %%-csharp-fetch-option-form-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.multipart = %%-js-fetch-option-multipart-%%
|
### option: APIRequestContext.put.multipart = %%-js-python-fetch-option-multipart-%%
|
||||||
* since: v1.16
|
|
||||||
|
|
||||||
### option: APIRequestContext.put.multipart = %%-python-fetch-option-multipart-%%
|
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.put.multipart = %%-csharp-fetch-option-multipart-%%
|
### option: APIRequestContext.put.multipart = %%-csharp-fetch-option-multipart-%%
|
||||||
|
|
@ -860,9 +759,6 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
### option: APIRequestContext.put.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
### option: APIRequestContext.put.maxRedirects = %%-js-python-csharp-fetch-option-maxredirects-%%
|
||||||
* since: v1.26
|
* since: v1.26
|
||||||
|
|
||||||
### option: APIRequestContext.put.maxRetries = %%-js-python-csharp-fetch-option-maxretries-%%
|
|
||||||
* since: v1.46
|
|
||||||
|
|
||||||
## async method: APIRequestContext.storageState
|
## async method: APIRequestContext.storageState
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
- returns: <[Object]>
|
- returns: <[Object]>
|
||||||
|
|
@ -880,7 +776,6 @@ context cookies from the response. The method will automatically follow redirect
|
||||||
- `localStorage` <[Array]<[Object]>>
|
- `localStorage` <[Array]<[Object]>>
|
||||||
- `name` <[string]>
|
- `name` <[string]>
|
||||||
- `value` <[string]>
|
- `value` <[string]>
|
||||||
- `indexedDB` <[Array]<[unknown]>>
|
|
||||||
|
|
||||||
Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor.
|
Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor.
|
||||||
|
|
||||||
|
|
@ -891,9 +786,3 @@ Returns storage state for this request context, contains current cookies and loc
|
||||||
|
|
||||||
### option: APIRequestContext.storageState.path = %%-storagestate-option-path-%%
|
### option: APIRequestContext.storageState.path = %%-storagestate-option-path-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequestContext.storageState.indexedDB
|
|
||||||
* since: v1.51
|
|
||||||
- `indexedDB` ?<boolean>
|
|
||||||
|
|
||||||
Set to `true` to include IndexedDB in the storage state snapshot.
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ An object with all the response HTTP headers associated with this response.
|
||||||
- `name` <[string]> Name of the header.
|
- `name` <[string]> Name of the header.
|
||||||
- `value` <[string]> Value of the header.
|
- `value` <[string]> Value of the header.
|
||||||
|
|
||||||
An array with all the response HTTP headers associated with this response. Header names are not lower-cased.
|
An array with all the request HTTP headers associated with this response. Header names are not lower-cased.
|
||||||
Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
||||||
|
|
||||||
## async method: APIResponse.json
|
## async method: APIResponse.json
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue