Skip to content

Commit

Permalink
[java][grid]: video file name set independently in dynamic grid via s…
Browse files Browse the repository at this point in the history
…e:videoName (#14148)
  • Loading branch information
VietND96 authored Jun 19, 2024
1 parent 0f7386e commit a3fd839
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,16 @@ private Map<String, String> getVideoContainerEnvVars(
// Capabilities set to env vars with higher precedence
setCapsToEnvVars(sessionRequestCapabilities, envVars);
envVars.put("DISPLAY_CONTAINER_NAME", containerIp);
Optional<String> testName = ofNullable(getTestName(sessionRequestCapabilities));
testName.ifPresent(name -> envVars.put("SE_VIDEO_FILE_NAME", String.format("%s.mp4", name)));
Optional<String> videoName =
ofNullable(getVideoFileName(sessionRequestCapabilities, "se:videoName"))
.or(() -> ofNullable(getVideoFileName(sessionRequestCapabilities, "se:name")));
videoName.ifPresent(name -> envVars.put("SE_VIDEO_FILE_NAME", String.format("%s.mp4", name)));
return envVars;
}

private String getTestName(Capabilities sessionRequestCapabilities) {
Optional<Object> testName = ofNullable(sessionRequestCapabilities.getCapability("se:name"));
private String getVideoFileName(Capabilities sessionRequestCapabilities, String capabilityName) {
Optional<Object> testName =
ofNullable(sessionRequestCapabilities.getCapability(capabilityName));
if (testName.isPresent()) {
String name = testName.get().toString();
if (!name.isEmpty()) {
Expand Down

0 comments on commit a3fd839

Please sign in to comment.