Open mosadchiy opened 6 years ago
How I've done it is to change the CapabilitiesMatcher in the Hub - it's a short piece of Java code that decides where to send tests (and is changed by a configuration property).
Try dividing your selenium cluster into 2 sets of nodes - one set captures videos (which can only run one test at a time because its full-screen video capture), and another set which does not (but can run multiple tests at once).
When registering the video nodes add an extra capability which your CapabilitiesMatcher can look at, and then when starting your test add a DesiredCapabiility to say whether the test needs to record a video (which then determines where it runs).
How you determine when to set that attribute is up to you - I've found adding a retry scheme to unit tests to be one way to identify flaky tests (I think it was configured using a JUnit rule?). First run the test without recording a video, but if it fails record a video on the re-run. It might be possible to do something with an annotation as well?
As for your second question - whether the test passes/fails is up to the unit test framework, not Selenium. The hub never finds out the test results, because it doesn't really care about it :)
There isn't an API to delete videos, but it could be added - pull requests welcome.
On Wed, 15 Aug 2018, 12:58 mosadchiy, notifications@github.com wrote:
Hi @aimmac23 https://github.com/aimmac23 Thanks for you lib, it's very cool, could you please assist me in the following questions:
- Is there an opportunity to capture videos only for particular tests (for example with Video annotation) and not capture for others? (In my case we have a suite of 300+ UI tests and we wanna capture videos only for unstable ones)
- How to configure grid hub/node to save videos only for failed tests? Or maybe save all the videos regardless of results, but some API to delete unnecessary videos by sessionId?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aimmac23/selenium-video-node/issues/58, or mute the thread https://github.com/notifications/unsubscribe-auth/AGIin-PUylNqTXzQIA-Gtxf_uvEgreBMks5uRA0AgaJpZM4V9_bG .
Hi @aimmac23 Thanks for you lib, it's very cool, could you please assist me in the following questions: 1) Is there an opportunity to capture videos only for particular tests (for example with Video annotation) and not capture for others? (In my case we have a suite of 300+ UI tests and we wanna capture videos only for unstable ones) 2) How to configure grid hub/node to save videos only for failed tests? Or maybe save all the videos regardless of results, but some API to delete unnecessary videos by sessionId?