playwright/packages/playwright-test/src
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
..
matchers feat: support screenshotsDir option (#12642) 2022-03-10 16:50:26 -08:00
reporters chore: cleanup hooks notion from raw/html reporters (#12610) 2022-03-08 19:08:31 -08:00
third_party chore: move comparator logic to playwright-core (#12232) 2022-02-18 14:39:17 -08:00
cli.ts chore: enable ts-esm support by default (#12658) 2022-03-10 14:48:33 -08:00
dispatcher.ts feat(test runner): on beforeAll failure, precisely skip the tests (#12417) 2022-03-08 20:29:31 -08:00
expect.ts feat: show expectation name as part of toHaveScreenshot title (#12612) 2022-03-09 20:09:45 -08:00
experimentalLoader.ts fix(test loader): implement tsconfig paths through resolveFilename (#12357) 2022-02-25 15:43:58 -08:00
fixtures.ts reland(test runner): run hooks/modifiers as a part of the test (#12518) 2022-03-08 16:35:14 -08:00
globals.ts chore(test runner): extract TestInfoImpl (#11725) 2022-01-28 17:39:42 -08:00
index.ts chore(fixtures): do not force-close contexts in beforeAll (#12416) 2022-03-09 07:26:46 -08:00
ipc.ts feat(test runner): on beforeAll failure, precisely skip the tests (#12417) 2022-03-08 20:29:31 -08:00
loader.ts feat: support screenshotsDir option (#12642) 2022-03-10 16:50:26 -08:00
profiler.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
project.ts reland(test-runner): rely on test title paths instead of ordinal (#12611) 2022-03-08 19:06:25 -08:00
runner.ts feat(test-runner): allow grepping in project (#12469) 2022-03-02 15:02:35 -08:00
test.ts reland(test-runner): rely on test title paths instead of ordinal (#12611) 2022-03-08 19:06:25 -08:00
testInfo.ts feat: support screenshotsDir option (#12642) 2022-03-10 16:50:26 -08:00
testType.ts reland(test-runner): rely on test title paths instead of ordinal (#12611) 2022-03-08 19:06:25 -08:00
transform.ts chore: enable ts-esm support by default (#12658) 2022-03-10 14:48:33 -08:00
tsxTransform.ts chore: parse-skip .tsx (#12143) 2022-02-16 15:45:35 -08:00
types.ts reland(test runner): run hooks/modifiers as a part of the test (#12518) 2022-03-08 16:35:14 -08:00
util.ts chore: refactor toMatchSnapshot once again (#12313) 2022-02-23 13:17:37 -08:00
webServer.ts chore(test-runner): correct warning instruction for port reuse (#12479) 2022-03-04 10:14:49 +01:00
worker.ts reland(test runner): run hooks/modifiers as a part of the test (#12518) 2022-03-08 16:35:14 -08:00
workerRunner.ts feat(test runner): on beforeAll failure, precisely skip the tests (#12417) 2022-03-08 20:29:31 -08:00