feat!: add screenshotDirectory config to browser.expect.toMatchScreenshot#10592
Conversation
|
There are 2 issues here:
For screenshots, this option is described as: /**
* Directory where screenshots will be saved when page.screenshot() is called
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
* If this is set, it will be resolved relative to the project root.
* @default __screenshots__
*/While for the assertion it is described as as: /**
* The value provided to `browser.screenshotDirectory`,
* if none is provided, its default value.
*/They promise 2 different things to the user, while sharing the same value under the hood. This, in combination with /**
* Overrides default reference screenshot path.
*
* @default `${root}/${testFileDirectory}/${screenshotDirectory}/${testFileName}/${arg}-${browserName}-${platform}${ext}`
*/On top of that, the broken relativization made it impossible for users to use absolute paths. I'm still not sure if this is the best possible solution, but seems like a good middle ground without breaking too much existing behavior. |
236f231 to
f97b5cd
Compare
screenshotDirectory value as-is to toMatchScreenshot path resolutionscreenshotDirectory config to browser.expect.toMatchScreenshot
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
f97b5cd to
27c9f96
Compare
|
Added a new config value as suggested by @sheremet-va, which should solve this overlap. |
| * | ||
| * @default `__screenshots__`. | ||
| */ | ||
| screenshotDirectory?: string |
There was a problem hiding this comment.
Should we use a different name?
|
This makes sense to me, but I think this should also be mentioned in the migration guide |
27c9f96 to
05e00c4
Compare
Description
Resolves #9636
This could be a potentially breaking change (fix).
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.