Andrey Lushnikov
6d491f928d
feat(playwright-test): introduce snapshotPathTemplate configuration ( #18568 )
...
This configuration option allows to set a string with template
values for precise control over snapshot path location.
An example of `snapshotPathTemplate` usage:
```ts
// playwright.config.ts
// Notice the `testDir` configuration!
export default {
testDir: './tests',
snapshotPathTemplate: './__screenshots__/{platform}/{projectName}/{testFilePath}/{arg}{ext}',
}
```
Currently supported "magic tokens" inside the `snapshotPathTemplate`
are:
- `{testDir}` - project's `testDir`
- `{snapshotDir}` - project's `snapshotDir`
- `{platform}` - `process.platform`
- `{projectName}` - Project's sanitized name
- `{testFileDir}` - Directories in relative path from `testDir` to test
file path (e.g. `page/` in the example below)
- `{testFileName}` - Test file name (with extension) (e.g.
`page-click.spec.ts` in the example below)
- `{testFilePath}` - Relative path from `testDir` to test file path
(e.g. `page/page-click.spec.ts` in the example below)
- `{ext}` - snapshot extension (with dots)
- `{arg}` - joined snapshot name parts, without extension (e.g.
`foo/bar/baz` in the example below)
- `{snapshotSuffix}` - `testInfo.snapshotSuffix` value.
Consider the following file structure:
```
playwright.config.ts
tests/
└── page/
└── page-click.spec.ts
```
The following `page-click.spec.ts`:
```ts
// page-click.spec.ts
import { test, expect } from '@playwright/test';
test('should work', async ({ page }) => {
await expect(page).toHaveScreenshot(['foo', 'bar', 'baz.png']);
});
```
Fixes #7792
2022-11-09 15:29:07 -08:00
Andrey Lushnikov
9bcb28f25a
Revert "feat: send SIGTERM to webserver before SIGKILL'ing it. ( #18220 )" ( #18661 )
...
This reverts commit c63a0b536d
.
Reason: https://github.com/microsoft/playwright/pull/18564
2022-11-09 09:18:33 -08:00
Yury Semikhatsky
d5494edf71
feat(runner): TestOptions.storageStateName ( #18587 )
2022-11-07 16:27:38 -08:00
Dmitry Gozman
9172a2ca5a
test: use strict png comparator in tests ( #18622 )
2022-11-07 13:32:46 -08:00
Dmitry Gozman
6a65a43e9a
chore: use consistent asLocator() in all logs ( #18586 )
...
References #18524 .
2022-11-04 15:19:16 -07:00
Yury Semikhatsky
25dc0bfacb
feat(runner): change storage fixture to TestInfo.storage() ( #18584 )
2022-11-04 14:28:25 -07:00
Yury Semikhatsky
a9c15a25f8
test: storageState from config key ( #18581 )
2022-11-04 13:10:33 -07:00
Dmitry Gozman
6fef227f43
feat(test runner): test.reset() to reset options to default/config value ( #18561 )
2022-11-04 09:03:29 -07:00
Yury Semikhatsky
c8cd07594c
feat(runner): initialize context.storageState from storage entry ( #18549 )
2022-11-03 14:20:39 -07:00
Xiaoxing Ye
9338355e47
feat(testinfo): add name to attachment output name ( #18440 )
...
Per discussion in #12950 , adding sanitized name to the output filename
prefix. This can make debugging easier, and the filename structure more
human friendly.
2022-11-03 13:54:51 -07:00
Yury Semikhatsky
45aa82242d
feat(runner): storage fixture ( #18522 )
2022-11-02 20:22:35 -07:00
Yury Semikhatsky
1d2fc1e963
feat(runner): project.setup ( #18486 )
2022-11-01 23:44:30 -07:00
Pavel Feldman
2183d9e9a2
chore: use codemirror for editor ( #18482 )
2022-11-01 15:04:30 -07:00
Yury Semikhatsky
7337dd4e28
chore: revert project.{stage,run} ( #18462 )
2022-10-31 14:04:24 -07:00
Dmitry Gozman
2d3b2a0768
feat(test runner): test.describe.configure({ retries, timeout }) ( #18388 )
...
References #10825 .
2022-10-27 15:53:27 -07:00
Pavel Feldman
db456a020c
chore: do not point to node_modules in code frames ( #18358 )
...
Fixes https://github.com/microsoft/playwright/issues/18330
2022-10-26 15:18:31 -07:00
Pavel Feldman
1505a952fe
chore: make handle beforeunload when reusing the context ( #18357 )
...
Fixes: https://github.com/microsoft/playwright/issues/17903
2022-10-26 15:17:40 -07:00
Max Schmitt
ffc47271f2
fix(junit): escape null control character ( #18325 )
...
Fixes https://github.com/microsoft/playwright/issues/18322
2022-10-25 14:39:16 -07:00
Dmitry Gozman
caa9c6a597
fix(test runner): make sure soft expect error does not mask a timeout flag ( #18321 )
...
We have to reliably know whether test timed out or not, and soft expect
error could have marked it with `status=failed` but it would still time
out. Now we have a separate `_didTimeout` flag for this.
Fixes #18023 .
2022-10-25 12:34:15 -07:00
Pavel Feldman
ab78865a8d
chore: render steps in list reporter ( #18269 )
2022-10-24 15:54:53 -07:00
Andrey Lushnikov
c63a0b536d
feat: send SIGTERM to webserver before SIGKILL'ing it. ( #18220 )
...
We now will send `SIGTERM` to the webserver and wait for the `timeout`
before sending `SIGKILL` to it.
Fixes #18209
2022-10-21 08:55:06 -07:00
Pavel Feldman
fb9555fb5d
fix(ts): resolve .js to .ts in non-ESM mode too ( #18219 )
...
Fixes https://github.com/microsoft/playwright/issues/18077
2022-10-20 12:21:22 -07:00
sand4rt
4ed2a01d9c
core(ct): import paths ( #18131 )
2022-10-19 19:41:21 -07:00
Pavel Feldman
ad9729f246
chore: respect tsconfig paths in js files ( #18191 )
...
Fixes: https://github.com/microsoft/playwright/issues/17804
2022-10-19 19:38:14 -07:00
Max Schmitt
af38449f42
fix(pwtest): fix focused line with dirname specified ( #18189 )
2022-10-19 15:05:59 -07:00
Dmitry Gozman
9fe72a1da8
fix(test runner): remove unused type imports during transform ( #18157 )
...
Fixes #18117 .
2022-10-19 13:06:11 -07:00
Yury Semikhatsky
11eb719d13
feat(runner): project run: "always" ( #18160 )
...
Projects marked with `run: 'always'` are non shard-able and run after
failures.
2022-10-18 17:18:45 -07:00
Pavel Feldman
739b64a09a
chore: render typed locators in the recorder ( #18162 )
2022-10-18 16:39:58 -07:00
Pavel Feldman
7ab4c17519
chore: support jsx/tsx syntax in test files ( #18123 )
...
Fixes https://github.com/microsoft/playwright/issues/17964
2022-10-18 12:45:33 -07:00
Yury Semikhatsky
08a3a269cd
feat(runner): project.canShard ( #18037 )
2022-10-12 14:34:22 -07:00
Yury Semikhatsky
3b8f63d703
feat(runner): project.stopOnFailure ( #18009 )
2022-10-11 17:04:01 -07:00
Yury Semikhatsky
3592269caf
feat(runner): project.stage ( #17971 )
2022-10-10 17:56:18 -07:00
Yury Semikhatsky
2d72d0ba03
chore: remove config.groups ( #17974 )
2022-10-10 16:42:48 -07:00
Dmitry Gozman
b64457d8ce
fix(locators): make regex escape work when multiple spaces are present ( #17893 )
2022-10-06 16:23:40 -07:00
Pavel Feldman
c0e4caa604
fix(esm+tsconfig): allow mapped ts files in esm mode ( #17862 )
...
Fixes https://github.com/microsoft/playwright/issues/17840
2022-10-05 18:00:49 -07:00
Pavel Feldman
5424c8c385
fix(test): unflake workers test ( #17728 )
2022-09-30 08:07:20 -07:00
Yury Semikhatsky
51966bc045
fix: --grep and --grep-invert should intersect with config ( #17716 )
...
Fixes https://github.com/microsoft/playwright/issues/17405
2022-09-29 16:39:21 -07:00
Yury Semikhatsky
9f17ee6871
feat: group filter ( #17646 )
2022-09-28 18:45:01 -07:00
Pavel Feldman
cadd4d1dd0
chore: migrate http server to ts ( #17677 )
2022-09-28 17:01:13 -07:00
Pavel Feldman
d8f67eb75d
feat(api): introduce getByTestId ( #17645 )
2022-09-27 21:06:07 -07:00
Pavel Feldman
8ad201b802
chore: add snippet to the json report ( #17567 )
2022-09-27 13:23:08 -07:00
Dmitry Gozman
50d4a5844f
test: mark "should cache build" as slow ( #17637 )
...
Frequently timing out on the bots.
2022-09-27 13:09:05 -07:00
Ross Wollman
e73676d094
fix(reporters): output relative to config ( #17518 )
...
Fixes #17412 .
Supercedes #17413 .
- if configured via playwright.config.ts, relative paths should be
relative to the config.
- if configured via env var, should be relative to `cwd`
2022-09-26 11:01:43 -07:00
Yury Semikhatsky
10d7c60abf
feat(runner): project execution schedule ( #17548 )
2022-09-23 20:01:27 -07:00
Jean-François Greffier
a15fe50e7b
feat(test runner): workers as percentage ( #17400 )
...
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%',
}
```
2022-09-21 11:17:36 -07:00
Dmitry Gozman
da7feb9cc6
fix(esm): silence warning when running with experimental loader ( #17493 )
...
Unfortunately, this silences all warnings, not just the experimental
loader warning.
2022-09-21 10:56:17 -07:00
Ross Wollman
8d639ae50e
chore: revert toHaveAttribute type sig and overloads ( #17406 )
...
Relates #16517 .
Revert "docs(python): add missing NotToHaveAttribute overloads (#17371 )"
This reverts commit 2e1ea29614
.
Revert "docs(release-notes): add 1.26 release notes for language ports
(#17345 )"
This reverts commit 4b8a85e69d
.
Revert "test: unflake "should support boolean attribute with options"
(#17024 )"
This reverts commit 1dc05bd4c6
.
Revert "fix: support toHaveAttribute(name, options) (#16941 )"
This reverts commit f30ac1d678
.
Revert "feat: expect(locator).toHaveAttribute to assert attribute
presence (#16767 )"
This reverts commit 622c73cc1e
.
2022-09-16 11:17:35 -07:00
Pavel Feldman
30ff27843a
chore: rebuild components on new vite ( #17367 )
2022-09-15 15:24:01 -07:00
Pavel Feldman
016883602d
chore: roll test runner to tot ( #17351 )
2022-09-14 19:51:22 -07:00
Andrey Lushnikov
8466c436c9
fix(list reporter): properly count new lines for long stdout ( #17339 )
2022-09-14 15:25:24 -07:00
Andrey Lushnikov
4f11a4d5e7
feat(docker): use the __screenshots__
dir for snapshots by default ( #17311 )
...
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.
2022-09-13 15:49:04 -07:00
Dmitry Gozman
48ac918cec
test: unflake "should load web server w/o esm loader in ems module" ( #17269 )
2022-09-12 11:42:04 -07:00
sand4rt
72a18754ef
core(ct): rename tests ( #17216 )
2022-09-12 09:27:53 -07:00
Dmitry Gozman
bca13bc35a
feat(assertions): support toBeVisible({ visible }) ( #17207 )
2022-09-09 08:33:23 -07:00
Pavel Feldman
80e9c5dc55
fix(reuse): restore storage state ( #17175 )
2022-09-07 19:15:04 -07:00
Pavel Feldman
c91df61ca3
chore: optionally connect instead of launching ( #17174 )
2022-09-07 15:57:20 -07:00
Max Schmitt
14ec71b905
chore: roll stable test-runner to 1.26.0-alpha-sep-7-2022 ( #17166 )
2022-09-07 20:11:09 +02:00
Dmitry Gozman
f0c5810609
feat(assertions): support toBeEditable({ editable }) ( #17065 )
2022-09-06 12:50:45 -07:00
Dmitry Gozman
306ab34aa3
feat(assertions): support toBeEnabled({ enabled }) ( #17058 )
2022-09-06 11:40:34 -07:00
Andrey Lushnikov
fafd9837ba
feat: introduce the --ignore-snapshots
option ( #17004 )
...
This patch introduces `--ignore-snapshots` Playwright Test CLI option,
and `ignoreSnapshots` configuration argument.
2022-09-01 05:34:36 -07:00
Yury Semikhatsky
5d6253f743
fix: stop har recording when APIRequestContext is disposed ( #17007 )
2022-08-31 21:51:38 -07:00
nate-ro
409bab59ea
chore: added starting time of test to the base json reporter ( #16885 )
2022-08-30 20:03:21 -07:00
Yury Semikhatsky
f30ac1d678
fix: support toHaveAttribute(name, options) ( #16941 )
2022-08-30 17:53:00 -07:00
Yury Semikhatsky
11dfd31dd9
feat: --pass-with-no-tests option ( #16902 )
2022-08-29 15:46:34 -07:00
Pavel Feldman
4d892475da
chore: do not use experimental loader for web server ( #16733 )
2022-08-23 10:22:05 -07:00
Pavel Feldman
d7be1fcca8
fix(esm): allow importing ts from esm ( #16735 )
2022-08-23 10:20:56 -07:00
Sergio Freire
abe7cf23a7
fix(junit reporter): remove source location from classname attribute ( #16499 )
2022-08-19 16:42:21 -07:00
Max Schmitt
7e2aec7454
chore: align more ESLint rules with VSCode formatting ( #16647 )
2022-08-18 20:12:33 +02:00
Pavel Feldman
bd06d1604f
chore: render original exception location in error frame ( #16515 )
2022-08-15 09:28:55 -07:00
Pavel Feldman
e1d3246d1c
fix(ct): pass local config to preview ( #16481 )
2022-08-12 10:37:35 -07:00
Dmitry Gozman
7acbd052e4
test: migrate some expect() tests to be more readable ( #16394 )
...
This moves some expect() matchers tests from test runner tests to page tests,
because these are implemented through a library call anyway.
Makes tests more readbable, faster and easier to test specific details.
2022-08-10 15:10:25 -07:00
Johannes Loher
3e67a7c836
feat(plugins): send accept header in webServer url checking ( #16251 )
2022-08-10 12:48:37 -07:00
Dmitry Gozman
baa2ef2700
fix(test runner): show interrupted as yellow ( #16396 )
...
Drive-by: fix unreadable character in "duplicate titles" error.
2022-08-09 21:17:30 -07:00
Dmitry Gozman
f58c376443
fix(test runner): do not resolve relative imports through baseUrl ( #16395 )
2022-08-09 21:16:27 -07:00
Denis Sokolov
92aacb9345
test: another test for baseUrl/relative imports ( #16338 )
...
#15891
2022-08-10 01:05:48 +02:00
Ross Wollman
a3d99f1b4a
chore: trace viewer fallback error ( #16365 )
...
Fixes #16349 .
2022-08-09 15:53:11 -07:00
Ross Wollman
36b92d8847
fix: toBeFocused should match shadow elements ( #16362 )
...
Fixes #16268 .
2022-08-08 15:34:58 -07:00
Dmitry Gozman
f6d94f0ac9
chore: update "X fatal errors" message ( #16325 )
...
Also, exlude certain errors from triggering this message:
- `no tests found`
- `duplicate test titles are not allowed`
- `--forbid-only found a focused test`
- `Timed out waiting 3600s for the entire test run`
2022-08-05 21:21:43 -07:00
Dmitry Gozman
7a86e140f5
chore: remove TestProject.projectSetup ( #16321 )
...
There are better ideas to address this issue in more general manner.
2022-08-05 15:24:30 -07:00
Dmitry Gozman
cb30cb4eb7
feat(test runner): add --trace cli option ( #16277 )
2022-08-05 09:20:39 -07:00
Dmitry Gozman
919b1cbb22
fix(test runner): do not swallow afterEach errors after skipped tests ( #16276 )
...
Drive-by: add more test runner logging.
2022-08-04 18:49:23 -07:00
Pavel Feldman
97fa2518e9
fix(reuse): clear storage after stopping all scripts ( #16275 )
2022-08-04 16:39:18 -07:00
Pavel Feldman
b3d30a808f
fix(reuse): reset sw, db, storages ( #16265 )
2022-08-04 15:01:34 -07:00
Dmitry Gozman
2fa48483af
test: unflake "should retain traces for interrupted tests" ( #16235 )
...
Ensure both tests start before one of them finishes.
2022-08-04 09:18:18 -07:00
Pavel Feldman
74f7005c02
chore: preserve window while reusing window ( #16225 )
2022-08-03 16:14:28 -07:00
Dmitry Gozman
03fe75251b
fix(test runner): show tests as interrupted when maxFailures stops them ( #16178 )
...
Previously, we marked these tests as skipped, and it was sometimes
confusing, because they did actually run and produce some output/artifacts.
2022-08-03 15:25:25 -07:00
Dmitry Gozman
445fe032f5
feat(test runner): separate interrupted status from skipped ( #16124 )
2022-08-02 12:55:43 -07:00
Dmitry Gozman
3112edb4ca
feat(test runner): TestProject.projectSetup ( #16063 )
...
`projectSetup` is a project-scoped alternative to `globalSetup`.
It is only executed if at least one test from the project is scheduled to run.
2022-08-01 09:01:23 -07:00
Yury Semikhatsky
7d306bbc66
feat: return value from step ( #16060 )
2022-07-29 15:16:07 -07:00
Dmitry Gozman
e830fe821d
feat(test runner): introduce test.describe.fixme ( #16059 )
2022-07-29 12:44:22 -07:00
Yury Semikhatsky
af8e3e7afa
feat: print response text when toBeOK fails ( #16040 )
2022-07-29 11:46:48 -07:00
Dmitry Gozman
62e4e80599
feat(test runner): show the number of fatal errors at the end ( #15975 )
2022-07-28 14:46:21 -07:00
Max Schmitt
a089bf3df5
chore(test-runner): better error message if page gets used inside beforeAll ( #16012 )
2022-07-28 23:07:28 +02:00
Dmitry Gozman
3d89506704
fix(fixtures): make undefined option mean "default value" ( #16026 )
...
In the following example, `locale` inside the `describe`
would be reverted to the default value:
```js
test.use({ locale: 'en-GB' });
test.decsribe(() => {
test.use({ locale: undefined });
});
```
2022-07-28 12:57:05 -07:00
Pavel Feldman
8c190c3e09
feat(testId): expose persistent test id ( #16003 )
2022-07-27 20:17:19 -07:00
Dmitry Gozman
a94fe361a2
test: unflake a few tests ( #15959 )
2022-07-27 11:27:53 -07:00
Dmitry Gozman
6009804e0e
Revert "fix(test runner): ignore undefined values in fixtures definit…ions ( #15119 )" ( #15979 )
...
Revert "fix(test runner): ignore undefined values in fixtures definitions (#15119 )"
Revert commit d7b63fa0b4
.
Add a test for the broken behavior.
2022-07-27 08:51:45 -07:00
Dmitry Gozman
cd9dccbe27
fix(test runner): serial suites inside parallel suite should run in parallel ( #15769 )
2022-07-26 13:38:25 -07:00
Dmitry Gozman
c0d78c5642
fix(runner): friendly error message instead of "digests do not match" ( #15939 )
2022-07-26 08:53:32 -07:00
Pavel Feldman
6fcc916f00
test: passing test for issue 15891 ( #15930 )
2022-07-25 15:28:14 -07:00