Regarding recording videos using browser library, I would like to be able to give name and should be able to have videos for failures
Is your feature request related to a problem? Please describe.
Yes. Its related to "video record" in "New Context".
Describe the solution you'd like
i) It would be great if I can give Name to video recording when using "video record" in the "New Context". Because for example, if I run 100 tests and if there are 100 recordings it's hard to know which recording is for which test.
ii) It would be great if I have capability to record videos for a) All tests b) Only Pass c) Only Fail when using "video record" in the "New Context".
Because having videos only for failures will be a great feature for Browser Library which will i) save the disk space. ii) will be easy to know where exactly the test is failing and reduces time to debug and identify the reason for failure.
Describe alternatives you've considered
I tried "ScreenCapLibrary" and didnot like it all. There are downsides to which are a) installing "ScreenCapLibrary" installs many other libraries. b) it does not record in head less mode.
Additional context
I like what Browser Library has for video record but with the above two features, it would be a huge advantage for Browser Library. And thumbs up for ability to record videos in headless mode as well.
@allcontributors please add @gvr-kumar for ideas.
What you request is difficult from many reasons.
- Creating videos is decided in context level, but each page has a separate video. Also name is decided by underlying Playwright.
- Video is created when a page is closed, but there is not easy way to determine in Browser library in which test this page belongs to and has there been a failure.
- We can detect when Browser library fail, but we do not see is that failure by purpose or is something that library should react on.
But because this is a real problem and it would be handy to be able to provide custom name for the video. Perhaps it would be possible to create custom name for the video, perhaps adding running number at the end of the file, so that it is not overwritten. Would that help in your problem?
Hi Aaltat, sorry I am not able to follow. Could you please explain the below:
"But because this is a real problem and it would be handy to be able to provide custom name for the video. Perhaps it would be possible to create custom name for the video, perhaps adding running number at the end of the file, so that it is not overwritten. Would that help in your problem?"
As per my understanding, if at all I wanted to append the custom name and number to playwright generated naming where should I provide this custom name and number?
For example sample playwright generated video name : 03ac705268e997494448d2939f1f07ab.webm
Example it might be possible add test suite and test names as prefix for the filename. That would make finding the correct video more easily.
yes Aaltat, if you are saying that this (adding test suite name and testname as prefix for the filename) is possible and this feature will be available in the next browser library version then this is what I am looking for.
@aaltat @gvr-kumar
The Videos are always belonging to the Page, even though it is activated in the context.
When a New Page keyword is called, it does return the page_id and the video_path. So you could store/log that information directly at the beginning of the test case.
I think we also can easily improve that situation by logging the video path to the Open Page keyword and not just embedding the video.
New Page http://car.keyword-driven.de
> {'page_id': 'page=f78f41a9-1199-4943-bcae-ff6bb8a5c4a1', 'video_path': '/System/Volumes/Data/Source/MarketSquare/robotframework-browser/browser/video/85ed4af9eed682d1300d24a0695febcc.webm'}
Also @aaltat i think we can check what is the active page, when an error appears and put that page on a "list" of videos to keep. Therefore we can remove the video right away when a test is ending and there where no failure.