Skip to content
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

takeScreenshot ignores Path Pattern Placeholders #8086

Closed
vasilyevi opened this issue Nov 20, 2023 · 6 comments · Fixed by #8093
Closed

takeScreenshot ignores Path Pattern Placeholders #8086

vasilyevi opened this issue Nov 20, 2023 · 6 comments · Fixed by #8093
Assignees
Labels
FREQUENCY: level 1 Good first issue TYPE: enhancement The accepted proposal for future implementation.

Comments

@vasilyevi
Copy link

What is your Scenario?

Trying to specify name for the screenshot ad it ignores Path Pattern Placeholders specified in config file.

What is the Current behavior?

it ignores Path Pattern Placeholders specified in config file

What is the Expected behavior?

have to use Path Pattern Placeholders

What is the public URL of the test page? (attach your complete example)

N/A

What is your TestCafe test code?

await t.takeScreenshot("asd"); -> saves in ./artifacts/screenshots/asd.png

await t.takeScreenshot("${DATE}${TIME}/${TEST}/asd.png"); -> saves in ./artifacts/screenshots/${DATE}${TIME}/${TEST}/asd.png

Your complete configuration file

screenshots: {
path: "./artifacts/screenshots",
takeOnFails: true,
pathPattern: "${DATE}${TIME}/${TEST}/${FILE_INDEX}${QUARANTINE_ATTEMPT}.png",
thumbnails: false
},

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

N/A

TestCafe version

3.4.0

Node.js version

v18.17.0

Command-line arguments

npx testcafe

Browser name(s) and version(s)

No response

Platform(s) and version(s)

No response

Other

No response

@vasilyevi vasilyevi added the TYPE: bug The described behavior is considered as wrong (bug). label Nov 20, 2023
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 20, 2023
@PavelMor25
Copy link
Collaborator

Hello @vasilyevi,

When you add a path in the takeScreenshot method the argument overrides the relative path specified with the default or custom path patterns from your config file.

Please refer to the following help topic: t.takeScreenshot Method

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 21, 2023
@vasilyevi
Copy link
Author

I do understand that it overrides, but my need is to make a screenshot with a custom name, but save it exactly to the same folder. Is it supported? what's the reason if not?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 22, 2023
@PavelMor25
Copy link
Collaborator

TestCafe does not support this functionality, and we cannot classify it as a bug. We can accept this ticket as an enhancement request. However, we cannot specify estimates for when this feature may be implemented.

@PavelMor25 PavelMor25 reopened this Nov 23, 2023
@PavelMor25 PavelMor25 added TYPE: enhancement The accepted proposal for future implementation. FREQUENCY: level 1 Good first issue and removed STATE: Need response An issue that requires a response or attention from the team. TYPE: bug The described behavior is considered as wrong (bug). labels Nov 23, 2023
@vasilyevi
Copy link
Author

vasilyevi commented Nov 23, 2023

I definitely disagree, as one feature breaks the logic of another one. I surprised it wasn't reported previously. Anyway it's up to you

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 23, 2023
@PavelMor25 PavelMor25 removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 24, 2023
aleks-pro added a commit that referenced this issue Dec 22, 2023
<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->

## Purpose
Add new a parameter pathPattern to takeScreenshot method. It allows the
use of placeholders for specific takeScreenshot calls.

## Approach
I added a new parameter pathPattern to TakeScreenshotCommand .
In src/screenshots/capturer.js _capture method retrieve screenshotPath
from pathPattern.
Show warning if both path and pathPattern present.

## References
 close #8086

## Pre-Merge TODO
- [x] Write tests for your proposed changes
- [x] Make sure that existing tests do not fail

---------

Co-authored-by: aleks-pro <[email protected]>
Co-authored-by: Gene <[email protected]>
Co-authored-by: Bayheck <[email protected]>
Copy link

Release v3.5.0-rc.1 addresses this.

1 similar comment
Copy link

Release v3.5.0-rc.1 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 Good first issue TYPE: enhancement The accepted proposal for future implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants