[java][grid]: Set test name to video file name in dynamic grid by VietND96 · Pull Request #13907 · SeleniumHQ/selenium (original) (raw)

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

[java][grid]: Set test name to video file name in dynamic grid

Motivation and Context

This is based on the support of Metadata in tests. When running test with dynamic grid, by adding metadata to your tests, the video file name will extract the value of capability se:name and then set to output the video file name.

For example, in Python binding:

from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium import webdriver

options = ChromeOptions() options.set_capability('se:recordVideo', True) options.set_capability('se:screenResolution', '1920x1080') options.set_capability('se:name', 'test_visit_basic_auth_secured_page (ChromeTests)') driver = webdriver.Remote(options=options, command_executor="http://localhost:4444") driver.get("https://selenium.dev") driver.quit()

After test executed, under /assets you can see the video file name under /<sessionId>/test_visit_basic_auth_secured_page_ChromeTests.mp4

File name will be trimmed to 255 characters to avoid long file names. Moreover, space character will be replaced by _ and only characters alphabets, numbers, - (hyphen), _ (underscore) are retained in the file name.

Types of changes

Checklist


Type

enhancement


Description


Changes walkthrough

Relevant files
Enhancement DockerSessionFactory.javaRefactor Env Vars Handling and Set Video File Name from Test Name java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java Refactored environment variable setting into separate methods for clarity. Added capability to set video file name based on the se:name capability in session request. Video file name sanitization and truncation logic added. +41/-16
Configuration changes misc.xmlUpdate Project JDK Version in IDE Configuration .idea/misc.xml Updated project JDK version from 11 to 17 in IDE configuration. +2/-2

PR-Agent usage:
Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions