Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Lower case browserName capabilities and bump package version.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndimer committed Jun 12, 2022
1 parent bacc202 commit bd51ce4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.cloudbeat</groupId>
<artifactId>cb-common</artifactId>
<version>0.12.7</version>
<version>0.12.8</version>
<build>
<plugins>
<plugin>
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/io/cloudbeat/common/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,19 @@ public static String[] stackTraceToStringArray(StackTraceElement[] stackTrace) {
public static DesiredCapabilities castMapToDesiredCapabilities(Map<String, String> capsMap) {
final DesiredCapabilities capabilities = new DesiredCapabilities();
// filter out "technologyName" capability as it's internal in CB and not part of Web Driver standard
capsMap.keySet().stream().filter((key) -> key != "technologyName").forEach((key) -> capabilities.setCapability(key, capsMap.get(key)));
capsMap.keySet().stream().filter((key) -> key != "technologyName").forEach((key) -> capabilities.setCapability(key, lowerCaseIfBrowserName(key, capsMap.get(key))));

return capabilities;
}

private static String lowerCaseIfBrowserName(String key, String value) {
// in some cases, CB engine can pass upper-cased browserName value
// make sure we always send a lower case value back to the web driver
if (key == "browserName" && value != null)
return value.toLowerCase();
return value;
}

public static DesiredCapabilities mergeUserAndCloudbeatCapabilities(DesiredCapabilities extraCapabilities) {
CbConfig config = CbTestContext.getInstance().getConfig();
final DesiredCapabilities capabilities = config != null && config.getCapabilities() != null ? castMapToDesiredCapabilities(config.getCapabilities()) : new DesiredCapabilities();
Expand Down

0 comments on commit bd51ce4

Please sign in to comment.