Hi I have implemented Selenoid in my project and by default it names the video records like 'selenoid + browser session id.mp4', which I want to change to timestamp with scenario name.
Here's what I've done so far:
def rename_video_files(scenario, failed = false)
Dir.glob("/end-to-end-test/test-reports/video-logs") do
File.rename("#{page.driver.browser.session_id}.mp4",
"#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}_#{scenario
.name}#{failed ? '-FAILED' : ''}.mp4"
.gsub(/[^0-9A-Za-z.\-]/, '_'))
end
and after hook:
After('@ui') do |scenario|
rename_video = rename_video_files(scenario, failed = false)
logger.info "Recorded video name: #{rename_video}.mp4"
page.driver.quit
end
Tests pass, but the names of the video records stay unchanged.
New edit: Apparently selenoid when creates record, first names it 'selenoidxxxx.mp4' and after the test is finished renames it with session_id.mp4 by default. Therefore I'm not able to catch file name with session_id in the after step, because it's not renamed yet.