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
  • Loading branch information
VietND96 committed Jun 18, 2024
1 parent dec42aa commit d67abf6
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,21 @@ 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"));
if (videoName.isPresent()) {
envVars.put("SE_VIDEO_FILE_NAME", String.format("%s.mp4", videoName.get()));
} else {
Optional<String> testName =
ofNullable(getVideoFileName(sessionRequestCapabilities, "se:name"));
testName.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 d67abf6

Please sign in to comment.