Commit Graph

7229 Commits

Author SHA1 Message Date
Pavel Feldman
e9fa098bf3
chore: add ct examples (#12693) 2022-03-11 15:46:11 -08:00
Ross Wollman
72b95b9ffa
chore: dogfood dotenv (#12673)
Use a top-level .env file to control the internal testing setup.

This allows for easy manipulation of environment variables regardless
of your setup (VSCode Extension, CLI, etc.).
2022-03-11 15:12:25 -08:00
Max Schmitt
d15910b450
docs(test-runner): add note about custom annotations (#12681)
o-authored-by: Dmitry Gozman <dgozman@gmail.com>
2022-03-11 19:09:23 +01:00
Andrey Lushnikov
95c774cf84
feat: support multiple screenshots in HTML report (#12577)
This patch adds support to multiple diffs. These are possible
due to soft assertions.

Drive-by: rename second screenshot in `toHaveScreenshot` failure when
re-generating expectations from "expected" to "previous".
2022-03-11 08:46:13 -08:00
Andrey Lushnikov
e3ab6388a9
feat(toHaveScreenshot): enable sensible defaults (#12675)
This patch:
- Enables configuration of certain defaults for some options of `expect.toHaveScreenshot` method via `TestProject.expect.toHaveScreenshot` property
- Sets sensible defaults for these options:
  * `fonts: "ready"`
  * `animations: "disabled"`
  * `size: "css"`
2022-03-11 08:45:36 -08:00
Yury Semikhatsky
9d4f330411
docs: fix python link to test-assertions (#12665) 2022-03-11 08:28:06 -08:00
Pavel Feldman
af55f48754
chore: add experimental mount (#12657) 2022-03-11 08:00:46 -08:00
github-actions[bot]
d7c1a57565
browser(chromium): roll to r980066 (#12682)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-03-11 12:14:20 +01:00
Ross Wollman
ebae5e76df
feat(test-runner): more default workers for M1 (#12660)
New default is based on the very (unscientific) output of repeated a few
times:

```
$ for i in `seq 5 13`; do time npm run ctest -- --reporter=line --workers=$i 'page/*' 'selector*' 'channels*' 'resource-timing*'; done
```
2022-03-11 02:12:07 -08:00
Andrey Lushnikov
1dc581c1a0
test: fix test that gave 2 pixel screenshot diff on Linux (#12671) 2022-03-10 20:26:31 -08:00
Andrey Lushnikov
b51157bdea
feat: bring back maxDiffPixels in toMatchSnapshot (#12627)
This patch reverts 2 commits that removed the feature from the method:
- "fix: explicitly ignore maxDiffPixels in toMatchSnapshot (#12570)"
  commit b8af8458d6.
- "chore: remove `maxDiffPixels` from toMatchSnapshot (#12539)"
  commit a3dff45974.
2022-03-10 18:41:16 -08:00
Andrey Lushnikov
e83549e8a0
fix: support all commong screenshot options in toHaveScreenshot (#12670)
This patch adds support for all common options in
`expect.toHaveScreenshot`.
2022-03-10 18:36:20 -08:00
Andrey Lushnikov
65b9cba143
chore: follow-up to animations default option (#12669)
This is a follow-up to 42765804bc
that was landed without bots.

I ran the bots manually on Linux & Mac.
2022-03-10 17:26:50 -08:00
Andrey Lushnikov
689d8196e0
chore: follow-up to fix docs (#12668)
This is a follow-up to 49e66c7f08 that was landed without bots.

I ran bots manually on Mac & Linux.
2022-03-10 17:19:44 -08:00
Andrey Lushnikov
42765804bc
chore: add "allow" as a default value for animations. (#12663) 2022-03-10 17:15:36 -08:00
Andrey Lushnikov
49e66c7f08
feat(screenshot): introduce new "fonts" option for screenshots (#12661)
This option will wait for webfonts to load before taking screenshots.
2022-03-10 16:54:36 -08:00
Andrey Lushnikov
12d8a262be
feat: support screenshotsDir option (#12642)
The `screenshotsDir` option controls the expectation storage
for `toHaveScreenshot()` function.

The new expectation management for screenshots has the following
key properties:
- All screenshots are stored in a single folder called `screenshotsDir`.
- Screenshot names **do not** respect `snapshotDir` and `snapshotSuffix`
  configurations.
- `screenshotsDir` is configurable per project. This way a "smoke tests"
  project can re-use screenshots from "all tests" project.
- Host platform is a top-level folder.

For example, given the following config:

```js
// playwright.config.ts
module.exports = {
  projects: [
    { name: 'Mobile Safari' },
    { name: 'Desktop Chrome' },
  ],
};
```

And the following test structure:

```
smoke-tests/
└── basic.spec.ts
```

Will result in the following screenshots folder structure by default:

```
__screenshots__/
└── darwin/
    ├── Mobile Safari/
    │   └── smoke-tests/
    │       └── basic.spec.ts/
    │           └── screenshot-expectation.png
    └── Desktop Chrome/
        └── smoke-tests/
            └── basic.spec.ts/
                └── screenshot-expectation.png
```
2022-03-10 16:50:26 -08:00
Yury Semikhatsky
10bf5f3e49
docs: update links to assertions docs (#12662) 2022-03-10 15:45:18 -08:00
Pavel Feldman
4d3d0e2bda
chore: enable ts-esm support by default (#12658) 2022-03-10 14:48:33 -08:00
Yury Semikhatsky
cf643ff04c
docs: remove unsupported permission "push" from docs (#12654) 2022-03-10 14:00:25 -08:00
Max Schmitt
324e3ff3ae
docs: add .NET as a new Docker image (#12659) 2022-03-10 22:20:04 +01:00
Dmitry Gozman
a388bb2302
feat(screenshot): size:'css'|'device' option (#12634)
With this experimental option, screenshot dimensions are in CSS pixels,
not physical device pixels, effectively ignoring the device scale factor.
2022-03-10 13:07:10 -08:00
Max Schmitt
372a3219f3
chore: remove Python from main Docker image (#12431) 2022-03-10 19:51:35 +01:00
Max Schmitt
90e76f9adb
test: rename #smoke to @smoke as test tags (#12652) 2022-03-10 19:42:52 +01:00
Max Schmitt
3f468abedd
fix(test-runner): ESM compatibly on Windows (#12615) 2022-03-10 19:27:25 +01:00
Max Schmitt
d805cd9097
chore: skip failing android tests 2 (#12647) 2022-03-10 18:46:50 +01:00
Max Schmitt
49fd77d9af
docs: reference to external allure reporter (#12646) 2022-03-10 09:01:42 -08:00
Yury Semikhatsky
e270adf437
docs: fix broken link (#12638) 2022-03-09 22:00:16 -08:00
Andrey Lushnikov
75eef09c0d
feat: show expectation name as part of toHaveScreenshot title (#12612)
This patch adds snapshot file name as part of `toHaveScreenshot`
and `toMatchSnapshot` step title.
2022-03-09 20:09:45 -08:00
Yury Semikhatsky
5f1188d195
docs: fix js example formatting (#12635) 2022-03-09 17:10:37 -08:00
Yury Semikhatsky
d49843edaa
fix(firefox): add missing dependency on Ubuntu 18.04 (#12625) 2022-03-09 11:21:15 -08:00
Dmitry Gozman
92430cc56c
chore(fixtures): do not force-close contexts in beforeAll (#12416)
This now happens the same way as for the test, in the worker cleanup
when browser closes, which is reported as a part of the test.
2022-03-09 07:26:46 -08:00
Dmitry Gozman
e8ce5d0258
feat(test runner): on beforeAll failure, precisely skip the tests (#12417)
Previously, we used to skip all the tests from the same file when
any `beforeAll` fails in the file.

Now, we only skip the rest of the tests affected by this particular
`beforeAll` and continue with other tests in the new worker.
2022-03-08 20:29:31 -08:00
Dmitry Gozman
4a768294b4
chore: cleanup hooks notion from raw/html reporters (#12610) 2022-03-08 19:08:31 -08:00
Dmitry Gozman
e895bc2751
reland(test-runner): rely on test title paths instead of ordinal (#12611)
Fixes #11904

Co-authored-by: Andrey Lushnikov <lushnikov@chromium.org>
2022-03-08 19:06:25 -08:00
Dmitry Gozman
682eeb4ae0
reland(hooks): separate test timeout from beforeAll/afterAll timeouts (#12609)
This makes it possible to have longer `beforeAll`/`afterAll` and not
affect first/last test timeout.
2022-03-08 19:05:23 -08:00
Yury Semikhatsky
176846672f
docs: clarify multiple before/after hooks execution order (#12606) 2022-03-08 17:42:50 -08:00
Dmitry Gozman
62a032baa0
chore: remove env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK (#12605) 2022-03-08 16:42:39 -08:00
Dmitry Gozman
9cd704220c
reland(test runner): run hooks/modifiers as a part of the test (#12518)
Reland: worker.stop() before worker.run() was hanging because
`_runFinished` promise was not initially resolved.
---
This moves `beforeAll`, `afterAll` and some modifiers from running
as a separate entity into running inside a test.

Pros:
- All errors are reported as test errors.
- All artifacts are collected as test artifacts.
- Reporters support this out of the box.

Details:
- Each test computes the necessary hooks to run and runs them.
- Teardown is usually performed during the test (on test failure or worker stop).
- `skipRemaining` is added to `DonePayload` to preserve the behavior
  where `beforeAll` hook failure skips subsequent tests.
  This behavior can now be improved to only target tests affected by this hook.
2022-03-08 16:35:14 -08:00
Yury Semikhatsky
79c8746fd2
docs: add name for screenshot animations option (#12601) 2022-03-08 16:02:31 -08:00
Yury Semikhatsky
03150265db
docs: update POM guide (#12598) 2022-03-08 14:01:50 -08:00
Andrey Lushnikov
4bccf2f6aa
chore: cut v1.20 branch (#12593) 2022-03-08 14:01:20 -08:00
Meir Blachman
7e53facf1e
docs: Update pom.md to use locators (#12592) 2022-03-08 21:39:40 +01:00
Max Schmitt
30c954a3ba
docs: add Docker image for Python (#12595) 2022-03-08 21:21:46 +01:00
Andrey Lushnikov
422df4cbbe
docs: add js release notes for 1.20 (#12575) 2022-03-08 12:15:55 -08:00
github-actions[bot]
04e03728b8
feat(chromium): roll to r978106 (#12585)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-03-08 21:05:56 +01:00
Andrey Lushnikov
497b51ad8c
fix(toHaveScreenshot): fix initial screenshot time (#12576)
Instead of being taken immediately, first screenshot was actually
taken after 1 second.
2022-03-08 09:30:14 -08:00
github-actions[bot]
18e6aa3f15
feat(firefox): roll to r1319 (#12587)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-03-08 09:19:00 -08:00
Andrey Lushnikov
b8af8458d6
fix: explicitly ignore maxDiffPixels in toMatchSnapshot (#12570)
Fixes #12564
2022-03-07 16:55:35 -08:00
Andrey Lushnikov
e8ad7eb3f2
browser(firefox): roll Firefox to M97 (#12574)
Firefox 98 doesn't work on Ubuntu aarch64 yet.

https://github.com/microsoft/playwright/issues/12557
2022-03-07 16:16:42 -08:00