testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

path pattern placeholder ${TEST} - cannot be applied to the recorded video.

Open fmancardi opened this issue 2 years ago • 5 comments

What is your Scenario?

I want to create videos (or screenshot) where the filename will contain the testcase name. I create one js file for each test case.

I'm providing this config

"pathPattern": "${DATE}_${TIME}/${TEST}/${RUN_ID}/${USERAGENT}/${FILE_INDEX}.mp4"

What is the Current behavior?

This is the message I got

The "${TEST}" path pattern placeholder cannot be applied to the recorded video. The placeholder was replaced with an empty string.

file is pathname: C:\development\test-automation\end-to-end\artifacts\videos\2022-08-26_09-34-57\Chrome_104.0.5112.102_Windows_10\1.mp4

What is the Expected behavior?

C:\development\test-automation\end-to-end\artifacts\videos\2022-08-26_09-34-57\PPT-8309-Forn-PopupExport-campi\Chrome_104.0.5112.102_Windows_10\1.mp4

What is your public website URL? (or attach your complete example)

does not matter

What is your TestCafe test code?

does not matter

Your complete configuration file

{ "selectorTimeout":2000, "skipJsErrors":true, "screenshots":{ "takeOnFails":true }, "videoOptions":{ "singleFile":true, "failedOnly":false, "pathPattern": "${DATE}_${TIME}/${TEST}/${RUN_ID}/${USERAGENT}/${FILE_INDEX}.mp4" } }

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

use the provide config file, then run the test with option to record video

TestCafe version

1.20.0

Node.js version

v18.4.0

Command-line arguments

testcafe 'chrome --start-fullscreen' --video artifacts/videos --test-meta WKFSTATUS=ready,7.0=yes --cfg=at-7.0.json ./test/product-tree/PT.99.Framework/PT.99.03.Master-data/PT.99.03.Fornitori/System.Feature.Acceptance/PPT-8309-Forn-PopupExport-campi.js

Browser name(s) and version(s)

No response

Platform(s) and version(s)

windows 11

Other

No response

fmancardi avatar Aug 26 '22 07:08 fmancardi

Hi @fmancardi,

This happens because you use the singleFile option. In this case, all your tests are recorded in one file. Thus, we cannot determine what exact name that we should put in the pattern. That is why, you do not see the desired behavior, and you get a warning: image

Aleksey28 avatar Aug 29 '22 11:08 Aleksey28

OK, thanks a lot, I'm sorry for the misundertanding

fmancardi avatar Aug 29 '22 13:08 fmancardi

Confirmed, it worked with this .testcaferc.json -> "singleFile":false,

{
  "selectorTimeout":2000,
  "skipJsErrors":true,
  "screenshots":{
    "takeOnFails":true
  },
  "videoOptions":{
    "singleFile":false,
    "failedOnly":false,
    "pathPattern": "${DATE}_${TIME}/${TEST}/${RUN_ID}/${USERAGENT}/${FILE_INDEX}.mp4"
  }
}

I suggest to use a different (clearer IMHO) warning message like:

{$TEST} can not be used if you configure "singleFile":true,

fmancardi avatar Aug 29 '22 18:08 fmancardi

Thank you for the suggestion. We will add warnings if singleFile is true and will update this thread once this happens.

Aleksey28 avatar Aug 30 '22 08:08 Aleksey28

Thanks a lot!

fmancardi avatar Aug 30 '22 09:08 fmancardi

Release v3.0.1-rc.1 addresses this.

github-actions[bot] avatar Jun 28 '23 09:06 github-actions[bot]

Release v3.0.1 addresses this.

github-actions[bot] avatar Jun 29 '23 11:06 github-actions[bot]