diff --git a/pom.xml b/pom.xml index 7ffa79a..bc3a99c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ anhtester.com anhtester-cucumber-testng - 1.7.0 + 1.7.1 TestAutomationFrameworkCucumberTestNG https://github.com/anhtester/AutomationFrameworkCucumberTestNG @@ -19,13 +19,13 @@ 3.12.1 7.15.0 - 27.0.0 + 28.0.0 5.7.5 - 4.17.0 + 4.18.1 7.9.0 5.6.3 - 1.9.21 - 3.0.0-beta1 + 1.9.21.1 + 2.23.0 2.25.0 2.12.0 1.0.0 @@ -40,15 +40,15 @@ 3.24.2 0.7.7.0 8.0.33 - 3.5.2 + 3.5.3 1.18.30 33.0.0-jre 1.9.7 1.6.2 - 1.16 + 1.17 2.16.1 2.1.0 - 7.0.1 + 7.1.0 diff --git a/src/main/java/com/anhtester/driver/TargetFactory.java b/src/main/java/com/anhtester/driver/TargetFactory.java index d0b8d9d..f2d1886 100644 --- a/src/main/java/com/anhtester/driver/TargetFactory.java +++ b/src/main/java/com/anhtester/driver/TargetFactory.java @@ -8,6 +8,7 @@ import com.anhtester.constants.FrameworkConstants; import com.anhtester.enums.Target; import com.anhtester.exceptions.TargetNotValidException; +import com.anhtester.helpers.PropertiesHelpers; import com.anhtester.utils.LogUtils; import org.openqa.selenium.MutableCapabilities; import org.openqa.selenium.WebDriver; @@ -21,10 +22,13 @@ public WebDriver createInstance() { Target target = Target.valueOf(FrameworkConstants.TARGET.toUpperCase()); WebDriver webdriver; + String browserName = System.getProperty("browser") != null ? System.getProperty("browser") + : FrameworkConstants.BROWSER; + switch (target) { case LOCAL: //Create new driver from Enum setup in BrowserFactory class - webdriver = BrowserFactory.valueOf(FrameworkConstants.BROWSER.toUpperCase()).createDriver(); + webdriver = BrowserFactory.valueOf(browserName.toUpperCase()).createDriver(); break; case REMOTE: //Create new driver on Cloud (Selenium Grid, Docker) from method below diff --git a/src/main/java/com/anhtester/helpers/PropertiesHelpers.java b/src/main/java/com/anhtester/helpers/PropertiesHelpers.java index f277e47..c5d1477 100644 --- a/src/main/java/com/anhtester/helpers/PropertiesHelpers.java +++ b/src/main/java/com/anhtester/helpers/PropertiesHelpers.java @@ -44,7 +44,7 @@ public static Properties loadAllFiles() { LogUtils.info(properties); return properties; } catch (IOException e) { - LogUtils.info("Warning !! Can not Load All File."); + LogUtils.warn("Warning !! Can not Load All File."); return new Properties(); } } @@ -61,6 +61,7 @@ public static void setFile(String relPropertiesFilePath) { properties.load(file); file.close(); } catch (Exception e) { + LogUtils.warn("Warning !! Can not set Properties file."); e.printStackTrace(); } } @@ -73,6 +74,7 @@ public static void setDefaultFile() { properties.load(file); file.close(); } catch (Exception e) { + LogUtils.warn("Warning !! Can not set Default Properties file."); e.printStackTrace(); } } @@ -81,13 +83,9 @@ public static String getValue(String key) { String keyValue = null; try { if (file == null && properties == null) { - properties = new Properties(); - linkFile = Helpers.getCurrentDir() + relPropertiesFilePathDefault; - file = new FileInputStream(linkFile); - properties.load(file); - file.close(); + setDefaultFile(); } - // Lấy giá trị từ file đã Set + keyValue = properties.getProperty(key); return LanguageUtils.convertCharset_ISO_8859_1_To_UTF8(keyValue); } catch (Exception e) { @@ -105,7 +103,7 @@ public static void setValue(String key, String keyValue) { file.close(); out = new FileOutputStream(Helpers.getCurrentDir() + relPropertiesFilePathDefault); } - //Ghi vào cùng file Prop với file lấy ra + out = new FileOutputStream(linkFile); System.out.println(linkFile); properties.setProperty(key, keyValue); diff --git a/src/main/java/com/anhtester/keywords/WebUI.java b/src/main/java/com/anhtester/keywords/WebUI.java index 9bebf46..be9149f 100644 --- a/src/main/java/com/anhtester/keywords/WebUI.java +++ b/src/main/java/com/anhtester/keywords/WebUI.java @@ -30,8 +30,8 @@ import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.devtools.DevTools; import org.openqa.selenium.devtools.HasDevTools; -import org.openqa.selenium.devtools.v121.network.Network; -import org.openqa.selenium.devtools.v121.network.model.Headers; +import org.openqa.selenium.devtools.v122.network.Network; +import org.openqa.selenium.devtools.v122.network.model.Headers; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.print.PrintOptions; import org.openqa.selenium.support.ui.ExpectedCondition; diff --git a/src/test/resources/config/config.properties b/src/test/resources/config/config.properties index fd7ce8a..efde669 100644 --- a/src/test/resources/config/config.properties +++ b/src/test/resources/config/config.properties @@ -14,7 +14,7 @@ BROWSER = chrome # target execution: local or remote TARGET = local # headless mode only for chrome or firefox and local execution -HEADLESS = true +HEADLESS = false URL_CRM = https://rise.fairsketch.com/signin # grid url and port REMOTE_URL = localhost