diff --git a/serenity-core/src/main/java/net/thucydides/core/webdriver/capabilities/W3CCapabilities.java b/serenity-core/src/main/java/net/thucydides/core/webdriver/capabilities/W3CCapabilities.java index ff444aa482..3c90966029 100644 --- a/serenity-core/src/main/java/net/thucydides/core/webdriver/capabilities/W3CCapabilities.java +++ b/serenity-core/src/main/java/net/thucydides/core/webdriver/capabilities/W3CCapabilities.java @@ -30,9 +30,11 @@ public class W3CCapabilities { private final EnvironmentVariables environmentVariables; - private static final Logger LOGGER = LoggerFactory.getLogger(W3CCapabilities.class); private String prefix; - private final Set STRING_CONFIG_PROPERTIES = new HashSet<>(Arrays.asList("platformName","platformVersion")); + + private static final Logger LOGGER = LoggerFactory.getLogger(W3CCapabilities.class); + private static final Set STRING_CONFIG_PROPERTIES = new HashSet<>(Arrays.asList("platformName","platformVersion")); + private static final List BASE_PROPERTIES = Arrays.asList("browserName", "browserVersion", "platformName"); public W3CCapabilities(EnvironmentVariables environmentVariables) { this.environmentVariables = environmentVariables; @@ -42,8 +44,6 @@ public static W3CCapabilities definedIn(EnvironmentVariables environmentVariable return new W3CCapabilities(environmentVariables); } - private final List BASE_PROPERTIES = Arrays.asList("browserName", "browserVersion", "platformName"); - public W3CCapabilities withPrefix(String prefix) { this.prefix = prefix; return this; @@ -142,7 +142,7 @@ private void addCapabilityValue(Config config, DesiredCapabilities capabilities, if (STRING_CONFIG_PROPERTIES.contains(fieldName)) { capabilities.setPlatform(Platform.fromString(value.unwrapped().toString())); } else { - capabilities.setCapability(fieldName, asObject(value)); + capabilities.setCapability(stripQuotesFrom(fieldName), asObject(value)); } } diff --git a/serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromALocalPropertiesFile.java b/serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromAPropertiesFile.java similarity index 74% rename from serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromALocalPropertiesFile.java rename to serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromAPropertiesFile.java index 51f12b8d32..8f75c14b23 100644 --- a/serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromALocalPropertiesFile.java +++ b/serenity-core/src/test/java/net/thucydides/core/util/WhenLoadingPreferencesFromAPropertiesFile.java @@ -1,7 +1,6 @@ package net.thucydides.core.util; import net.thucydides.core.environment.MockEnvironmentVariables; -import net.thucydides.core.environment.SystemEnvironmentVariables; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -12,35 +11,37 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; -public class WhenLoadingPreferencesFromALocalPropertiesFile { +public class WhenLoadingPreferencesFromAPropertiesFile { - Logger LOGGER = LoggerFactory.getLogger(WhenLoadingPreferencesFromALocalPropertiesFile.class); + Logger LOGGER = LoggerFactory.getLogger(WhenLoadingPreferencesFromAPropertiesFile.class); @Rule public ExtendedTemporaryFolder temporaryFolder = new ExtendedTemporaryFolder(); File homeDirectory; File thucydidesPropertiesFile; - EnvironmentVariables environmentVariables; - PropertiesFileLocalPreferences localPreferences; + Map environmentVariables; + PropertiesLocalPreferences localPreferences; @Before public void setupDirectories() throws IOException { - environmentVariables = new MockEnvironmentVariables(); - localPreferences = new PropertiesFileLocalPreferences(environmentVariables); + environmentVariables = new HashMap<>(); + localPreferences = new PropertiesLocalPreferences(environmentVariables); homeDirectory = temporaryFolder.newFolder(); localPreferences.setHomeDirectory(homeDirectory); } @Test - public void the_default_preferences_directory_is_the_users_home_directory() throws Exception { - PropertiesFileLocalPreferences localPreferences = new PropertiesFileLocalPreferences(environmentVariables); + public void the_default_preferences_directory_is_the_users_home_directory() { + PropertiesLocalPreferences localPreferences = new PropertiesLocalPreferences(environmentVariables); String homeDirectory = System.getProperty("user.home"); @@ -55,7 +56,7 @@ public void should_load_property_values_from_local_preferences() throws Exceptio localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("webdriver.driver"), is("opera")); + assertThat(environmentVariables.get("webdriver.driver"), is("opera")); } @Test @@ -66,19 +67,19 @@ public void home_properties_should_override_classpath_properties() throws Except localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("test.property"), is("reset")); + assertThat(environmentVariables.get("test.property"), is("reset")); } @Test public void local_preferences_should_not_override_system_preferences() throws Exception { writeToPropertiesFile("webdriver.driver = opera"); - environmentVariables.setProperty("webdriver.driver", "iexplorer"); + environmentVariables.put("webdriver.driver", "iexplorer"); localPreferences.setHomeDirectory(homeDirectory); localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("webdriver.driver"), is("iexplorer")); + assertThat(environmentVariables.get("webdriver.driver"), is("iexplorer")); } @Test @@ -91,7 +92,7 @@ public void should_load_preferences_from_a_designated_properties_file_if_specifi localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("webdriver.driver"), is("safari")); + assertThat(environmentVariables.get("webdriver.driver"), is("safari")); System.clearProperty("properties"); } @@ -106,7 +107,7 @@ public void should_load_preferences_from_a_designated_properties_filepath_if_spe localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("webdriver.driver"), is("safari")); + assertThat(environmentVariables.get("webdriver.driver"), is("safari")); System.clearProperty("properties"); } @@ -120,7 +121,7 @@ public void should_ignore_preferences_if_specified_file_does_not_exist() throws localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("webdriver.driver"), is(nullValue())); + assertThat(environmentVariables.get("webdriver.driver"), is(nullValue())); System.clearProperty("properties"); @@ -143,7 +144,7 @@ public void should_load_property_values_from_typesafe_config() throws Exception localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("serenity.logging"), is("VERBOSE")); + assertThat(environmentVariables.get("serenity.logging"), is("VERBOSE")); } @Test @@ -152,23 +153,9 @@ public void should_load_arbitrary_property_values_from_typesafe_config() throws localPreferences.loadPreferences(); - assertThat(environmentVariables.getProperty("environment.uat"), is("uat-server")); + assertThat(environmentVariables.get("environment.uat"), is("uat-server")); } - - @Test - public void users_can_define_optional_custom_properties() { - - // WHEN - environmentVariables.setProperty("env","QA"); - - // THEN - assertThat(environmentVariables.optionalProperty("env").isPresent(), is(true)); - - // BUT - assertThat(environmentVariables.optionalProperty("undefined").isPresent(), is(false)); - - } - + @SuppressWarnings("static-access") private String writeToPropertiesFileCalled(String filename, String... lines) throws IOException, InterruptedException { thucydidesPropertiesFile = new File(homeDirectory, filename); diff --git a/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenConvertingW3CPropertiesToChromeOptions.java b/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenConvertingW3CPropertiesToChromeOptions.java index 431d2c59fe..9e791b6e3a 100644 --- a/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenConvertingW3CPropertiesToChromeOptions.java +++ b/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenConvertingW3CPropertiesToChromeOptions.java @@ -30,7 +30,7 @@ class WhenConvertingW3CPropertiesToChromeOptions { private static EnvironmentVariables from(String testConfig) { Path configFilepath = new File(Resources.getResource(testConfig).getPath()).toPath(); - return SystemEnvironmentVariables.createEnvironmentVariables(configFilepath, new SystemEnvironmentVariables()); + return SystemEnvironmentVariables.createEnvironmentVariables(configFilepath); } @DisplayName("If no webdriver section is present, use a standard ChromeOptions object") diff --git a/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenSettingW3CProperties.java b/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenSettingW3CProperties.java index f2f5852e72..cff15cc6c7 100644 --- a/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenSettingW3CProperties.java +++ b/serenity-core/src/test/java/net/thucydides/core/webdriver/capabilities/WhenSettingW3CProperties.java @@ -31,7 +31,9 @@ private static EnvironmentVariables from(String testConfig) { @Test public void shouldReadW3COptionsFromConfFile() { EnvironmentVariables environmentVariables = from("sample-conf-files/simple.conf"); - DesiredCapabilities caps = W3CCapabilities.definedIn(environmentVariables).withPrefix("webdriver.capabilities").asDesiredCapabilities(); + DesiredCapabilities caps = W3CCapabilities.definedIn(environmentVariables) + .withPrefix("webdriver.capabilities") + .asDesiredCapabilities(); assertThat(caps.getBrowserName()).isEqualTo("Chrome"); assertThat(caps.getBrowserVersion()).isEqualTo("103.0"); diff --git a/serenity-jira-plugin/src/main/java/net/serenitybdd/plugins/jira/service/SystemPropertiesJIRAConfiguration.java b/serenity-jira-plugin/src/main/java/net/serenitybdd/plugins/jira/service/SystemPropertiesJIRAConfiguration.java index 0f26ecf33c..e4938a8ed4 100644 --- a/serenity-jira-plugin/src/main/java/net/serenitybdd/plugins/jira/service/SystemPropertiesJIRAConfiguration.java +++ b/serenity-jira-plugin/src/main/java/net/serenitybdd/plugins/jira/service/SystemPropertiesJIRAConfiguration.java @@ -3,7 +3,7 @@ import net.serenitybdd.core.di.SerenityInfrastructure; import net.thucydides.core.util.EnvironmentVariables; import net.thucydides.core.util.LocalPreferences; -import net.thucydides.core.util.PropertiesFileLocalPreferences; +import net.thucydides.core.util.PropertiesLocalPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +38,7 @@ public SystemPropertiesJIRAConfiguration(EnvironmentVariables environmentVariabl private void updateEnvironmentVariablesFromPropertiesFiles(EnvironmentVariables environmentVariables) { - LocalPreferences localPreferences = new PropertiesFileLocalPreferences(environmentVariables); + LocalPreferences localPreferences = new PropertiesLocalPreferences(environmentVariables); try { localPreferences.loadPreferences(); } catch (IOException e) { diff --git a/serenity-model/src/main/java/net/thucydides/core/environment/MockEnvironmentVariables.java b/serenity-model/src/main/java/net/thucydides/core/environment/MockEnvironmentVariables.java index 592a807b30..8ab97986df 100644 --- a/serenity-model/src/main/java/net/thucydides/core/environment/MockEnvironmentVariables.java +++ b/serenity-model/src/main/java/net/thucydides/core/environment/MockEnvironmentVariables.java @@ -1,10 +1,8 @@ package net.thucydides.core.environment; import com.typesafe.config.Config; -import net.serenitybdd.core.collect.NewMap; import net.serenitybdd.core.environment.ConfiguredEnvironment; import net.thucydides.core.util.EnvironmentVariables; -import net.thucydides.core.util.PropertiesUtil; import org.apache.commons.lang3.StringUtils; import java.util.*; @@ -12,17 +10,17 @@ public class MockEnvironmentVariables implements EnvironmentVariables { - private Properties properties = new Properties(); + private Map properties = new HashMap<>(); private Map values = new HashMap<>(); public MockEnvironmentVariables() { - this.properties.setProperty("user.home", System.getProperty("user.home")); - this.properties.setProperty("feature.file.encoding", "UTF-8"); + this.properties.put("user.home", System.getProperty("user.home")); + this.properties.put("feature.file.encoding", "UTF-8"); if (localEnvironment().getProperty("phantomjs.binary.path") != null) { - this.properties.setProperty("phantomjs.binary.path", localEnvironment().getProperty("phantomjs.binary.path")); + this.properties.put("phantomjs.binary.path", localEnvironment().getProperty("phantomjs.binary.path")); } if (localEnvironment().getProperty("webdriver.chrome.driver") != null) { - this.properties.setProperty("webdriver.chrome.driver", localEnvironment().getProperty("webdriver.chrome.driver")); + this.properties.put("webdriver.chrome.driver", localEnvironment().getProperty("webdriver.chrome.driver")); } } @@ -30,17 +28,17 @@ private EnvironmentVariables localEnvironment() { return ConfiguredEnvironment.getEnvironmentVariables(); } - protected MockEnvironmentVariables(Properties properties) { - this.properties = PropertiesUtil.copyOf(properties); + protected MockEnvironmentVariables(Map properties) { + this.properties = new HashMap<>(properties); } - protected MockEnvironmentVariables(Properties properties, Map values) { - this.properties = PropertiesUtil.copyOf(properties); - this.values = NewMap.copyOf(values); + protected MockEnvironmentVariables(Map properties, Map values) { + this.properties = new HashMap<>(properties); + this.values = new HashMap<>(values); } public static EnvironmentVariables fromSystemEnvironment() { - return new MockEnvironmentVariables(SystemEnvironmentVariables.createEnvironmentVariables().getProperties()); + return new MockEnvironmentVariables(SystemEnvironmentVariables.createEnvironmentVariables().properties()); } public boolean propertySetIsEmpty() { @@ -65,9 +63,9 @@ public String getValue(Enum property, String defaultValue) { } public Integer getPropertyAsInteger(String name, Integer defaultValue) { - String value = (String) properties.get(name); + String value = properties.get(name); if (StringUtils.isNumeric(value)) { - return Integer.parseInt(properties.getProperty(name)); + return Integer.parseInt(properties.get(name)); } else { return defaultValue; } @@ -79,10 +77,10 @@ public Integer getPropertyAsInteger(Enum property, Integer defaultValue) { } public Boolean getPropertyAsBoolean(String name, boolean defaultValue) { - if (properties.getProperty(name) == null) { + if (properties.get(name) == null) { return defaultValue; } else { - return Boolean.parseBoolean(properties.getProperty(name, "false")); + return Boolean.parseBoolean(properties.get(name)); } } @@ -93,7 +91,7 @@ public Boolean getPropertyAsBoolean(Enum property, boolean defaultValue) { public String getProperty(String name) { if (name != null) { - return properties.getProperty(name); + return properties.get(name); } else { return null; } @@ -110,7 +108,7 @@ public String getProperty(Enum property) { } public String getProperty(String name, String defaultValue) { - return properties.getProperty(name, defaultValue); + return properties.get(name) == null ? defaultValue : properties.get(name); } @@ -119,7 +117,7 @@ public String getProperty(Enum property, String defaultValue) { } public void setProperty(String name, String value) { - properties.setProperty(name, value); + properties.put(name, value); } public void setProperties(Map newProperties) { @@ -144,7 +142,9 @@ public List getKeys() { @Override public Properties getProperties() { - return new Properties(properties); + Properties props = new Properties(); + props.putAll(properties); + return props; } @Override @@ -154,12 +154,12 @@ public Properties getPropertiesWithPrefix(String prefix) { @Override public boolean aValueIsDefinedFor(Enum property) { - return properties.contains(property.toString()); + return properties.containsKey(property.toString()); } @Override public boolean aValueIsDefinedFor(String property) { - return properties.contains(property); + return properties.containsKey(property); } @Override @@ -179,8 +179,8 @@ public Map asMap() { values.keySet().forEach( key -> environmentValues.put(key, values.get(key)) ); - properties.stringPropertyNames().forEach( - key -> environmentValues.put(key, properties.getProperty(key)) + properties.keySet().forEach( + key -> environmentValues.put(key, properties.get(key)) ); return environmentValues; } @@ -204,6 +204,11 @@ public Config getConfig(String prefix) { return EnvironmentVariables.super.getConfig(prefix); } + @Override + public Map properties() { + return properties; + } + public void setValue(String name, String value) { values.put(name, value); } diff --git a/serenity-model/src/main/java/net/thucydides/core/environment/SystemEnvironmentVariables.java b/serenity-model/src/main/java/net/thucydides/core/environment/SystemEnvironmentVariables.java index 93d2835aad..004c7ced31 100644 --- a/serenity-model/src/main/java/net/thucydides/core/environment/SystemEnvironmentVariables.java +++ b/serenity-model/src/main/java/net/thucydides/core/environment/SystemEnvironmentVariables.java @@ -5,7 +5,8 @@ import net.serenitybdd.core.collect.NewMap; import net.thucydides.core.util.EnvironmentVariables; import net.thucydides.core.util.LocalPreferences; -import net.thucydides.core.util.PropertiesFileLocalPreferences; +//import net.thucydides.core.util.PropertiesFileLocalPreferences; +import net.thucydides.core.util.PropertiesLocalPreferences; import org.apache.commons.lang3.StringUtils; import java.io.IOException; @@ -24,8 +25,9 @@ public class SystemEnvironmentVariables implements EnvironmentVariables { private final Map properties = new ConcurrentHashMap<>(); private final Map systemValues = new ConcurrentHashMap<>(); private volatile Config config; + private volatile boolean configLoaded = false; - private static final ThreadLocal LOADED_ENVIRONMENT_VARIABLES + private static final ThreadLocal LOADED_ENVIRONMENT_VARIABLES = ThreadLocal.withInitial(SystemEnvironmentVariables::createEnvironmentVariables); /** @@ -38,10 +40,16 @@ private SystemEnvironmentVariables(Map properties, Map environmentVariables.setProperty(key, environmentVariables.injectSystemPropertiesInto(value)) -// ); -// return environmentVariables; } public void setConfig(Config typesafeConfig) { this.config = typesafeConfig.resolve(); } + public SystemEnvironmentVariables(Map propertyValues, Map systemValues) { + this.systemValues.putAll(systemValues); + this.properties.putAll(propertyValues); + this.pristineProperties = NewMap.copyOf(propertyValues); + loadLocalConfig(); + } public SystemEnvironmentVariables(Properties systemProperties, Map systemValues) { this.systemValues.putAll(systemValues); @@ -79,7 +89,7 @@ public SystemEnvironmentVariables(Properties systemProperties, Map properties() { + return properties; + } + public static class EnvironmentUpdater { private final EnvironmentVariables environmentVariables; diff --git a/serenity-model/src/main/java/net/thucydides/core/util/EnvironmentVariables.java b/serenity-model/src/main/java/net/thucydides/core/util/EnvironmentVariables.java index 382723c25b..8d110806c8 100644 --- a/serenity-model/src/main/java/net/thucydides/core/util/EnvironmentVariables.java +++ b/serenity-model/src/main/java/net/thucydides/core/util/EnvironmentVariables.java @@ -93,4 +93,6 @@ default List activeEnvironments() { .omitEmptyStrings() .splitToList(getProperty("environment", "")); } + + Map properties(); } diff --git a/serenity-model/src/main/java/net/thucydides/core/util/LocalPreferences.java b/serenity-model/src/main/java/net/thucydides/core/util/LocalPreferences.java index 6971a7dc80..cd9df4c87c 100644 --- a/serenity-model/src/main/java/net/thucydides/core/util/LocalPreferences.java +++ b/serenity-model/src/main/java/net/thucydides/core/util/LocalPreferences.java @@ -1,5 +1,7 @@ package net.thucydides.core.util; +import com.typesafe.config.Config; + import java.io.IOException; /** @@ -7,4 +9,6 @@ */ public interface LocalPreferences { void loadPreferences() throws IOException; + + Config getConfig(); } diff --git a/serenity-model/src/main/java/net/thucydides/core/util/PropertiesFileLocalPreferences.java b/serenity-model/src/main/java/net/thucydides/core/util/PropertiesLocalPreferences.java similarity index 91% rename from serenity-model/src/main/java/net/thucydides/core/util/PropertiesFileLocalPreferences.java rename to serenity-model/src/main/java/net/thucydides/core/util/PropertiesLocalPreferences.java index cf783e4556..a9dce95f31 100644 --- a/serenity-model/src/main/java/net/thucydides/core/util/PropertiesFileLocalPreferences.java +++ b/serenity-model/src/main/java/net/thucydides/core/util/PropertiesLocalPreferences.java @@ -1,14 +1,10 @@ package net.thucydides.core.util; -import com.google.common.io.Resources; - import com.typesafe.config.Config; -import com.typesafe.config.ConfigException; import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigValue; import net.thucydides.core.ThucydidesSystemProperty; import net.thucydides.core.configuration.SystemPropertiesConfiguration; -import net.thucydides.core.requirements.SearchForFilesWithName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,14 +28,14 @@ * working directory override values on the classpath, and values in the home directory override values in the working * directory. Values can always be overridden on the command line. */ -public class PropertiesFileLocalPreferences implements LocalPreferences { +public class PropertiesLocalPreferences implements LocalPreferences { public static final String TYPESAFE_CONFIG_FILE = "serenity.conf"; private volatile File workingDirectory; private volatile File homeDirectory; private volatile File mavenModuleDirectory; - private final EnvironmentVariables environmentVariables; - private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesFileLocalPreferences.class); + private final Map currentProperties; + private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesLocalPreferences.class); private final Lock lock = new ReentrantLock(); @@ -48,8 +44,8 @@ public class PropertiesFileLocalPreferences implements LocalPreferences { */ private Path configurationFilePath; - public PropertiesFileLocalPreferences(EnvironmentVariables environmentVariables) { - this.environmentVariables = environmentVariables; + public PropertiesLocalPreferences(Map properties) { + this.currentProperties = properties; this.homeDirectory = new File(System.getProperty("user.home")); this.workingDirectory = new File(System.getProperty("user.dir")); final String mavenBuildDir = System.getProperty(SystemPropertiesConfiguration.PROJECT_BUILD_DIRECTORY); @@ -60,10 +56,13 @@ public PropertiesFileLocalPreferences(EnvironmentVariables environmentVariables) } } - public PropertiesFileLocalPreferences(EnvironmentVariables environmentVariables, Path configurationFilePath) { - this(environmentVariables); + public PropertiesLocalPreferences(Map currentProperties, Path configurationFilePath) { + this(currentProperties); this.configurationFilePath = configurationFilePath; + } + public PropertiesLocalPreferences(EnvironmentVariables environmentVariables) { + this(environmentVariables.properties()); } public File getHomeDirectory() { @@ -79,6 +78,11 @@ public void setHomeDirectory(File homeDirectory) { } } + @Override + public Config getConfig() { + return typesafeConfig(); + } + public void loadPreferences() throws IOException { lock.lock(); try { @@ -94,10 +98,6 @@ public void loadPreferences() throws IOException { preferencesIn(preferencesFileInHomeDirectory()), preferencesIn(legacyPreferencesFileInHomeDirectory()), preferencesInClasspath()); - - if (typesafeConfigFileExists()) { - environmentVariables.setConfig(typesafeConfig()); - } } finally { lock.unlock(); } @@ -191,11 +191,11 @@ private void setUndefinedSystemPropertiesFrom(Properties localPreferences) { while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); String localPropertyValue = localPreferences.getProperty(propertyName); - String currentPropertyValue = environmentVariables.getProperty(propertyName); + String currentPropertyValue = currentProperties.get(propertyName); if (isEmpty(currentPropertyValue) && isNotEmpty(localPropertyValue) && !propertyName.equals("//") && !propertyName.equals("#")) { LOGGER.trace("{} = {}",propertyName, localPropertyValue); - environmentVariables.setProperty(propertyName, localPropertyValue); + currentProperties.put(propertyName, localPropertyValue); } } } diff --git a/serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/OpenPageWithName.java b/serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/OpenPageWithName.java index 60e0dce31f..34206192a4 100644 --- a/serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/OpenPageWithName.java +++ b/serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/OpenPageWithName.java @@ -18,7 +18,6 @@ public OpenPageWithName() {} public OpenPageWithName(String pageName) { this.pageName = pageName; this.environmentVariables = SystemEnvironmentVariables.currentEnvironmentVariables(); - System.out.println(environmentVariables); } @Step("{0} opens the #pageName page")