microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.11k stars 3.69k forks source link

How to set a custom name for snapshot in the Playwright #33715

Closed DmytroNebelskyi closed 16 hours ago

DmytroNebelskyi commented 17 hours ago

Hello everyone and thanks in advance !

I have a test named: test.only("TC-0003-Verify that user can import new HTML Creative Template (300x250)", async ({ page }) => {

And I have a path configuration to be: snapshotPathTemplate: "{testFileDir}/../snaphots/{projectName}/{testFileName}/{testName}/{arg}{ext}"

By using this approach Playwright generates: /snaphots/regression-chrome/creativeTemplates.spec.ts/TC-0003-Verify-that-user-can-import-new-HTML-Creative-Template-300x250-/banner.png

I do not want to have a long scenario name in the snapshot path: "TC-0003-Verify-that-user-can-import-new-HTML-Creative-Template-300x250-"

Can I somehow cut the name to be: "TC-0003" or can I override it somewhere ?

Thanks a lot !

dgozman commented 16 hours ago

This issue tracker is reserved for bug reports and feature requests.

For anything else, such as questions or getting help, please see:

DmytroNebelskyi commented 16 hours ago

This issue tracker is reserved for bug reports and feature requests.

For anything else, such as questions or getting help, please see:

But when I was opening ticket there was "Questions", why u closed ?