diff --git a/serenity-browserstack/src/main/java/net/serenitybdd/plugins/browserstack/BrowserStackCredentials.java b/serenity-browserstack/src/main/java/net/serenitybdd/plugins/browserstack/BrowserStackCredentials.java index 4cd36bfe4..c8604d355 100644 --- a/serenity-browserstack/src/main/java/net/serenitybdd/plugins/browserstack/BrowserStackCredentials.java +++ b/serenity-browserstack/src/main/java/net/serenitybdd/plugins/browserstack/BrowserStackCredentials.java @@ -23,12 +23,16 @@ public static BrowserStackCredentials from(EnvironmentVariables environmentVaria public String getUser() { String userDefinedInSerenityConf = EnvironmentSpecificConfiguration.from(environmentVariables).getOptionalProperty("browserstack.user").orElse(""); - return Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_USER")).orElse(userDefinedInSerenityConf); + Optional browserstackUser = Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_USER")); + Optional browserstackUsername = Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_USERNAME")); + return browserstackUser.orElse(browserstackUsername.orElse(userDefinedInSerenityConf)); } public String getAccessKey() { String keyDefinedInSerenityConf = EnvironmentSpecificConfiguration.from(environmentVariables).getOptionalProperty("browserstack.key").orElse(""); - return Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_KEY")).orElse(keyDefinedInSerenityConf); + Optional browserstackKey = Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_KEY")); + Optional browserstackAccessKey = Optional.ofNullable(environmentVariables.getValue("BROWSERSTACK_ACCESS_KEY")); + return browserstackKey.orElse(browserstackAccessKey.orElse(keyDefinedInSerenityConf)); } public boolean areDefined() {