Currently, we ues `#root` vs `#root > *` selector for component roots
depending on the number of root children. This heuristic detects
fragments that render multiple elements inside the root.
However, this does not work with empty fragments that do not render
anything.
The fix is to make the `#root >> control=component` selector that would
dynamically detect the root. This supports empty fragments and also
allows for dynamic updates of the fragments.
Allows to set workers as a percentage of logical CPUs, for example
"50%".
Examples :
```bash
npx playwright test --workers 3
npx playwright test --workers 50%
```
```js
const config: PlaywrightTestConfig = {
// ...
workers: '33%',
}
```
Often times we see "Browser has been closed" error, but it's not
entirely clear why. Showing the close stack might help.
```js
page.goto: Connection closed
==== Closed by ====
at /Users/dgozman/code/playwright/tests/library/browsertype-connect.spec.ts:477:32
```
This patch:
- Removes all `process.exit(1)` from `docker.ts` and instead throws
errors.
- Drops the `npx playwright docker test` command. We agreed to
engage docker when `PLAYWRIGHT_DOCKER` environment variable
is set.
- Introduces hidden `npx playwright docker status` command that
dumps a JSON with docker status:
```sh
aslushnikov:~/prog/playwright$ npx playwright docker status
{
"dockerEngineRunning": true,
"imageName": "playwright:local-1.27.0-next-focal",
"imageIsPulled": true,
"containerWSEndpoing":
"ws://127.0.0.1:55077/eafeb84c-571b-4d12-ac51-f6a2b43e9155",
"containerVNCEndpoint":
"http://127.0.0.1:55076/?path=fb6d4add-9adf-4c3c-b335-893bdc235cd7&resize=scale&autoconnect=1"
}
```
This patch opts into the `__screnshots__` folder snapshot management
for docker.
With this patch, docker-originating snapshots will be stored in the
following folder:
```
{testDir}/__screenshots__/{projectName}/{testFilePath}/{snapshotName}
```
Where `{testFilePath}` is a test file path relative to `testDir`
Drive-by: introduce and document the `PLAYWRIGHT_DOCKER` environment
variable that enables docker integration.
This patch introduces the following commands:
- `npx playwright docker build` that builds a VRT docker image
locally that is based off the `mcr.microsoft.com/playwright:jammy`
- `npx playwright docker start` that launches a docker container with
browsers.
- `npx playwright docker stop` that stops given docker container.
- `npx playwright docker test` that runs all the tests inside a
launched docker container.
Style inheritance disregards selector specificity, so we can't
dominate local shadow dom styles.
To mitigate this, we inject the style tag with caret-hiding
style in every shadowDom tree.
Fixes#16732
Although Playwright selectors do not pierce closed shadow roots,
one can still obtain a reference to an element inside a closed shadow root:
- through `page.evaluate()`;
- through `handle.$()` where `handle` is inside the shadow root;
- through `frame.locator()` by choosing an iframe that belongs
to a closed shadow root.
In this case, `click()` action fails during the hit check test,
but it's possible to make it work by going bottom up from the target
rather than top down from the document.