-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(test info): Add possibility to use test file name without extenson in snapshotPathTemplate #33420
base: main
Are you sure you want to change the base?
feat(test info): Add possibility to use test file name without extenson in snapshotPathTemplate #33420
Conversation
@microsoft-github-policy-service agree |
…on in snapshotPathTemplate
8b64b1a
to
5eb044d
Compare
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"3 flaky36783 passed, 630 skipped Merge workflow run. |
@@ -454,6 +454,7 @@ export class TestInfoImpl implements TestInfo { | |||
.replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '') | |||
.replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName()) | |||
.replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base) | |||
.replace(/\{(.)?testFileNameWithoutExtension\}/g, '$1' + parsedRelativeTestFilePath.base.replace('.spec', '').replace('.ts', '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also at least *.spec.js, *.spec.tsx, *.spec.jsx, and same with .test.
in the name.
@@ -79,6 +79,9 @@ test('tokens should expand property', async ({ runInlineTest }, testInfo) => { | |||
}, { | |||
name: 'testFileName', | |||
snapshotPathTemplate: '{testFileName}', | |||
}, { | |||
name: 'testFileNameWithoutExtension', | |||
snapshotPathTemplate: '{testFileNameWithoutExtension}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual expects need to be extended too to cover various use cases of the new token.
@SishaMafonov Do you plan to update this PR and get it merged, or should I close it? |
I apologize for the delay. I am planning to update it shortly. I apologize for inconvenience. |
IMO this is a use case of #33098, proving it has interest. |
Description
At the moment there is no possibility to get test file name without the extension for
snapshotPathTemplate
. Please refer to #24171Our stakeholders requested to have path to snapshots without test file extension because it is confusing for them. The best place to achieve that is PW framework repo rather than custom fixtures in the project.
What was done
snapshotPathTemplate
to cut out extension for the test file namesnapshotPathTemplate
Testing