getValues() {
return null;
}
-
+
@Override
public String getKey() {
- return this.paramName;
- }
-
- @Override
- public String toString() {
- return paramName + "=" + this.getValue();
+ return paramName;
}
@Override
@@ -91,38 +78,33 @@ public void refreshParameterValue() {
setValue();
}
- private void setValue() {
-
- String paramValue = System.getProperty(this.paramName);
- paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue;
- ;
-
- switch (this.name()) {
- case "BROWSER":
- paramValue = paramValue.toLowerCase();
- if (paramValue.equals("ie")) {
- paramValue = "internet explorer";
- }
- break;
- case "BROWSER_VERSION":
- break;
- case "SELENIUM_GRID":
- break;
- case "OS":
- break;
- case "BROWSER_OPTIONS":
- break;
- default:
- BFLogger.logError("Unknown RuntimeParameter = " + this.name());
- break;
+ protected void setValue() {
+ String paramValueFromSystem = System.getProperty(getKey());
+ this.paramValue = isSystemParameterEmpty(paramValueFromSystem) ? defaultValue : paramValueFromSystem;
+ }
+
+ private static Object convertToCorrectType(String value) {
+ if (!Objects.isNull(BooleanUtils.toBooleanObject(value))) {
+ return Boolean.valueOf(value);
}
- this.paramValue = paramValue;
+ if (NumberUtils.isNumber(value)) {
+ if (NumberUtils.isDigits(value)) {
+ return Integer.parseInt(value);
+ } else {
+ return Float.parseFloat(value);
+ }
+ }
+ return value;
}
- private boolean isSystemParameterEmpty(String systemParameterValue) {
- return (null == systemParameterValue || "".equals(systemParameterValue) || "null".equals(systemParameterValue));
+ private static boolean isSystemParameterEmpty(String paramValueFromSystem) {
+ return StringUtils.isEmpty(paramValueFromSystem) || "null".equals(paramValueFromSystem);
}
-}
+ @Override
+ public String toString() {
+ return getKey() + "=" + getValue();
+ }
+}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ColorsEnum.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ColorsEnum.java
index d242f2e7..1ae5403e 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ColorsEnum.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ColorsEnum.java
@@ -20,13 +20,13 @@ public enum ColorsEnum {
DARK_GREEN_BACKGROUND(33, 93, 49, 1),
YELLOW_COLUMN(255, 255, 0, 1);
- private String value;
- private int r;
- private int g;
- private int b;
- private int alpha;
+ private final String value;
+ private final int r;
+ private final int g;
+ private final int b;
+ private final int alpha;
- private ColorsEnum(int r, int g, int b, int alpha) {
+ ColorsEnum(int r, int g, int b, int alpha) {
this.r = r;
this.g = g;
this.b = b;
@@ -48,6 +48,7 @@ public String toString() {
/**
* @param css
+ * css
* @return {@code ColorsEnum} constant for given CSS value
*/
public static ColorsEnum forCss(String css) {
@@ -62,7 +63,6 @@ public static ColorsEnum forCss(String css) {
/**
* @return Red value in color
- * @author
*/
public int getR() {
return r;
@@ -70,7 +70,6 @@ public int getR() {
/**
* @return Green value in color
- * @author
*/
public int getG() {
return g;
@@ -78,7 +77,6 @@ public int getG() {
/**
* @return Blue value in color
- * @author
*/
public int getB() {
return b;
@@ -86,7 +84,6 @@ public int getB() {
/**
* @return Alpha value in color
- * @author
*/
public int getAlpha() {
return alpha;
@@ -94,7 +91,6 @@ public int getAlpha() {
/**
* @return {@link Color} for specified RGB values
- * @author
*/
public Color getColor() {
return new Color(r, g, b, alpha);
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/EdgesEnum.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/EdgesEnum.java
index 131832a8..ef2ec87f 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/EdgesEnum.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/EdgesEnum.java
@@ -2,11 +2,14 @@
public enum EdgesEnum {
- TOP("top"), BOTTOM("bottom"), LEFT("left"), RIGHT("right");
+ TOP("top"),
+ BOTTOM("bottom"),
+ LEFT("left"),
+ RIGHT("right");
- private String value;
+ private final String value;
- private EdgesEnum(String value) {
+ EdgesEnum(String value) {
this.value = value;
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/IResolutionList.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/IResolutionList.java
index 5a342216..1afd5f34 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/IResolutionList.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/IResolutionList.java
@@ -2,9 +2,9 @@
public interface IResolutionList {
- public int getWidth();
+ int getWidth();
- public int getHeight();
+ int getHeight();
- public String toString();
+ String toString();
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/SubUrl.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ISubUrl.java
similarity index 73%
rename from mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/SubUrl.java
rename to mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ISubUrl.java
index b14291fa..c65468e4 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/SubUrl.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ISubUrl.java
@@ -1,5 +1,5 @@
package com.capgemini.mrchecker.selenium.core.enums;
-public interface SubUrl {
+public interface ISubUrl {
String subURL();
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/PageSubURLsEnum.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/PageSubURLsEnum.java
index cf42d6b6..697dca1c 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/PageSubURLsEnum.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/PageSubURLsEnum.java
@@ -2,22 +2,22 @@
import com.capgemini.mrchecker.selenium.core.base.environment.GetEnvironmentParam;
-public enum PageSubURLsEnum implements SubUrl {
+public enum PageSubURLsEnum implements ISubUrl {
- WWW_FONT_URL {
+ WWW_FONT_URL("") {
@Override
public String subURL() {
return GetEnvironmentParam.WWW_FONT_URL.getValue();
}
},
- TOOLS_QA {
+ TOOLS_QA("") {
@Override
public String subURL() {
return GetEnvironmentParam.TOOLS_QA.getValue();
}
},
- WEB_SERVICE {
+ WEB_SERVICE("") {
@Override
public String subURL() {
return GetEnvironmentParam.WEB_SERVICE.getValue();
@@ -37,14 +37,10 @@ public String subURL() {
/*
* Sub urls are used as real locations in Bank test environment
*/
- private String subURL;
+ private final String subURL;
- private PageSubURLsEnum(String subURL) {
+ PageSubURLsEnum(String subURL) {
this.subURL = subURL;
- };
-
- private PageSubURLsEnum() {
-
}
@Override
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/RelatedPositionEnum.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/RelatedPositionEnum.java
index 86fec931..d0317290 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/RelatedPositionEnum.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/RelatedPositionEnum.java
@@ -1,5 +1,5 @@
package com.capgemini.mrchecker.selenium.core.enums;
public enum RelatedPositionEnum {
- ABOVE, BELOW, BEFORE, AFTER, INLINE;
+ ABOVE, BELOW, BEFORE, AFTER, INLINE
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ResolutionEnum.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ResolutionEnum.java
index fe3c32b7..25ea50e9 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ResolutionEnum.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/enums/ResolutionEnum.java
@@ -17,14 +17,12 @@ public enum ResolutionEnum implements IResolutionList {
iPhoneX(375, 812),
SamsungS9(360, 740),
Nexus9(1024, 768),
- AndroidOne(320, 569),
+ AndroidOne(320, 569);
- ;
+ private final int width;
+ private final int height;
- private int width;
- private int height;
-
- private ResolutionEnum(int width, int height) {
+ ResolutionEnum(int width, int height) {
this.width = width;
this.height = height;
}
@@ -39,6 +37,5 @@ public int getHeight() {
public String toString() {
return "Widht:" + getWidth() + " Height:" + getHeight();
-
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFComponentStateException.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFComponentStateException.java
index 8267d933..4491a9cc 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFComponentStateException.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFComponentStateException.java
@@ -4,8 +4,8 @@
public class BFComponentStateException extends AssertionError {
- private static final long serialVersionUID = 2453124693849726543L;
- private static String exceptionMessage;
+ private static final long serialVersionUID = 2453124693849726543L;
+ private static String exceptionMessage;
/**
* This exception should be thrown when component state is not as expected, which prevents performing certain
@@ -14,8 +14,11 @@ public class BFComponentStateException extends AssertionError {
* [Button]. Component is [disabled]."
*
* @param componentName
+ * component name
* @param action
+ * action
* @param actualState
+ * actual state
*/
public BFComponentStateException(String componentName, String action, String actualState) {
super(generateExceptionMessage(componentName, action, actualState));
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFElementNotFoundException.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFElementNotFoundException.java
index c85131e2..decc4631 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFElementNotFoundException.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFElementNotFoundException.java
@@ -1,13 +1,14 @@
package com.capgemini.mrchecker.selenium.core.exceptions;
-import org.openqa.selenium.*;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
import com.capgemini.mrchecker.test.core.logger.BFLogger;
public class BFElementNotFoundException extends NoSuchElementException {
- private static final long serialVersionUID = 6697212034783474583L;
- private static String messageText;
+ private static final long serialVersionUID = 6697212034783474583L;
+ private static String messageText;
/**
* {@code BFElementNotFoundException} is the class that can be thrown during any type of {@code findElement} and/or
@@ -16,7 +17,6 @@ public class BFElementNotFoundException extends NoSuchElementException {
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
*
- * @author
* @param by
* - {@link org.openqa.selenium.By}
*/
@@ -31,11 +31,10 @@ public BFElementNotFoundException(By by) {
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
*
- * @author
* @param by
* - {@link org.openqa.selenium.By}
* @param message
- * - any addition text in {@link #message} will be added at the beginning of log
+ * - any addition text in message will be added at the beginning of log
*/
public BFElementNotFoundException(By by, String message) {
this(by, message, false, -1);
@@ -48,7 +47,6 @@ public BFElementNotFoundException(By by, String message) {
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
*
- * @author
* @param by
* - {@link org.openqa.selenium.By}
* @param isTimeout
@@ -65,12 +63,11 @@ public BFElementNotFoundException(By by, boolean isTimeout) {
*
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
- *
- * @author
+ *
* @param by
* - {@link org.openqa.selenium.By}
* @param message
- * - any addition text in {@link #message} will be added at the beginning of log
+ * - any addition text in message will be added at the beginning of log
* @param isTimeout
* - use this when log must have information that element was not found by timeout
*/
@@ -85,13 +82,12 @@ public BFElementNotFoundException(By by, String message, boolean isTimeout) {
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
*
- * @author
* @param by
* - {@link org.openqa.selenium.By}
* @param isTimeout
* - use this when log must have information that element was not found by timeout
* @param timeoutValue
- * - used with {@link #isTimeout}. Give timeout in sec will be added in logs
+ * - used with isTimeout. Give timeout in sec will be added in logs
*/
public BFElementNotFoundException(By by, boolean isTimeout, int timeoutValue) {
this(by, "", isTimeout, timeoutValue);
@@ -104,15 +100,14 @@ public BFElementNotFoundException(By by, boolean isTimeout, int timeoutValue) {
* {@code BFElementNotFoundException} and its subclasses are unchecked exceptions. Given exception will be
* throw when element is not found directly or by timeout
*
- * @author
* @param by
* - {@link org.openqa.selenium.By}
* @param message
- * - any addition text in {@link #message} will be added at the beginning of log
+ * - any addition text in message will be added at the beginning of log
* @param isTimeout
* - use this when log must have information that element was not found by timeout
* @param timeoutValue
- * - used with {@link #isTimeout}. Give timeout in sec will be added in logs
+ * - used with isTimeout. Give timeout in sec will be added in logs
*/
public BFElementNotFoundException(By by, String message, boolean isTimeout, int timeoutValue) {
super(generateMessage(by, message, isTimeout, timeoutValue));
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFRobotInitilizationException.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFRobotInitilizationException.java
index efd63eba..85d9fb87 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFRobotInitilizationException.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFRobotInitilizationException.java
@@ -1,12 +1,11 @@
package com.capgemini.mrchecker.selenium.core.exceptions;
import java.awt.AWTException;
+import java.util.Arrays;
public class BFRobotInitilizationException extends RuntimeException {
public BFRobotInitilizationException(AWTException e) {
- System.err.println("Unable to execute Robot action. \n" + e.getStackTrace()
- .toString());
-
+ System.err.println("Unable to execute Robot action. \n" + Arrays.toString(e.getStackTrace()));
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFSeleniumGridNotConnectedException.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFSeleniumGridNotConnectedException.java
index 328e7a45..9efe6a30 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFSeleniumGridNotConnectedException.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFSeleniumGridNotConnectedException.java
@@ -6,13 +6,14 @@
public class BFSeleniumGridNotConnectedException extends AssertionError {
- private static final long serialVersionUID = -1217616251968376336L;
- private static String exceptionMessage;
+ private static final long serialVersionUID = -1217616251968376336L;
+ private static String exceptionMessage;
/**
* This exception should be thrown when connection to Selenium Grid is not possible
*
* @param e
+ * e
*/
public BFSeleniumGridNotConnectedException(WebDriverException e) {
super(generateExceptionMessage());
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFWaittingForBrowserWindowsException.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFWaittingForBrowserWindowsException.java
index b99fdb95..6bd58420 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFWaittingForBrowserWindowsException.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/exceptions/BFWaittingForBrowserWindowsException.java
@@ -4,8 +4,6 @@
/**
* Time out exection for multi windows in browser to open
- *
- * @author
*/
public class BFWaittingForBrowserWindowsException extends RuntimeException {
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtention.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtension.java
similarity index 73%
rename from mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtention.java
rename to mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtension.java
index 7e59a5af..986f9866 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtention.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverExtension.java
@@ -3,8 +3,8 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
-import java.util.function.Function;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
@@ -25,9 +25,9 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
@@ -36,12 +36,12 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TooltipElement;
import com.capgemini.mrchecker.test.core.logger.BFLogger;
-public class DriverExtention {
+public class DriverExtension {
private INewWebDriver driver;
- public DriverExtention(INewWebDriver driver) {
- this.setDriver(driver);
+ public DriverExtension(INewWebDriver driver) {
+ setDriver(driver);
}
public INewWebDriver getDriver() {
@@ -49,21 +49,17 @@ public INewWebDriver getDriver() {
}
public WebElement findElementQuietly(By by) {
- return this.findElementQuietly(null, by);
+ return findElementQuietly(null, by);
}
@SuppressWarnings("deprecation")
public WebElement findElementQuietly(WebElement elementToSearchIn, By by) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement element = null;
try {
- if (null == elementToSearchIn) {
- element = getDriver().findElement(by);
- } else {
- element = new NewRemoteWebElement(elementToSearchIn).findElement(by);
- }
+ element = Objects.isNull(elementToSearchIn) ? getDriver().findElement(by) : new NewRemoteWebElement(elementToSearchIn).findElement(by);
} catch (NoSuchElementException e) {
BFLogger.logError("Element [" + by.toString() + "] was not found in given element");
}
@@ -82,27 +78,21 @@ public WebElement findElementDynamic(final By by, int timeOut) throws BFElementN
public WebElement findElementDynamic(WebElement elementToSearchIn, By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
long startTime = System.currentTimeMillis();
- WebElement element;
- if (null == elementToSearchIn) {
- element = this.findElementDynamic(by);
- } else {
- element = findElementDynamicBasic(by, startTime);
- }
- return element;
+ return Objects.isNull(elementToSearchIn) ? findElementDynamic(by) : findElementDynamicBasic(by, startTime);
}
private WebElement findElementDynamicBasic(By by, long startTime) throws BFElementNotFoundException {
- int timeOut = BasePage.EXPLICITYWAITTIMER;
+ int timeOut = BasePage.EXPLICIT_WAIT_TIMER;
return this.findElementDynamicBasic(by, startTime, timeOut);
}
private WebElement findElementDynamicBasic(By by, long startTime, int timeOut) throws BFElementNotFoundException {
- WebElement element = null;
+ WebElement element;
WebDriverWait wait = webDriverWait(timeOut);
try {
- element = wait.until((Function super WebDriver, WebElement>) ExpectedConditions.presenceOfElementLocated(by));
+ element = wait.until(ExpectedConditions.presenceOfElementLocated(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, timeOut);
@@ -113,12 +103,12 @@ private WebElement findElementDynamicBasic(By by, long startTime, int timeOut) t
public List findElementsDynamic(By by, int timeOut) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
long startTime = System.currentTimeMillis();
WebDriverWait wait = webDriverWait(timeOut);
- List elements = new ArrayList();
+ List elements;
try {
- elements = wait.until((Function super WebDriver, List>) ExpectedConditions.presenceOfAllElementsLocatedBy(by));
+ elements = wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(by));
} catch (BFElementNotFoundException | TimeoutException e) {
throw new BFElementNotFoundException(by, true, timeOut);
}
@@ -130,28 +120,23 @@ public List findElementsDynamic(By by, int timeOut) throws BFElement
}
public List findElementsDynamic(By by) throws BFElementNotFoundException {
- return findElementsDynamic(by, BasePage.EXPLICITYWAITTIMER);
+ return findElementsDynamic(by, BasePage.EXPLICIT_WAIT_TIMER);
}
public WebElement waitForElement(final By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
long startTime = System.currentTimeMillis();
- WebElement element = null;
+ WebElement element;
- FluentWait wait = new FluentWait(driver);
+ FluentWait wait = new FluentWait<>(driver);
wait.pollingEvery(250, TimeUnit.MILLISECONDS);
wait.withTimeout(2, TimeUnit.MINUTES);
try {
- element = webDriverWait().until(new Function() {
- @Override
- public WebElement apply(WebDriver driver) {
- return driver.findElement(by);
- }
- });
+ element = webDriverWait().until(driver -> driver.findElement(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
- throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
+ throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICIT_WAIT_TIMER);
}
BFLogger.logTime(startTime, "waitForElement()", by.toString());
return element;
@@ -159,14 +144,14 @@ public WebElement apply(WebDriver driver) {
public WebElement waitUntilElementIsClickable(final By by) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
long startTime = System.currentTimeMillis();
- WebElement element = null;
+ WebElement element;
try {
- element = webDriverWait().until((Function super WebDriver, WebElement>) ExpectedConditions.elementToBeClickable(by));
+ element = webDriverWait().until(ExpectedConditions.elementToBeClickable(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
- throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
+ throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICIT_WAIT_TIMER);
}
BFLogger.logTime(startTime, "waitUntilElementIsClickable()", by.toString());
return element;
@@ -174,15 +159,15 @@ public WebElement waitUntilElementIsClickable(final By by) {
public WebElement waitForElementVisible(final By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
long startTime = System.currentTimeMillis();
- WebElement element = null;
+ WebElement element;
try {
- element = webDriverWait().until((Function super WebDriver, WebElement>) ExpectedConditions.visibilityOfElementLocated(by));
+ element = webDriverWait().until(ExpectedConditions.visibilityOfElementLocated(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
- throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
+ throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICIT_WAIT_TIMER);
}
BFLogger.logTime(startTime, "waitForElementVisible()", by.toString());
return element;
@@ -191,16 +176,12 @@ public WebElement waitForElementVisible(final By by) throws BFElementNotFoundExc
public void waitForPageLoaded() throws BFElementNotFoundException {
long startTime = System.currentTimeMillis();
final String jsVariable = "return document.readyState";
- ExpectedCondition expectation = new ExpectedCondition() {
- public Boolean apply(WebDriver driver) {
- return ((JavascriptExecutor) driver).executeScript(jsVariable)
- .equals("complete");
- }
- };
- int progressBarWaitTimer = BasePage.PROGRESSBARWAITTIMER;
+ ExpectedCondition expectation = driver -> ((JavascriptExecutor) driver).executeScript(jsVariable)
+ .equals("complete");
+ int progressBarWaitTimer = BasePage.PROGRESS_BAR_WAIT_TIMER;
WebDriverWait wait = webDriverWait(progressBarWaitTimer);
try {
- wait.until((Function super WebDriver, Boolean>) expectation);
+ wait.until(expectation);
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(By.cssSelector(jsVariable), isTimeout, progressBarWaitTimer);
@@ -213,7 +194,7 @@ private void setDriver(INewWebDriver driver) {
}
private WebDriverWait webDriverWait() {
- return webDriverWait(BasePage.EXPLICITYWAITTIMER);
+ return webDriverWait(BasePage.EXPLICIT_WAIT_TIMER);
}
private WebDriverWait webDriverWait(int timeOut) {
@@ -221,7 +202,7 @@ private WebDriverWait webDriverWait(int timeOut) {
}
static List convertWebElementList(List elementList) {
- List elementsList = new ArrayList();
+ List elementsList = new ArrayList<>();
for (WebElement element : elementList) {
elementsList.add(new NewRemoteWebElement(element));
}
@@ -230,156 +211,156 @@ static List convertWebElementList(List elementList) {
public Button elementButton(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new Button(selector);
}
public RadioButtonElement elementRadioButton(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new RadioButtonElement(selector);
}
public RadioButtonElement elementRadioButton(By selector, By childs) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new RadioButtonElement(selector, childs);
}
public RadioButtonElement elementRadioButton(By selector, By childs, List selectedAttributes) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new RadioButtonElement(selector, childs, selectedAttributes);
}
public InputTextElement elementInputText(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new InputTextElement(selector);
}
public DropdownListElement elementDropdownList(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new DropdownListElement(selector);
}
public ListElements elementList(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new ListElements(selector);
}
public CheckBox elementCheckbox(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new CheckBox(selector);
}
public CheckBox elementCheckbox(By selector, By childs) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new CheckBox(selector, childs);
}
public LabelElement elementLabel(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new LabelElement(selector);
}
public TabElement elementTab(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new TabElement(selector);
}
public TabElement elementTab(By selector, By childs) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new TabElement(selector, childs);
}
public TabElement elementTab(By selector, By childs, List selectedAttributes) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new TabElement(selector, childs, selectedAttributes);
}
public NavigationBarElement elementNavigationBar(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new NavigationBarElement(selector);
}
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new NavigationBarElement(selector, inputChildsSelector);
}
public TooltipElement elementTooltip(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new TooltipElement(selector);
}
public MenuElement elementMenu(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new MenuElement(selector);
}
public MenuElement elementMenu(By selector, By childsSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new MenuElement(selector, childsSelector);
}
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new MenuElement(selector, childsSelector, subMenuSelector);
}
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new MenuElement(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new HorizontalSliderElement(sliderContainerSelector);
}
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new HorizontalSliderElement(sliderContainerSelector, sliderSelector, valueSelector);
}
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step) {
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new HorizontalSliderElement(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
public IFrame elementIFrame(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new IFrame(selector);
}
-
+
public ImageElement elementImage(By selector) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
return new ImageElement(selector);
}
@@ -387,7 +368,7 @@ public void mouseRightClick(By selector) {
WebElement element = findElementDynamic(selector);
Actions action = new Actions(getDriver()).contextClick(element);
action.build()
- .perform();
+ .perform();
}
public void mouseLeftClick(By selector) {
@@ -401,8 +382,8 @@ public void mouseLeftClick(By selector) {
public void mouseLeftClick(WebElement element) {
new Actions(getDriver()).click(element)
- .build()
- .perform();
+ .build()
+ .perform();
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManager.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManager.java
index addc5198..3b34cf7e 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManager.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManager.java
@@ -1,16 +1,11 @@
package com.capgemini.mrchecker.selenium.core.newDrivers;
-import com.capgemini.mrchecker.selenium.core.base.properties.PropertiesSelenium;
-import com.capgemini.mrchecker.selenium.core.base.runtime.RuntimeParametersSelenium;
-import com.capgemini.mrchecker.selenium.core.enums.ResolutionEnum;
-import com.capgemini.mrchecker.selenium.core.exceptions.BFSeleniumGridNotConnectedException;
-import com.capgemini.mrchecker.selenium.core.utils.OperationsOnFiles;
-import com.capgemini.mrchecker.selenium.core.utils.ResolutionUtils;
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.github.bonigarcia.wdm.WebDriverManager;
-import io.github.bonigarcia.wdm.WebDriverManagerException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
@@ -26,73 +21,85 @@
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.concurrent.TimeUnit;
-
-public class DriverManager {
+import com.capgemini.mrchecker.selenium.core.base.properties.PropertiesSelenium;
+import com.capgemini.mrchecker.selenium.core.base.runtime.RuntimeParametersSelenium;
+import com.capgemini.mrchecker.selenium.core.enums.ResolutionEnum;
+import com.capgemini.mrchecker.selenium.core.exceptions.BFSeleniumGridNotConnectedException;
+import com.capgemini.mrchecker.selenium.core.utils.OperationsOnFiles;
+import com.capgemini.mrchecker.selenium.core.utils.ResolutionUtils;
+import com.capgemini.mrchecker.test.core.logger.BFLogger;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
- private static ThreadLocal drivers = new ThreadLocal();
+import io.github.bonigarcia.wdm.WebDriverManager;
+import io.github.bonigarcia.wdm.WebDriverManagerException;
+public class DriverManager {
+
+ private static final ThreadLocal drivers = new ThreadLocal<>();
+
// Setup default variables
- private static final ResolutionEnum DEFAULT_RESOLUTION = ResolutionEnum.w1200;
- private static final int IMPLICITYWAITTIMER = 2; // in seconds
- private static final String DOWNLOAD_DIR = System.getProperty("java.io.tmpdir");
- private static boolean driverDownloadedChrome = false;
- private static boolean driverDownloadedGecko = false;
- private static boolean driverDownloadedIE = false;
- private static boolean driverDownloadedEdge = false;
- private static boolean driverDownloadedOpera = false;
- private static PropertiesSelenium propertiesSelenium;
-
+ private static final ResolutionEnum DEFAULT_RESOLUTION = ResolutionEnum.w1200;
+ private static final int IMPLICITYWAITTIMER = 2; // in seconds
+ private static final String DOWNLOAD_DIR = System.getProperty("java.io.tmpdir");
+ private static boolean driverDownloadedChrome = false;
+ private static boolean driverDownloadedGecko = false;
+ private static boolean driverDownloadedIE = false;
+ private static boolean driverDownloadedEdge = false;
+ private static boolean driverDownloadedOpera = false;
+ private static PropertiesSelenium propertiesSelenium;
+
@Inject
public DriverManager(@Named("properties") PropertiesSelenium propertiesSelenium) {
-
- if (null == DriverManager.propertiesSelenium) {
+
+ if (Objects.isNull(DriverManager.propertiesSelenium)) {
DriverManager.propertiesSelenium = propertiesSelenium;
}
-
+
this.start();
}
-
+
public void start() {
DriverManager.getDriver();
}
-
+
public void stop() {
try {
closeDriver();
BFLogger.logDebug("Closing Driver in stop()");
BFLogger.logInfo(String.format("All clicks took %.2fs", 1.0 * NewRemoteWebElement.dropClickTimer() / 1000));
} catch (Exception e) {
+ // TODO: handle that
}
}
-
+
@Override
+ // TODO: handle that finalize should never been called - it's unreliable. Intoduce Autoclose()
protected void finalize() throws Throwable {
super.finalize();
try {
closeDriver();
BFLogger.logDebug("Closing Driver in finalize()");
} catch (Exception e) {
+ // TODO: handle that
}
-
+
}
-
+
public static INewWebDriver getDriver() {
INewWebDriver driver = drivers.get();
- if (driver == null) {
+ if (Objects.isNull(driver)) {
driver = createDriver();
drivers.set(driver);
- BFLogger.logDebug("driver:" + driver.toString());
+ BFLogger.logDebug("Driver:" + driver);
}
+
return driver;
}
-
+
public static void closeDriver() {
INewWebDriver driver = drivers.get();
- if (driver == null) {
+ if (Objects.isNull(driver)) {
BFLogger.logDebug("closeDriver() was called but there was no driver for this thread.");
} else {
try {
@@ -102,12 +109,11 @@ public static void closeDriver() {
BFLogger.logDebug("Ooops! Something went wrong while closing the driver: ");
e.printStackTrace();
} finally {
- driver = null;
drivers.remove();
}
}
}
-
+
/**
* Method sets desired 'driver' depends on chosen parameters
*/
@@ -115,25 +121,23 @@ private static INewWebDriver createDriver() {
BFLogger.logDebug("Creating new " + RuntimeParametersSelenium.BROWSER.toString() + " WebDriver.");
INewWebDriver driver;
String seleniumGridParameter = RuntimeParametersSelenium.SELENIUM_GRID.getValue();
- if (isEmpty(seleniumGridParameter)) {
- driver = setupBrowser();
- } else {
- driver = setupGrid();
- }
+
+ driver = isEmpty(seleniumGridParameter) ? setupBrowser() : setupGrid();
+
driver.manage()
.timeouts()
.implicitlyWait(DriverManager.IMPLICITYWAITTIMER, TimeUnit.SECONDS);
-
+
ResolutionUtils.setResolution(driver, DriverManager.DEFAULT_RESOLUTION);
NewRemoteWebElement.setClickTimer();
return driver;
}
-
+
private static boolean isEmpty(String seleniumGridParameter) {
return seleniumGridParameter == null || seleniumGridParameter.trim()
.isEmpty();
}
-
+
/**
* Method sets Selenium Grid
*/
@@ -144,7 +148,7 @@ private static INewWebDriver setupGrid() {
throw new BFSeleniumGridNotConnectedException(e);
}
}
-
+
/**
* Method sets desired 'driver' depends on chosen parameters
*/
@@ -167,9 +171,9 @@ private static INewWebDriver setupBrowser() {
throw new RuntimeException("Unable to setup [" + browser + "] browser. Browser not recognized.");
}
}
-
+
private enum Driver {
-
+
CHROME {
@Override
public INewWebDriver getDriver() {
@@ -177,7 +181,8 @@ public INewWebDriver getDriver() {
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedChrome) {
- if (!DriverManager.propertiesSelenium.getChromeDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getChromeDriverVersion()
+ .equals("")) {
System.setProperty("wdm.chromeDriverVersion", DriverManager.propertiesSelenium.getChromeDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(ChromeDriver.class);
@@ -186,15 +191,15 @@ public INewWebDriver getDriver() {
}
driverDownloadedChrome = true;
}
-
+
System.setProperty("webdriver.chrome.driver", browserPath);
- HashMap chromePrefs = new HashMap();
+ HashMap chromePrefs = new HashMap<>();
chromePrefs.put("download.default_directory", DOWNLOAD_DIR);
chromePrefs.put("profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
options.addArguments("--test-type");
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
@@ -203,30 +208,30 @@ public INewWebDriver getDriver() {
.isEmpty()) ? key : key + "=" + value;
options.addArguments(item);
});
-
+
// DesiredCapabilities cap = DesiredCapabilities.chrome();
// cap.setCapability(ChromeOptions.CAPABILITY, options);
-
- INewWebDriver driver = new NewChromeDriver(options);
- return driver;
+
+ return new NewChromeDriver(options);
}
-
+
},
EDGE {
@Override
public INewWebDriver getDriver() {
- //Microsoft WebDriver for Microsoft Edge from version 18 is a Windows Feature on Demand.
- //To install run the following in an elevated command prompt:
- //DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
- //For builds prior to 18, download the appropriate driver for your installed version of Microsoft Edge
- //Info: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/#downloads
+ // Microsoft WebDriver for Microsoft Edge from version 18 is a Windows Feature on Demand.
+ // To install run the following in an elevated command prompt:
+ // DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
+ // For builds prior to 18, download the appropriate driver for your installed version of Microsoft Edge
+ // Info: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/#downloads
boolean featureOnDemand = DriverManager.propertiesSelenium.getEdgeDriverFeatureOnDemandFlag();
- if(!featureOnDemand) {
+ if (!featureOnDemand) {
String browserPath = DriverManager.propertiesSelenium.getSeleniumEdge();
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedEdge) {
- if (!DriverManager.propertiesSelenium.getEdgeDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getEdgeDriverVersion()
+ .equals("")) {
System.setProperty("wdm.edgeVersion", DriverManager.propertiesSelenium.getEdgeDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(EdgeDriver.class);
@@ -237,19 +242,19 @@ public INewWebDriver getDriver() {
}
System.setProperty("webdriver.edge.driver", browserPath);
}
-
+
EdgeOptions options = new EdgeOptions();
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
BFLogger.logInfo("Browser option: " + key + " " + value);
options.setCapability(key, value);
});
-
+
return new NewEdgeDriver(options);
}
-
+
},
OPERA {
@Override
@@ -258,7 +263,8 @@ public INewWebDriver getDriver() {
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedOpera) {
- if (!DriverManager.propertiesSelenium.getOperaDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getOperaDriverVersion()
+ .equals("")) {
System.setProperty("wdm.operaDriverVersion", DriverManager.propertiesSelenium.getOperaDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(OperaDriver.class);
@@ -267,22 +273,22 @@ public INewWebDriver getDriver() {
}
driverDownloadedOpera = true;
}
-
+
System.setProperty("webdriver.opera.driver", browserPath);
- HashMap operaPrefs = new HashMap();
+ HashMap operaPrefs = new HashMap<>();
operaPrefs.put("download.default_directory", DOWNLOAD_DIR);
operaPrefs.put("profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1);
OperaOptions options = new OperaOptions();
options.setExperimentalOption("prefs", operaPrefs);
options.addArguments("--test-type");
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
BFLogger.logInfo("Browser option: " + key + " " + value);
options.setCapability(key, value);
});
-
+
return new NewOperaDriver(options);
}
},
@@ -293,7 +299,8 @@ public INewWebDriver getDriver() {
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedChrome) {
- if (!DriverManager.propertiesSelenium.getChromeDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getChromeDriverVersion()
+ .equals("")) {
System.setProperty("wdm.chromeDriverVersion", DriverManager.propertiesSelenium.getChromeDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(ChromeDriver.class);
@@ -303,14 +310,14 @@ public INewWebDriver getDriver() {
driverDownloadedChrome = true;
}
System.setProperty("webdriver.chrome.driver", browserPath);
- HashMap chromePrefs = new HashMap();
+ HashMap chromePrefs = new HashMap<>();
chromePrefs.put("download.default_directory", DOWNLOAD_DIR);
chromePrefs.put("profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
options.addArguments("headless");
options.addArguments("window-size=1200x600");
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
@@ -319,14 +326,13 @@ public INewWebDriver getDriver() {
.isEmpty()) ? key : key + "=" + value;
options.addArguments(item);
});
-
+
// DesiredCapabilities cap = DesiredCapabilities.chrome();
// cap.setCapability(ChromeOptions.CAPABILITY, options);
-
- INewWebDriver driver = new NewChromeDriver(options);
- return driver;
+
+ return new NewChromeDriver(options);
}
-
+
},
FIREFOX {
@Override
@@ -335,7 +341,8 @@ public INewWebDriver getDriver() {
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedGecko) {
- if (!DriverManager.propertiesSelenium.getGeckoDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getGeckoDriverVersion()
+ .equals("")) {
System.setProperty("wdm.geckoDriverVersion", DriverManager.propertiesSelenium.getGeckoDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(FirefoxDriver.class);
@@ -346,18 +353,18 @@ public INewWebDriver getDriver() {
}
System.setProperty("webdriver.gecko.driver", browserPath);
System.setProperty("webdriver.firefox.logfile", "logs\\firefox_logs.txt");
-
+
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("webdriver.firefox.marionette", true);
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.dir", DOWNLOAD_DIR);
profile.setPreference("browser.download.useDownloadDir", true);
-
+
profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"text/comma-separated-values, application/vnd.ms-excel, application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream");
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
-
+
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
@@ -365,7 +372,7 @@ public INewWebDriver getDriver() {
BFLogger.logInfo("Browser option: " + key + " " + value);
options.setCapability(key, value);
});
-
+
return new NewFirefoxDriver(options);
}
},
@@ -376,7 +383,8 @@ public INewWebDriver getDriver() {
boolean isDriverAutoUpdateActivated = DriverManager.propertiesSelenium.getDriverAutoUpdateFlag();
synchronized (this) {
if (isDriverAutoUpdateActivated && !driverDownloadedIE) {
- if (!DriverManager.propertiesSelenium.getInternetExplorerDriverVersion().equals("")) {
+ if (!DriverManager.propertiesSelenium.getInternetExplorerDriverVersion()
+ .equals("")) {
System.setProperty("wdm.internetExplorerDriverVersion", DriverManager.propertiesSelenium.getInternetExplorerDriverVersion());
}
downloadNewestOrGivenVersionOfWebDriver(InternetExplorerDriver.class);
@@ -387,22 +395,26 @@ public INewWebDriver getDriver() {
}
System.setProperty("webdriver.ie.driver", browserPath);
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
BFLogger.logInfo("Browser option: " + key + " " + value);
ieCapabilities.setCapability(key, value);
});
-
+
// Due to some issues with IE11 this line must be commented
// ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
// true);
return new NewInternetExplorerDriver(ieCapabilities);
}
-
+
},
SAFARI {
+ @Override
+ protected INewWebDriver getDriver() {
+ return null;
+ }
},
SELENIUMGRID {
@Override
@@ -411,7 +423,7 @@ public INewWebDriver getDriver() {
BFLogger.logDebug("Connecting to the selenium grid: " + SELENIUM_GRID_URL);
DesiredCapabilities capabilities = new DesiredCapabilities();
String operatingSystem = RuntimeParametersSelenium.OS.getValue();
-
+
// TODO add others os's
switch (operatingSystem) {
case "windows":
@@ -424,17 +436,17 @@ public INewWebDriver getDriver() {
capabilities.setPlatform(Platform.MAC);
break;
}
-
+
capabilities.setVersion(RuntimeParametersSelenium.BROWSER_VERSION.getValue());
capabilities.setBrowserName(RuntimeParametersSelenium.BROWSER.getValue());
-
+
// Set users browser options
RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
.forEach((key, value) -> {
BFLogger.logInfo("Browser option: " + key + " " + value);
capabilities.setCapability(key, value);
});
-
+
NewRemoteWebDriver newRemoteWebDriver = null;
try {
newRemoteWebDriver = new NewRemoteWebDriver(new URL(SELENIUM_GRID_URL), capabilities);
@@ -445,33 +457,30 @@ public INewWebDriver getDriver() {
return newRemoteWebDriver;
}
};
-
+
private static void downloadNewestOrGivenVersionOfWebDriver(Class webDriverType) {
-
+
String proxy = DriverManager.propertiesSelenium.getProxy();
String webDriversPath = DriverManager.propertiesSelenium.getWebDrivers();
try {
System.setProperty("wdm.targetPath", webDriversPath);
System.setProperty("wdm.useBetaVersions", "false");
-
+
WebDriverManager.getInstance(webDriverType)
.proxy(proxy)
.setup();
- BFLogger.logDebug("Downloaded version of driver=" + WebDriverManager.getInstance(webDriverType).getDownloadedVersion());
-
+ BFLogger.logDebug("Downloaded version of driver=" + WebDriverManager.getInstance(webDriverType)
+ .getDownloadedVersion());
+
} catch (WebDriverManagerException e) {
BFLogger.logInfo("Unable to download driver automatically. "
+ "Please try to set up the proxy in properties file. "
+ "If you want to download them manually, go to the "
+ "http://www.seleniumhq.org/projects/webdriver/ site.");
}
-
- }
-
- public INewWebDriver getDriver() {
- return null;
+
}
-
+
+ protected abstract INewWebDriver getDriver();
}
-
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/INewWebDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/INewWebDriver.java
index 9bbd4248..8983d83f 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/INewWebDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/INewWebDriver.java
@@ -15,9 +15,9 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
@@ -65,7 +65,9 @@ public interface INewWebDriver extends WebDriver {
* e.g. PopUp
*
* @param elementToSearchIn
+ * elementToSearchIn
* @param searchedBySelector
+ * searchedBySelector
* @return found WebElement or null if couldn't find
*/
WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector);
@@ -75,6 +77,7 @@ public interface INewWebDriver extends WebDriver {
* e.g. PopUp
*
* @param searchedBySelector
+ * searchedBySelector
* @return found WebElement or null if couldn't find
*/
WebElement findElementQuietly(By searchedBySelector);
@@ -85,11 +88,11 @@ public interface INewWebDriver extends WebDriver {
*
* @param by
* selector
- * @param timeout
+ * @param timeOut
* - maximum time to wait for search WebElement
* @return found WebElement object
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException BFElementNotFoundException
*/
WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException;
@@ -100,8 +103,8 @@ public interface INewWebDriver extends WebDriver {
* @param by
* selector
* @return found WebElement object
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException BFElementNotFoundException
*/
WebElement findElementDynamic(By by) throws BFElementNotFoundException;
@@ -111,47 +114,51 @@ public interface INewWebDriver extends WebDriver {
*
* @param by
* selector
- * @param timeout
+ * @param timeOut
* - maximum time to wait for search WebElement
* @return found WebElement object
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
List findElementDynamics(By by, int timeOut);
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found then throw an exception (PiAtElementNotLoadedException)
*
* @param by
* selector
* @return found WebElement object
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
List findElementDynamics(By by);
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be enabled to action. If element after
+ * Waits {@link {@link BasePage#EXPLICIT_WAIT_TIMER}} seconds until an element will be enabled to action. If element
+ * after
* this time will not be enabled then throw an exception (BFElementNotFoundException)
*
- * @param by
+ * @param selector
* selector
* @return WebElement object ready to click
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
WebElement waitForElement(final By selector);
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link {@link BasePage#EXPLICIT_WAIT_TIMER}} seconds until an element will be clickable. If element will
+ * not be
* clickable then throw an exception (BFElementNotFoundException)
*
- * @param by
+ * @param selector
* selector
* @return WebElement object ready to click
* @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
WebElement waitUntilElementIsClickable(final By selector);
@@ -159,19 +166,19 @@ public interface INewWebDriver extends WebDriver {
* Waits for element located by selector to become visible. Throws exception if element is not visible after
* specified time period.
*
- * @param by
+ * @param selector
* selector
* @return found WebElement object
- * @author
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
WebElement waitForElementVisible(final By selector);
/**
* This function force browser (especially usable for IE ) to wait till page is loaded
- *
- * @param driver
+ *
* @throws BFElementNotFoundException
+ * BFElementNotFoundException
*/
void waitForPageLoaded();
@@ -181,15 +188,15 @@ public interface INewWebDriver extends WebDriver {
Button elementButton(final By selector);
/**
- * Operations on Radion Buttons
+ * Operations on Radio Buttons
*/
RadioButtonElement elementRadioButton(final By selector);
RadioButtonElement elementRadioButton(final By selector, final By inputChildsSelector);
RadioButtonElement elementRadioButton(final By selector,
- final By inputChildsSelector,
- final List listSelectedAttributes);
+ final By inputChildsSelector,
+ final List listSelectedAttributes);
/**
* Operations on Input Text field
@@ -215,7 +222,7 @@ RadioButtonElement elementRadioButton(final By selector,
* Operations on Label
*/
LabelElement elementLabel(final By selector);
-
+
/**
* Operations on image
*/
@@ -252,18 +259,15 @@ RadioButtonElement elementRadioButton(final By selector,
MenuElement elementMenu(final By selector, final By childsSelector, final By subMenuSelector);
MenuElement elementMenu(final By selector,
- final By childsSelector,
- final By subMenuSelector,
- final By childsSubMenuSelector);
-
- /**
- * Operations on Horizontal Slider
- */
+ final By childsSelector,
+ final By subMenuSelector,
+ final By childsSubMenuSelector);
/**
* Returns horizontal slider object for given container selector.
*
* @param sliderContainerSelector
+ * sliderContainerSelector
* @return HorizontalSliderElement
* @see HorizontalSliderElement
*/
@@ -273,8 +277,11 @@ MenuElement elementMenu(final By selector,
* Returns horizontal slider object for given container selector, slider selector and value selector.
*
* @param sliderContainerSelector
+ * sliderContainerSelector
* @param sliderSelector
+ * sliderSelector
* @param valueSelector
+ * valueSelector
* @return HorizontalSliderElement
* @see HorizontalSliderElement
*/
@@ -285,20 +292,26 @@ MenuElement elementMenu(final By selector,
* Also a range of possible steps and step's size should be defined to perform operations/
*
* @param sliderContainerSelector
+ * sliderContainerSelector
* @param sliderSelector
+ * sliderSelector
* @param valueSelector
+ * valueSelector
* @param minRange
+ * minRange
* @param maxRange
+ * maxRange
* @param step
+ * step
* @return HorizontalSliderElement
* @see HorizontalSliderElement
*/
HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step);
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step);
/**
* Operations on iFrame
@@ -314,13 +327,14 @@ HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector
* Performs left mouse click on specific element
*
* @param selector
+ * selector
*/
void mouseLeftClick(final By selector);
/**
* Performs left mouse click on specific element
*
- * @param web
+ * @param element
* element
*/
void mouseLeftClick(WebElement element);
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewChromeDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewChromeDriver.java
index 26070125..3356fa87 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewChromeDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewChromeDriver.java
@@ -18,9 +18,9 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
@@ -31,15 +31,16 @@
public final class NewChromeDriver extends ChromeDriver implements INewWebDriver {
- private DriverExtention driverExtention;
+ private final DriverExtension driverExtension;
+ // TODO: class instance passed outside before it's been created
public NewChromeDriver() {
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
public NewChromeDriver(ChromeOptions options) {
super(options);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
@Override
@@ -54,8 +55,8 @@ protected ExecuteMethod getExecuteMethod() {
@Override
public List findElements(By by) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
/**
@@ -65,8 +66,8 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- WebElement elementFromDriver = null;
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ WebElement elementFromDriver;
try {
elementFromDriver = super.findElement(by);
} catch (NoSuchElementException e) {
@@ -81,7 +82,7 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
*
* @param by
* selector
- * @param timeout
+ * @param timeOut
* - maximum time to wait for search WebElement
* @return found WebElement object
* @author
@@ -89,7 +90,7 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
*/
@Override
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
/**
@@ -104,7 +105,7 @@ public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoun
*/
@Override
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
/**
@@ -120,11 +121,12 @@ public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
*/
@Override
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
* @param by
@@ -134,21 +136,21 @@ public List findElementDynamics(By by, int timeOut) {
*/
@Override
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
@Override
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
@Override
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER}} seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
* @param selector
@@ -159,7 +161,7 @@ public WebElement waitForElementVisible(final By selector) {
*/
@Override
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
/**
@@ -172,7 +174,7 @@ public WebElement waitUntilElementIsClickable(final By selector) {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
/**
@@ -184,159 +186,159 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
+ driverExtension.waitForPageLoaded();
}
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
@Override
public RadioButtonElement elementRadioButton(By selector,
- By inputChildsSelector,
- List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ By inputChildsSelector,
+ List listSelectedAttributes) {
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
public ImageElement elementImage(By selector) {
- return driverExtention.elementImage(selector);
+ return driverExtension.elementImage(selector);
}
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step) {
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
public static void main(String[] args) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewEdgeDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewEdgeDriver.java
index 652135be..bff3f48e 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewEdgeDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewEdgeDriver.java
@@ -1,9 +1,8 @@
package com.capgemini.mrchecker.selenium.core.newDrivers;
-import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.*;
-import com.capgemini.mrchecker.test.core.BaseTest;
+import java.math.BigDecimal;
+import java.util.List;
+
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
@@ -12,27 +11,42 @@
import org.openqa.selenium.remote.ExecuteMethod;
import org.openqa.selenium.remote.RemoteExecuteMethod;
-import java.math.BigDecimal;
-import java.util.List;
+import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.Button;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.CheckBox;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.RadioButtonElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TabElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TooltipElement;
+import com.capgemini.mrchecker.test.core.BaseTest;
public class NewEdgeDriver extends EdgeDriver implements INewWebDriver {
-
- private DriverExtention driverExtention;
-
+
+ private DriverExtension driverExtension;
+
public NewEdgeDriver() {
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
-
+
public NewEdgeDriver(EdgeOptions options) {
super(options);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
-
+
@Override
protected ExecuteMethod getExecuteMethod() {
return new RemoteExecuteMethod(this);
}
-
+
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamics(By)()}
*/
@@ -40,10 +54,10 @@ protected ExecuteMethod getExecuteMethod() {
@Override
public List findElements(By by) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
-
+
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}
*/
@@ -51,7 +65,7 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
@@ -60,87 +74,95 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
}
return new NewRemoteWebElement(elementFromDriver);
}
-
+
/**
* Try to find by dynamic element - will wait given by user an amount of seconds for an element to load on page. If
* element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
- * @param timeout - maximum time to wait for search WebElement
+ * @param by
+ * selector
+ * @param timeOut
+ * - maximum time to wait for search WebElement
* @return found WebElement object
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
-
+
/**
* Try to find by dynamic element - will wait given by user an amount of seconds for an element to load on page. If
* element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
+ * @param by
+ * selector
* @return found WebElement object
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
-
+
/**
* Try to find by dynamic List of elements - will wait given by user an amount of seconds for an element to load on
* page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
- * @param timeOut - maximum time to wait for search WebElement
+ * @param by
+ * selector
+ * @param timeOut
+ * - maximum time to wait for search WebElement
* @return found WebElement object
* @author
*/
@Override
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
-
+
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
+ * @param by
+ * selector
* @return found WebElement object
* @author
*/
@Override
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
-
+
@Override
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
-
+
@Override
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
-
+
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER} seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
- * @param selector selector
+ * @param selector
+ * selector
* @return WebElement object ready to click
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
-
+
/**
* Try to find element quietly - NoSuchElementException will not be thrown. Use it to check if element exist on page
* e.g. PopUp
@@ -151,9 +173,9 @@ public WebElement waitUntilElementIsClickable(final By selector) {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
-
+
/**
* Try to find element quietly - NoSuchElementException will not be thrown. Use it to check if element exist on page
* e.g. PopUp
@@ -163,132 +185,132 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
-
+
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
-
+ driverExtension.waitForPageLoaded();
+
}
-
+
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector,
By inputChildsSelector,
List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
-
+
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
-
+
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
-
+
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
-
+
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
-
+
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
public ImageElement elementImage(By selector) {
- return driverExtention.elementImage(selector);
+ return driverExtension.elementImage(selector);
}
-
+
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
-
+
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
-
+
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
-
+
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
-
+
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
-
+
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
-
+
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
final By sliderSelector,
@@ -296,26 +318,26 @@ public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerS
final BigDecimal minRange,
final BigDecimal maxRange,
final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
-
+
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
-
+
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
-
+
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
-
+
public static void main(String[] args) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewFirefoxDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewFirefoxDriver.java
index c35731ed..e3a18a5b 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewFirefoxDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewFirefoxDriver.java
@@ -16,9 +16,9 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
@@ -28,15 +28,15 @@
public final class NewFirefoxDriver extends FirefoxDriver implements INewWebDriver {
- private DriverExtention driverExtention;
+ private DriverExtension driverExtension;
public NewFirefoxDriver() {
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
public NewFirefoxDriver(FirefoxOptions options) {
super(options);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
/**
@@ -46,8 +46,8 @@ public NewFirefoxDriver(FirefoxOptions options) {
@Override
public List findElements(By by) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
/**
@@ -57,7 +57,7 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
@@ -77,7 +77,7 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
/**
@@ -89,7 +89,7 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
/**
@@ -105,7 +105,7 @@ public WebElement findElementQuietly(By searchedBySelector) {
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
/**
@@ -119,7 +119,7 @@ public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoun
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
/**
@@ -134,11 +134,12 @@ public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
* @author
*/
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
* @param by
@@ -147,19 +148,19 @@ public List findElementDynamics(By by, int timeOut) {
* @author
*/
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER} seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
* @param selector
@@ -169,153 +170,153 @@ public WebElement waitForElementVisible(final By selector) {
* @throws BFElementNotFoundException
*/
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
+ driverExtension.waitForPageLoaded();
}
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
@Override
public RadioButtonElement elementRadioButton(By selector,
- By inputChildsSelector,
- List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ By inputChildsSelector,
+ List listSelectedAttributes) {
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
public ImageElement elementImage(By selector) {
- return driverExtention.elementImage(selector);
+ return driverExtension.elementImage(selector);
}
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step) {
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewInternetExplorerDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewInternetExplorerDriver.java
index 672a74db..2f48ef44 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewInternetExplorerDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewInternetExplorerDriver.java
@@ -16,9 +16,9 @@
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
@@ -28,11 +28,11 @@
public final class NewInternetExplorerDriver extends InternetExplorerDriver implements INewWebDriver {
- private DriverExtention driverExtention;
+ private DriverExtension driverExtension;
public NewInternetExplorerDriver(Capabilities capabilities) {
super(capabilities);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
/**
@@ -42,8 +42,8 @@ public NewInternetExplorerDriver(Capabilities capabilities) {
@Override
public List findElements(By by) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
/**
@@ -53,7 +53,7 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
@@ -73,7 +73,7 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
/**
@@ -85,7 +85,7 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
/**
@@ -101,7 +101,7 @@ public WebElement findElementQuietly(By searchedBySelector) {
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
/**
@@ -115,7 +115,7 @@ public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoun
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
/**
@@ -130,11 +130,12 @@ public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
* @author
*/
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
* @param by
@@ -143,15 +144,15 @@ public List findElementDynamics(By by, int timeOut) {
* @author
*/
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER} seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
* @param selector
@@ -161,158 +162,158 @@ public WebElement waitForElement(final By selector) {
* @throws BFElementNotFoundException
*/
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
+ driverExtension.waitForPageLoaded();
}
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
@Override
public RadioButtonElement elementRadioButton(By selector,
- By inputChildsSelector,
- List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ By inputChildsSelector,
+ List listSelectedAttributes) {
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
public ImageElement elementImage(By selector) {
- return driverExtention.elementImage(selector);
+ return driverExtension.elementImage(selector);
}
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step) {
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewOperaDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewOperaDriver.java
index 2337f39c..ae88f260 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewOperaDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewOperaDriver.java
@@ -1,9 +1,8 @@
package com.capgemini.mrchecker.selenium.core.newDrivers;
-import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.*;
-import com.capgemini.mrchecker.test.core.BaseTest;
+import java.math.BigDecimal;
+import java.util.List;
+
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
@@ -12,27 +11,42 @@
import org.openqa.selenium.remote.ExecuteMethod;
import org.openqa.selenium.remote.RemoteExecuteMethod;
-import java.math.BigDecimal;
-import java.util.List;
+import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.Button;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.CheckBox;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.RadioButtonElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TabElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TooltipElement;
+import com.capgemini.mrchecker.test.core.BaseTest;
public class NewOperaDriver extends OperaDriver implements INewWebDriver {
-
- private DriverExtention driverExtention;
-
+
+ private DriverExtension driverExtension;
+
public NewOperaDriver() {
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
-
+
public NewOperaDriver(OperaOptions options) {
super(options);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
-
+
@Override
protected ExecuteMethod getExecuteMethod() {
return new RemoteExecuteMethod(this);
}
-
+
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamics(By)()}
*/
@@ -40,10 +54,10 @@ protected ExecuteMethod getExecuteMethod() {
@Override
public List findElements(By by) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
-
+
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}
*/
@@ -51,7 +65,7 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
@@ -60,87 +74,95 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
}
return new NewRemoteWebElement(elementFromDriver);
}
-
+
/**
* Try to find by dynamic element - will wait given by user an amount of seconds for an element to load on page. If
* element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
- * @param timeout - maximum time to wait for search WebElement
+ * @param by
+ * selector
+ * @param timeOut
+ * - maximum time to wait for search WebElement
* @return found WebElement object
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
-
+
/**
* Try to find by dynamic element - will wait given by user an amount of seconds for an element to load on page. If
* element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
+ * @param by
+ * selector
* @return found WebElement object
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
-
+
/**
* Try to find by dynamic List of elements - will wait given by user an amount of seconds for an element to load on
* page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
- * @param timeOut - maximum time to wait for search WebElement
+ * @param by
+ * selector
+ * @param timeOut
+ * - maximum time to wait for search WebElement
* @return found WebElement object
* @author
*/
@Override
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
-
+
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
- * @param by selector
+ * @param by
+ * selector
* @return found WebElement object
* @author
*/
@Override
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
-
+
@Override
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
-
+
@Override
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
-
+
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER} seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
- * @param selector selector
+ * @param selector
+ * selector
* @return WebElement object ready to click
* @throws BFElementNotFoundException
* @author
*/
@Override
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
-
+
/**
* Try to find element quietly - NoSuchElementException will not be thrown. Use it to check if element exist on page
* e.g. PopUp
@@ -151,9 +173,9 @@ public WebElement waitUntilElementIsClickable(final By selector) {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
-
+
/**
* Try to find element quietly - NoSuchElementException will not be thrown. Use it to check if element exist on page
* e.g. PopUp
@@ -163,132 +185,132 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
-
+
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
-
+ driverExtension.waitForPageLoaded();
+
}
-
+
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
-
+
@Override
public RadioButtonElement elementRadioButton(By selector,
By inputChildsSelector,
List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
-
+
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
-
+
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
-
+
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
-
+
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
-
+
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
public ImageElement elementImage(By selector) {
- return driverExtention.elementImage(selector);
+ return driverExtension.elementImage(selector);
}
-
+
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
-
+
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
-
+
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
-
+
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
-
+
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
-
+
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
-
+
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
-
+
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
-
+
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
final By sliderSelector,
@@ -296,26 +318,26 @@ public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerS
final BigDecimal minRange,
final BigDecimal maxRange,
final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
-
+
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
-
+
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
-
+
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
-
+
public static void main(String[] args) {
BaseTest.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewRemoteWebDriver.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewRemoteWebDriver.java
index d22eec1e..b8c93768 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewRemoteWebDriver.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/NewRemoteWebDriver.java
@@ -5,7 +5,6 @@
import java.util.List;
import java.util.Map;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.*;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.SessionNotCreatedException;
@@ -19,14 +18,28 @@
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
import com.capgemini.mrchecker.selenium.core.exceptions.BFInitializationException;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.Button;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.CheckBox;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.HorizontalSliderElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.IFrame;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ImageElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.LabelElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.ListElements;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.RadioButtonElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TabElement;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TooltipElement;
public final class NewRemoteWebDriver extends RemoteWebDriver implements INewWebDriver {
- private DriverExtention driverExtention;
+ private DriverExtension driverExtension;
public NewRemoteWebDriver(URL url, DesiredCapabilities capabilities) {
super(url, capabilities);
- driverExtention = new DriverExtention(this);
+ driverExtension = new DriverExtension(this);
}
@Override
@@ -57,8 +70,8 @@ protected ExecuteMethod getExecuteMethod() {
@Override
public List findElements(By by) {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
- return DriverExtention.convertWebElementList(super.findElements(by));
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
+ return DriverExtension.convertWebElementList(super.findElements(by));
}
/**
@@ -68,7 +81,7 @@ public List findElements(By by) {
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BasePage.getAnalytics()
- .sendMethodEvent(BasePage.analitycsCategoryName);
+ .sendMethodEvent(BasePage.ANALYTICS_CATEGORY_NAME);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
@@ -88,7 +101,7 @@ public WebElement findElement(By by) throws BFElementNotFoundException {
*/
@Override
public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBySelector) {
- return driverExtention.findElementQuietly(elementToSearchIn, searchedBySelector);
+ return driverExtension.findElementQuietly(elementToSearchIn, searchedBySelector);
}
/**
@@ -100,7 +113,7 @@ public WebElement findElementQuietly(WebElement elementToSearchIn, By searchedBy
*/
@Override
public WebElement findElementQuietly(By searchedBySelector) {
- return driverExtention.findElementQuietly(null, searchedBySelector);
+ return driverExtension.findElementQuietly(null, searchedBySelector);
}
/**
@@ -109,14 +122,14 @@ public WebElement findElementQuietly(By searchedBySelector) {
*
* @param by
* selector
- * @param timeout
+ * @param timeOut
* - maximum time to wait for search WebElement
* @return found WebElement object
* @author
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by, timeOut);
+ return driverExtension.findElementDynamic(by, timeOut);
}
/**
@@ -130,7 +143,7 @@ public WebElement findElementDynamic(By by, int timeOut) throws BFElementNotFoun
* @throws BFElementNotFoundException
*/
public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
- return driverExtention.findElementDynamic(by);
+ return driverExtension.findElementDynamic(by);
}
/**
@@ -139,17 +152,18 @@ public WebElement findElementDynamic(By by) throws BFElementNotFoundException {
*
* @param by
* selector
- * @param timeout
+ * @param timeOut
* - maximum time to wait for search WebElement
* @return found WebElement object
* @author
*/
public List findElementDynamics(By by, int timeOut) {
- return driverExtention.findElementsDynamic(by, timeOut);
+ return driverExtension.findElementsDynamic(by, timeOut);
}
/**
- * Try to find by dynamic List of elements - will wait {@link BasePage.EXPLICITYWAITTIMER} seconds for an element to
+ * Try to find by dynamic List of elements - will wait {@link BasePage#EXPLICIT_WAIT_TIMER} seconds for an element
+ * to
* load on page. If element will not be found will throw an exception (PiAtElementNotLoadedException)
*
* @param by
@@ -158,19 +172,19 @@ public List findElementDynamics(By by, int timeOut) {
* @author
*/
public List findElementDynamics(By by) {
- return driverExtention.findElementsDynamic(by);
+ return driverExtension.findElementsDynamic(by);
}
public WebElement waitForElement(final By selector) {
- return driverExtention.waitForElement(selector);
+ return driverExtension.waitForElement(selector);
}
public WebElement waitForElementVisible(final By selector) {
- return driverExtention.waitForElementVisible(selector);
+ return driverExtension.waitForElementVisible(selector);
}
/**
- * Waits {@link BasePage.EXPLICITYWAITTIMER} seconds until an element will be clickable. If element will not be
+ * Waits {@link BasePage#EXPLICIT_WAIT_TIMER seconds until an element will be clickable. If element will not be
* clickable then throw an exception (BFElementNotFoundException)
*
* @param selector
@@ -181,152 +195,154 @@ public WebElement waitForElementVisible(final By selector) {
*/
@Override
public WebElement waitUntilElementIsClickable(final By selector) {
- return driverExtention.waitUntilElementIsClickable(selector);
+ return driverExtension.waitUntilElementIsClickable(selector);
}
@Override
public void waitForPageLoaded() {
- driverExtention.waitForPageLoaded();
+ driverExtension.waitForPageLoaded();
}
@Override
public Button elementButton(By selector) {
- return driverExtention.elementButton(selector);
+ return driverExtension.elementButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector) {
- return driverExtention.elementRadioButton(selector);
+ return driverExtension.elementRadioButton(selector);
}
@Override
public RadioButtonElement elementRadioButton(By selector, By inputChildsSelector) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector);
+ return driverExtension.elementRadioButton(selector, inputChildsSelector);
}
@Override
public RadioButtonElement elementRadioButton(By selector,
- By inputChildsSelector,
- List listSelectedAttributes) {
- return driverExtention.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
+ By inputChildsSelector,
+ List listSelectedAttributes) {
+ return driverExtension.elementRadioButton(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public InputTextElement elementInputText(By selector) {
- return driverExtention.elementInputText(selector);
+ return driverExtension.elementInputText(selector);
}
@Override
public DropdownListElement elementDropdownList(By selector) {
- return driverExtention.elementDropdownList(selector);
+ return driverExtension.elementDropdownList(selector);
}
@Override
public ListElements elementList(By selector) {
- return driverExtention.elementList(selector);
+ return driverExtension.elementList(selector);
}
@Override
public CheckBox elementCheckbox(By selector) {
- return driverExtention.elementCheckbox(selector);
+ return driverExtension.elementCheckbox(selector);
}
@Override
public LabelElement elementLabel(By selector) {
- return driverExtention.elementLabel(selector);
+ return driverExtension.elementLabel(selector);
}
-
+
@Override
- public ImageElement elementImage(By selector) { return driverExtention.elementImage(selector); }
-
+ public ImageElement elementImage(By selector) {
+ return driverExtension.elementImage(selector);
+ }
+
@Override
public TabElement elementTab(By selector) {
- return driverExtention.elementTab(selector);
+ return driverExtension.elementTab(selector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector) {
- return driverExtention.elementTab(selector, inputChildsSelector);
+ return driverExtension.elementTab(selector, inputChildsSelector);
}
@Override
public TabElement elementTab(By selector, By inputChildsSelector, List listSelectedAttributes) {
- return driverExtention.elementTab(selector, inputChildsSelector, listSelectedAttributes);
+ return driverExtension.elementTab(selector, inputChildsSelector, listSelectedAttributes);
}
@Override
public NavigationBarElement elementNavigationBar(By selector) {
- return driverExtention.elementNavigationBar(selector);
+ return driverExtension.elementNavigationBar(selector);
}
@Override
public NavigationBarElement elementNavigationBar(By selector, By inputChildsSelector) {
- return driverExtention.elementNavigationBar(selector, inputChildsSelector);
+ return driverExtension.elementNavigationBar(selector, inputChildsSelector);
}
@Override
public TooltipElement elementTooltip(By cssSelector) {
- return driverExtention.elementTooltip(cssSelector);
+ return driverExtension.elementTooltip(cssSelector);
}
@Override
public MenuElement elementMenu(By selector) {
- return driverExtention.elementMenu(selector);
+ return driverExtension.elementMenu(selector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector) {
- return driverExtention.elementMenu(selector, childsSelector);
+ return driverExtension.elementMenu(selector, childsSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector);
}
@Override
public MenuElement elementMenu(By selector, By childsSelector, By subMenuSelector, By childsSubMenuSelector) {
- return driverExtention.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
+ return driverExtension.elementMenu(selector, childsSelector, subMenuSelector, childsSubMenuSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector, final By sliderSelector, final By valueSelector) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector);
}
@Override
public HorizontalSliderElement elementHorizontalSlider(final By sliderContainerSelector,
- final By sliderSelector,
- final By valueSelector,
- final BigDecimal minRange,
- final BigDecimal maxRange,
- final BigDecimal step) {
- return driverExtention.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
+ final By sliderSelector,
+ final By valueSelector,
+ final BigDecimal minRange,
+ final BigDecimal maxRange,
+ final BigDecimal step) {
+ return driverExtension.elementHorizontalSlider(sliderContainerSelector, sliderSelector, valueSelector, minRange, maxRange, step);
}
@Override
public IFrame elementIFrame(By selector) {
- return driverExtention.elementIFrame(selector);
+ return driverExtension.elementIFrame(selector);
}
@Override
public void mouseRightClick(By selector) {
- driverExtention.mouseRightClick(selector);
+ driverExtension.mouseRightClick(selector);
}
@Override
public void mouseLeftClick(By selector) {
- driverExtention.mouseLeftClick(selector);
+ driverExtension.mouseLeftClick(selector);
}
@Override
public void mouseLeftClick(WebElement element) {
- driverExtention.mouseLeftClick(element);
+ driverExtension.mouseLeftClick(element);
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/BasicElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/BasicElement.java
index 205053fc..210b39a7 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/BasicElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/BasicElement.java
@@ -8,14 +8,14 @@
public abstract class BasicElement implements IBasicElement {
- private ElementType type;
- private By cssSelector;
+ private final ElementType type;
+ private By cssSelector;
public BasicElement(ElementType type, By cssSelector) {
this.type = type;
this.setCssSelector(cssSelector);
- this.load();
+ load();
}
@Override
@@ -25,14 +25,10 @@ public WebElement load() {
@Override
public String getElementTypeName() {
- return this.type.toString();
+ return type.toString();
}
public WebElement getElement() throws BFElementNotFoundException {
- return getElement(0);
- }
-
- public WebElement getElement(int timeOutInSec) throws BFElementNotFoundException {
return BasePage.getDriver()
.findElementDynamic(getCssSelector());
}
@@ -50,7 +46,7 @@ public String getText() {
}
public Boolean isDisplayed() {
- return BasePage.isElementDisplayed(this.getCssSelector());
+ return BasePage.isElementDisplayed(getCssSelector());
}
private By getCssSelector() {
@@ -60,5 +56,4 @@ private By getCssSelector() {
private void setCssSelector(By cssSelector) {
this.cssSelector = cssSelector;
}
-
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/Button.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/Button.java
index 31afc629..5166a4f9 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/Button.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/Button.java
@@ -14,5 +14,4 @@ public void click() {
ScrollUtils.scrollElementIntoView(getElement());
getElement().click();
}
-
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/CheckBox.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/CheckBox.java
index 754621d1..72b514af 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/CheckBox.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/CheckBox.java
@@ -1,90 +1,89 @@
package com.capgemini.mrchecker.selenium.core.newDrivers.elementType;
+import java.util.Arrays;
+import java.util.List;
+
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.capgemini.mrchecker.selenium.core.exceptions.BFComponentStateException;
import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
-import java.util.Arrays;
-import java.util.List;
-
public class CheckBox extends BasicElement {
private By inputChildsSelector;
- public CheckBox(By cssSelector)
/**
* @param cssSelector
* - selector of CheckBox element's set
**/
- {
+ public CheckBox(By cssSelector) {
this(cssSelector, By.cssSelector("input"));
}
+ /**
+ * @param cssSelector
+ * - selector of CheckBox element's set
+ * @param inputChildsSelector
+ * - selector of relative path from CheckBox element's set to basic input element
+ **/
public CheckBox(By cssSelector, By inputChildsSelector) {
- /**
- * @param cssSelector
- * - selector of CheckBox element's set
- * @param inputChildsSelector
- * - selector of relative path from CheckBox element's set to basic input element
- **/
super(ElementType.CHECKBOX, cssSelector);
setInputChildsSelector(inputChildsSelector);
}
public void setCheckBoxByIndex(int index) {
- this.setCheckBoxByIndexTo(index, true);
+ setCheckBoxByIndexTo(index, true);
}
public void setCheckBoxByValue(String value) {
- this.setCheckBoxByValueTo(value, true);
+ setCheckBoxByValueTo(value, true);
}
public void setCheckBoxByText(String text) {
- this.setCheckBoxByTextTo(text, true);
+ setCheckBoxByTextTo(text, true);
}
public void unsetCheckBoxByIndex(int index) {
- this.setCheckBoxByIndexTo(index, false);
+ setCheckBoxByIndexTo(index, false);
}
public void unsetCheckBoxByValue(String value) {
- this.setCheckBoxByValueTo(value, false);
+ setCheckBoxByValueTo(value, false);
}
public void unsetCheckBoxByText(String text) {
- this.setCheckBoxByTextTo(text, false);
+ setCheckBoxByTextTo(text, false);
}
public void setAllCheckBoxes() {
- this.setAllCheckBoxesTo(true);
+ setAllCheckBoxesTo(true);
}
public void unsetAllCheckBoxes() {
- this.setAllCheckBoxesTo(false);
+ setAllCheckBoxesTo(false);
}
public boolean isCheckBoxSetByIndex(int index) {
- return this.getCheckBoxesList()
+ return getCheckBoxesList()
.get(index)
.isSelected();
}
public boolean isCheckBoxSetByValue(String value) {
- return this.getCheckBoxesList()
- .get(this.getCheckBoxIndexByValue(value))
+ return getCheckBoxesList()
+ .get(getCheckBoxIndexByValue(value))
.isSelected();
}
public boolean isCheckBoxSetByText(String text) {
- return this.getCheckBoxesList()
- .get(this.getCheckBoxIndexByText(text))
+ return getCheckBoxesList()
+ .get(getCheckBoxIndexByText(text))
.isSelected();
}
public boolean isAllCheckboxesSet() {
- return this.isAllCheckBoxesSetTo(true);
+ return isAllCheckBoxesSetTo(true);
}
public List getTextList() {
@@ -92,20 +91,20 @@ public List getTextList() {
}
private List getCheckBoxesList() {
- return this.getElement()
+ return getElement()
.findElements(inputChildsSelector);
}
private void setCheckBoxByIndexTo(int index, boolean destination) {
- if (this.getCheckBoxesList()
+ if (getCheckBoxesList()
.get(index)
.isSelected() != destination) {
- this.getCheckBoxesList()
+ getCheckBoxesList()
.get(index)
.click();
}
- boolean currentState = this.getCheckBoxesList()
+ boolean currentState = getCheckBoxesList()
.get(index)
.isSelected();
if (currentState != destination) {
@@ -115,15 +114,15 @@ private void setCheckBoxByIndexTo(int index, boolean destination) {
}
private void setCheckBoxByValueTo(String value, boolean destination) {
- this.setCheckBoxToByAttribute(value, "value", destination);
+ setCheckBoxToByAttribute(value, destination);
}
private void setCheckBoxByTextTo(String text, boolean destination) {
- this.setCheckBoxByIndexTo(this.getCheckBoxIndexByText(text), destination);
+ setCheckBoxByIndexTo(getCheckBoxIndexByText(text), destination);
}
private int getCheckBoxIndexByText(String text) {
- List textsList = this.getTextList();
+ List textsList = getTextList();
for (int i = 0; i < textsList.size(); i++) {
if (textsList.get(i)
.equals(text.trim())) {
@@ -134,7 +133,7 @@ private int getCheckBoxIndexByText(String text) {
}
private int getCheckBoxIndexByValue(String value) {
- List checkBoxesList = this.getCheckBoxesList();
+ List checkBoxesList = getCheckBoxesList();
for (int i = 0; i < checkBoxesList.size(); i++) {
if (checkBoxesList.get(i)
.getAttribute("value")
@@ -145,12 +144,12 @@ private int getCheckBoxIndexByValue(String value) {
throw new BFElementNotFoundException("Checkbox with value " + value + " wasn't found.");
}
- private void setCheckBoxToByAttribute(String value, String attribute, boolean destination) {
- List checkboxesList = this.getCheckBoxesList();
+ private void setCheckBoxToByAttribute(String value, boolean destination) {
+ List checkboxesList = getCheckBoxesList();
WebElement currentElement;
- for (int i = 0; i < checkboxesList.size(); i++) {
- currentElement = checkboxesList.get(i);
- if (currentElement.getAttribute(attribute)
+ for (WebElement webElement : checkboxesList) {
+ currentElement = webElement;
+ if (currentElement.getAttribute("value")
.equals(value) && currentElement.isSelected() != destination) {
currentElement.click();
}
@@ -158,25 +157,25 @@ private void setCheckBoxToByAttribute(String value, String attribute, boolean de
}
private void setAllCheckBoxesTo(boolean destination) {
- List checkboxesList = this.getCheckBoxesList();
- for (int i = 0; i < checkboxesList.size(); i++) {
- if (checkboxesList.get(i)
+ List checkboxesList = getCheckBoxesList();
+ for (WebElement webElement : checkboxesList) {
+ if (webElement
.isSelected() != destination) {
- checkboxesList.get(i)
+ webElement
.click();
}
}
- if (!this.isAllCheckBoxesSetTo(destination)) {
+ if (!isAllCheckBoxesSetTo(destination)) {
throw new BFComponentStateException(ElementType.CHECKBOX.toString(), "set/unset",
- "setting to " + String.valueOf(destination));
+ "setting to " + destination);
}
}
private boolean isAllCheckBoxesSetTo(boolean destination) {
- List checkboxesList = this.getCheckBoxesList();
- for (int i = 0; i < checkboxesList.size(); i++) {
- if (checkboxesList.get(i)
+ List checkboxesList = getCheckBoxesList();
+ for (WebElement webElement : checkboxesList) {
+ if (webElement
.isSelected() != destination) {
return false;
}
@@ -185,6 +184,6 @@ private boolean isAllCheckBoxesSetTo(boolean destination) {
}
private void setInputChildsSelector(By selector) {
- this.inputChildsSelector = selector;
+ inputChildsSelector = selector;
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/DropdownListElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/DropdownListElement.java
index c4d2a695..0e1e0f47 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/DropdownListElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/DropdownListElement.java
@@ -16,32 +16,32 @@ public DropdownListElement(By cssSelector) {
}
public void selectDropdownByIndex(int index) {
- this.getObject()
+ getObject()
.selectByIndex(index);
- List list = this.getObject()
+ List list = getObject()
.getOptions();
if (!list.get(index)
.isSelected()) {
throw new BFComponentStateException(ElementType.DROPDOWN.toString(), "select", "Option with index: "
- + String.valueOf(index) + " should be set from in " + this.getObject()
+ + index + " should be set from in " + getObject()
.toString());
}
}
public boolean isDropdownElementSelectedByIndex(int index) {
- return this.getPossibleOptions()
+ return getPossibleOptions()
.get(index)
.isSelected();
}
public void selectDropdownByValue(String value) {
- value.trim();
- this.getObject()
+ value = value.trim();
+ getObject()
.selectByValue(value);
- if (!this.isDropdownElementSelectedByValue(value)) {
+ if (!isDropdownElementSelectedByValue(value)) {
throw new BFComponentStateException(ElementType.DROPDOWN.toString(), "select", "Option with value: "
- + String.valueOf(value) + " should be set from in " + this.getObject()
+ + value + " should be set from in " + getObject()
.toString());
}
}
@@ -49,74 +49,74 @@ public void selectDropdownByValue(String value) {
public void selectDropdownByVisibleText(String value) {
boolean flag = false;
- this.getObject()
+ getObject()
.selectByVisibleText(value);
- List list = this.getAllSelectedOptionsText();
- for (int i = 0; i < list.size(); i++) {
- if (list.get(i)
- .equals(value))
+ List list = getAllSelectedOptionsText();
+ for (String s : list) {
+ if (s.equals(value)) {
flag = true;
+ break;
+ }
}
if (!flag) {
throw new RuntimeException(
- "Option with text: " + value + " wasn't selected in " + this.getObject()
+ "Option with text: " + value + " wasn't selected in " + getObject()
.toString());
}
}
public List getAllSelectedOptionsText() {
- List list = this.getObject()
+ List list = getObject()
.getAllSelectedOptions();
- return this.getValuesFromWebElements(list);
+ return getValuesFromWebElements(list);
}
public String getFirstSelectedOptionText() {
- String output = this.getObject()
+ return getObject()
.getFirstSelectedOption()
.getText()
.trim();
- return output;
}
public int getAmountOfPossibleValues() {
- List list = this.getObject()
+ List list = getObject()
.getOptions();
return list.size();
}
public boolean isDropdownElementSelectedByValue(String value) {
- int index = this.getIndexDropdownElementByValue(value);
- return this.getPossibleOptions()
+ int index = getIndexDropdownElementByValue(value);
+ return getPossibleOptions()
.get(index)
.isSelected();
}
private List getPossibleOptions() {
- return this.getObject()
+ return getObject()
.getOptions();
}
private List getPossibleValuesText() {
- List list = this.getObject()
+ List list = getObject()
.getOptions();
- return this.getValuesFromWebElements(list);
+ return getValuesFromWebElements(list);
}
private int getIndexDropdownElementByValue(String value) {
- return this.getPossibleValuesText()
+ return getPossibleValuesText()
.indexOf(value);
}
private Select getObject() {
- return new Select(this.getElement());
+ return new Select(getElement());
}
private List getValuesFromWebElements(List list) {
- List output = new ArrayList();
- for (int i = 0; i < list.size(); i++) {
- output.add(list.get(i)
+ List output = new ArrayList<>();
+ for (WebElement webElement : list) {
+ output.add(webElement
.getText()
.trim());
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ElementType.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ElementType.java
index 5e1bbee2..a60addb8 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ElementType.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ElementType.java
@@ -17,9 +17,9 @@ enum ElementType {
HORIZONTAL_SLIDER("Horizontal Slider"),
IMAGE("Image");
- private String value;
+ private final String value;
- private ElementType(String value) {
+ ElementType(String value) {
this.value = value;
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/HorizontalSliderElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/HorizontalSliderElement.java
index 2499afa7..a97613ae 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/HorizontalSliderElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/HorizontalSliderElement.java
@@ -52,12 +52,12 @@ public HorizontalSliderElement(By sliderContainerSelector, By sliderSelector, By
*
* @return BigDecimal representing position's value.
* @throws NumberFormatException
+ * e
*/
public BigDecimal getCurrentSliderValue() throws NumberFormatException {
- @SuppressWarnings("deprecation")
WebElement currentValueElement = this.getElement()
- .findElement(this.valueSelector);
+ .findElement(this.valueSelector);
String value = currentValueElement.getText();
if (value == null || value.isEmpty()) {
value = getValueAttributeOfWebElement(currentValueElement);
@@ -96,7 +96,7 @@ public BigDecimal getMaxRange() {
/**
* Sets the highest possible value of horizontal slider's position.
*
- * @param minRange
+ * @param maxRange
* BigDecimal
*/
public void setMaxRange(BigDecimal maxRange) {
@@ -140,8 +140,8 @@ public int getMaxNumberOfSteps() {
*/
public Dimension getDimensions() {
return this.getElement()
- .findElement(sliderSelector)
- .getSize();
+ .findElement(sliderSelector)
+ .getSize();
}
/**
@@ -161,7 +161,7 @@ public Integer getWidth() {
public BigDecimal getStepWidth() {
BigDecimal rangeDiff = maxRange.subtract(minRange);
BigDecimal numberOfSteps = rangeDiff.setScale(1)
- .divide(step.setScale(1));
+ .divide(step.setScale(1));
return new BigDecimal(getWidth()).divide(numberOfSteps);
}
@@ -191,7 +191,7 @@ public void setSliderPositionTo(BigDecimal position, int method) {
String message = "Chosen method doesn't exist.";
int counter = 0;
BasePage.getDriver()
- .mouseLeftClick(getElement().findElement(sliderSelector));
+ .mouseLeftClick(getElement().findElement(sliderSelector));
position = verifyAndCorrectPositionValue(position);
while (position.compareTo(getCurrentSliderValue()) != 0 || counter > getMaxNumberOfSteps()) {
if (position.compareTo(getCurrentSliderValue()) > 0) {
@@ -246,10 +246,10 @@ public void setSliderPositionTo(BigDecimal position, int method) {
* @see BigDecimal
*/
public BigDecimal verifyAndCorrectPositionValue(BigDecimal position) {
- if (position.compareTo(getMinRange()) == -1) {
+ if (position.compareTo(getMinRange()) < 0) {
BFLogger.logInfo("Position value: " + position + " will be set to minimum value: " + getMinRange());
position = getMinRange();
- } else if (position.compareTo(getMaxRange()) == 1) {
+ } else if (position.compareTo(getMaxRange()) > 0) {
BFLogger.logInfo("Position value: " + position + " will be set to maximum value: " + getMaxRange());
position = getMaxRange();
}
@@ -283,28 +283,28 @@ private String getValueAttributeOfWebElement(WebElement element) {
private int calculateMaxNumberOfSteps() {
return getMaxRange().subtract(getMinRange())
- .divide(getStep())
- .intValueExact();
+ .divide(getStep())
+ .intValueExact();
}
private void performKeypress(CharSequence key) {
BasePage.getAction()
- .sendKeys(key)
- .build()
- .perform();
+ .sendKeys(key)
+ .build()
+ .perform();
}
private void performMouseMove(int side) {
int offset = getStepWidth()
- .intValue();
+ .intValue();
if (side == MOUSE_MOVE_LEFT)
offset = -offset;
BasePage.getAction()
- .clickAndHold()
- .moveByOffset(offset, 0)
- .release()
- .build()
- .perform();
+ .clickAndHold()
+ .moveByOffset(offset, 0)
+ .release()
+ .build()
+ .perform();
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IBasicElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IBasicElement.java
index 1a12623f..cae31f59 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IBasicElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IBasicElement.java
@@ -7,5 +7,4 @@ public interface IBasicElement {
String getElementTypeName();
WebElement load();
-
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IFrame.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IFrame.java
index 52554d55..597490c3 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IFrame.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/IFrame.java
@@ -7,11 +7,8 @@
public class IFrame extends BasicElement implements IBasicElement {
- private By cssSelector;
-
public IFrame(By cssSelector) {
super(ElementType.IFRAME, cssSelector);
- this.cssSelector = cssSelector;
BasePage.getDriver()
.switchTo()
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ListElements.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ListElements.java
index 98eb4b00..b1cd7308 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ListElements.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/ListElements.java
@@ -10,7 +10,7 @@
public class ListElements extends BasicElement implements IBasicElement {
- private By cssSelector;
+ private final By cssSelector;
public ListElements(By cssSelector) {
super(ElementType.LIST, cssSelector);
@@ -19,20 +19,20 @@ public ListElements(By cssSelector) {
public Integer getSize() {
return BasePage.getDriver()
- .findElementDynamics(this.cssSelector)
- .size();
+ .findElementDynamics(cssSelector)
+ .size();
}
public List getList() {
return BasePage.getDriver()
- .findElementDynamics(this.cssSelector);
+ .findElementDynamics(cssSelector);
}
public List getTextList() {
- return this.getList()
- .stream()
- .map(element -> element.getText())
- .collect(Collectors.toList());
+ return getList()
+ .stream()
+ .map(WebElement::getText)
+ .collect(Collectors.toList());
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/MenuElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/MenuElement.java
index ef15e718..d739fb4d 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/MenuElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/MenuElement.java
@@ -1,5 +1,8 @@
package com.capgemini.mrchecker.selenium.core.newDrivers.elementType;
+import java.util.Arrays;
+import java.util.List;
+
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -7,17 +10,14 @@
import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
import com.capgemini.mrchecker.test.core.exceptions.BFInputDataException;
-import java.util.Arrays;
-import java.util.List;
-
/**
* Created by LKURZAJ on 08.03.2017.
*/
public class MenuElement extends BasicElement {
- private By childsSelector;
- private By subMenuSelector;
- private By childsSubMenuSelector;
+ private final By childsSelector;
+ private final By subMenuSelector;
+ private final By childsSubMenuSelector;
public MenuElement(By cssSelector) {
this(cssSelector, By.cssSelector("li"));
@@ -39,12 +39,12 @@ public MenuElement(By cssSelector, By childsSelector, By subMenuSelector, By chi
}
public void selectItemByIndex(int index) {
- this.getItemByIndex(index)
+ getItemByIndex(index)
.click();
}
public void selectItemByText(String text) {
- this.getItemByText(text)
+ getItemByText(text)
.click();
}
@@ -57,30 +57,30 @@ public String getItemLinkByText(String text) {
}
public List getItemsTextList() {
- return Arrays.asList(this.getText()
+ return Arrays.asList(getText()
.split("\n"));
}
public void selectSubMenuItemByText(String itemText, String subItemText) {
- this.getSubItemByText(itemText, subItemText)
+ getSubItemByText(itemText, subItemText)
.click();
}
public void selectSubMenuItemByIndex(int itemIndex, int subItemIndex) {
- this.getSubItemByIndex(itemIndex, subItemIndex)
+ getSubItemByIndex(itemIndex, subItemIndex)
.click();
}
public String getSubMenuItemLinkByText(String itemText, String subItemText) {
- return getLinkItemFromWebElement(this.getSubItemByText(itemText, subItemText)).getAttribute("href");
+ return getLinkItemFromWebElement(getSubItemByText(itemText, subItemText)).getAttribute("href");
}
public String getSubMenuItemLinkByIndex(int itemIndex, int subItemIndex) {
- return getLinkItemFromWebElement(this.getSubItemByIndex(itemIndex, subItemIndex)).getAttribute("href");
+ return getLinkItemFromWebElement(getSubItemByIndex(itemIndex, subItemIndex)).getAttribute("href");
}
public int getItemsCount() {
- return this.getItems()
+ return getItems()
.size();
}
@@ -90,7 +90,7 @@ private void clickMenuItemAndWaitForSubMenuVisible(WebElement menuItem) {
.moveToElement(menuItem)
.perform();
BasePage.getDriver()
- .waitForElementVisible(this.subMenuSelector);
+ .waitForElementVisible(subMenuSelector);
}
private WebElement getLinkItemFromWebElement(WebElement webElement) {
@@ -99,52 +99,52 @@ private WebElement getLinkItemFromWebElement(WebElement webElement) {
}
private WebElement getSubItemByIndex(int itemIndex, int subItemIndex) {
- WebElement elem = this.getItemByIndex(itemIndex);
- this.clickMenuItemAndWaitForSubMenuVisible(elem);
- return this.getElementByIndex(this.getItemSubItems(elem), subItemIndex);
+ WebElement elem = getItemByIndex(itemIndex);
+ clickMenuItemAndWaitForSubMenuVisible(elem);
+ return getElementByIndex(getItemSubItems(elem), subItemIndex);
}
private WebElement getSubItemByText(String itemText, String subItemText) {
WebElement webElement = getItemByText(itemText);
- this.clickMenuItemAndWaitForSubMenuVisible(webElement);
- return this.getElementByText(this.getItemSubItems(webElement), subItemText);
+ clickMenuItemAndWaitForSubMenuVisible(webElement);
+ return getElementByText(getItemSubItems(webElement), subItemText);
}
private List getItemSubItems(WebElement webElement) {
- return webElement.findElements(this.childsSubMenuSelector);
+ return webElement.findElements(childsSubMenuSelector);
}
private List getItemSubItemsByText(WebElement webElement) {
- this.clickMenuItemAndWaitForSubMenuVisible(webElement);
- return this.getItemSubItems(webElement);
+ clickMenuItemAndWaitForSubMenuVisible(webElement);
+ return getItemSubItems(webElement);
}
private WebElement getItemByText(String text) {
- return getElementByText(this.getItems(), text);
+ return getElementByText(getItems(), text);
}
private WebElement getItemByIndex(int index) {
- return this.getElementByIndex(this.getItems(), index);
+ return getElementByIndex(getItems(), index);
}
private List getItems() {
- return this.getElement()
- .findElements(this.childsSelector);
+ return getElement()
+ .findElements(childsSelector);
}
private WebElement getElementByIndex(List listElements, int index) {
if (index < 0 || index >= listElements.size()) {
- throw new BFInputDataException("Index out of range: 0 - " + String.valueOf(listElements.size() - 1));
+ throw new BFInputDataException("Index out of range: 0 - " + (listElements.size() - 1));
}
return listElements.get(index);
}
private WebElement getElementByText(List listElements, String text) {
- for (int i = 0; i < listElements.size(); i++) {
- if (listElements.get(i)
+ for (WebElement listElement : listElements) {
+ if (listElement
.getText()
.equals(text)) {
- return listElements.get(i);
+ return listElement;
}
}
throw new BFElementNotFoundException("Item with text: " + text + " not found in " + listElements.toString());
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/NavigationBarElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/NavigationBarElement.java
index b9298684..cb88402d 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/NavigationBarElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/NavigationBarElement.java
@@ -1,115 +1,115 @@
package com.capgemini.mrchecker.selenium.core.newDrivers.elementType;
+import java.util.ArrayList;
+import java.util.List;
+
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException;
import com.capgemini.mrchecker.test.core.exceptions.BFInputDataException;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Created by LKURZAJ on 07.03.2017.
*/
public class NavigationBarElement extends BasicElement {
- private By inputChildsSelector;
+ private final By inputChildsSelector;
+ /**
+ * @param cssSelector
+ * - selector of Navigation Bar element's set
+ **/
public NavigationBarElement(By cssSelector) {
- /**
- * @param cssSelector
- * - selector of Navigation Bar element's set
- **/
this(cssSelector, By.cssSelector("li"));
}
+ /**
+ * @param cssSelector
+ * - selector of Navigation Bar element's set
+ **/
public NavigationBarElement(By cssSelector, By inputChildsSelector) {
- /**
- * @param cssSelector
- * - selector of Navigation Bar element's set
- **/
super(ElementType.NAVIGATION_BAR, cssSelector);
this.inputChildsSelector = inputChildsSelector;
}
public List getItemsTextList() {
- List listElems = this.getItems();
+ List listElems = getItems();
List out = new ArrayList<>();
- for (int i = 0; i < listElems.size(); i++) {
- out.add(listElems.get(i)
+ for (WebElement listElem : listElems) {
+ out.add(listElem
.getText());
}
return out;
}
public String getFirstItemText() {
- return this.getItemsTextList()
+ return getItemsTextList()
.get(0);
}
public String getActiveItemText() {
- List listItems = this.getItems();
- for (int i = 0; i < listItems.size(); i++) {
- if (listItems.get(i)
+ List listItems = getItems();
+ for (WebElement listItem : listItems) {
+ if (listItem
.getAttribute("class")
.contains("active")) {
- return listItems.get(i)
+ return listItem
.getText();
}
}
- throw new BFElementNotFoundException("Any active item was found in " + this.getElement()
+ throw new BFElementNotFoundException("Any active item was found in " + getElement()
.toString());
}
public void clickFirstItem() {
- this.getItems()
+ getItems()
.get(0)
.click();
}
public void clickActiveItem() {
- this.getItems()
- .get(this.getDepth() - 1)
+ getItems()
+ .get(getDepth() - 1)
.click();
}
public void clickItemByIndex(int index) {
- if (index > 0 && index >= this.getItems()
+ if (index > 0 && index >= getItems()
.size()) {
- throw new BFInputDataException("Index " + String.valueOf(index) + " larger than list's size: "
- + String.valueOf(this.getItems()
- .size()));
+ throw new BFInputDataException("Index " + index + " larger than list's size: "
+ + getItems()
+ .size());
}
- this.getItems()
+ getItems()
.get(index)
.click();
}
public void clickItemByText(String text) {
- for (int i = 0; i < this.getItems()
+ for (int i = 0; i < getItems()
.size(); i++) {
- if (this.getItems()
+ if (getItems()
.get(i)
.getText()
.equals(text)) {
- this.getItems()
+ getItems()
.get(i)
.click();
return;
}
}
- throw new BFElementNotFoundException("Item with text: " + text + " wasn't found in " + this.getText());
+ throw new BFElementNotFoundException("Item with text: " + text + " wasn't found in " + getText());
}
public int getDepth() {
- return this.getItems()
+ return getItems()
.size();
}
private List getItems() {
- return this.getElement()
- .findElements(this.inputChildsSelector);
+ return getElement()
+ .findElements(inputChildsSelector);
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/RadioButtonElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/RadioButtonElement.java
index adaa8ee6..31e6c7b9 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/RadioButtonElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/RadioButtonElement.java
@@ -1,6 +1,7 @@
package com.capgemini.mrchecker.selenium.core.newDrivers.elementType;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.openqa.selenium.By;
@@ -10,59 +11,58 @@
public class RadioButtonElement extends BasicElement implements IBasicElement {
- private By inputChildsSelector;
- private List listElements;
- private List listSelectedAttributes;
+ private By inputChildsSelector;
+ private List listElements;
+ private List listSelectedAttributes;
- public RadioButtonElement(By cssSelector)
/**
* @param cssSelector
* - selector of Radio Button element's set
**/
- {
- this(cssSelector, By.cssSelector("input"), Arrays.asList("selected"));
+ public RadioButtonElement(By cssSelector) {
+ this(cssSelector, By.cssSelector("input"), Collections.singletonList("selected"));
}
+ /**
+ * @param cssSelector
+ * - selector of Radio Button element's set
+ * @param inputChildsSelector
+ * - selector of relative path from Radio Button element's set to basic input element
+ **/
public RadioButtonElement(By cssSelector, By inputChildsSelector) {
- /**
- * @param cssSelector
- * - selector of Radio Button element's set
- * @param inputChildsSelector
- * - selector of relative path from Radio Button element's set to basic input element
- **/
- this(ElementType.INPUT_TEXT, cssSelector, inputChildsSelector, Arrays.asList("selected"));
+ this(ElementType.INPUT_TEXT, cssSelector, inputChildsSelector, Collections.singletonList("selected"));
}
+ /**
+ * @param cssSelector
+ * - selector of Radio Button element's set
+ * @param inputChildsSelector
+ * - selector of relative path from Radio Button element's set to basic input element
+ * @param listSelectedAttributes
+ * - list of class name describing selected item
+ **/
public RadioButtonElement(By cssSelector, By inputChildsSelector, List listSelectedAttributes) {
- /**
- * @param cssSelector
- * - selector of Radio Button element's set
- * @param inputChildsSelector
- * - selector of relative path from Radio Button element's set to basic input element
- * @param listSelectedAttributes
- * - list of class name describing selected item
- **/
this(ElementType.INPUT_TEXT, cssSelector, inputChildsSelector, listSelectedAttributes);
}
+ /**
+ * @param cssSelector
+ * - selector of Radio Button element's set
+ * @param inputChildsSelector
+ * - selector of relative path from Radio Button element's set to basic input element
+ * @param listSelectedAttributes
+ * - list of class name describing selected item
+ **/
protected RadioButtonElement(ElementType elemType, By cssSelector, By inputChildsSelector,
List listSelectedAttributes) {
- /**
- * @param cssSelector
- * - selector of Radio Button element's set
- * @param inputChildsSelector
- * - selector of relative path from Radio Button element's set to basic input element
- * @param listSelectedAttributes
- * - list of class name describing selected item
- **/
super(elemType, cssSelector);
setInputChildsSelector(inputChildsSelector);
setSelectedAttributes(listSelectedAttributes);
}
public int getSelectedItemIndex() {
- this.setItems();
- return this.listElements.indexOf(getSelectedItem());
+ setItems();
+ return listElements.indexOf(getSelectedItem());
}
public String getSelectedItemText() {
@@ -74,61 +74,61 @@ public String getSelectedItemValue() {
}
public List getTextList() {
- return Arrays.asList(this.getTextArray());
+ return Arrays.asList(getTextArray());
}
public int getItemsCount() {
- this.setItems();
- return this.listElements.size();
+ setItems();
+ return listElements.size();
}
public boolean isItemSelectedByText(String elementText) {
- return this.getSelectedItemText()
+ return getSelectedItemText()
.equals(elementText);
}
public boolean isItemSelectedByIndex(int elementIndex) {
- return this.getSelectedItemIndex() == elementIndex;
+ return getSelectedItemIndex() == elementIndex;
}
public boolean isItemSelectedByValue(String elementValue) {
- return this.getSelectedItemValue()
+ return getSelectedItemValue()
.equals(elementValue);
}
public void selectItemByText(String elementText) {
- WebElement elementToClick = this.getItemByText(elementText);
+ WebElement elementToClick = getItemByText(elementText);
elementToClick.click();
- this.checkIsItemClicked(elementToClick);
+ checkIsItemClicked(elementToClick);
}
public void selectItemByIndex(int elementIndex) {
- WebElement elementToClick = this.getItemByIndex(elementIndex);
+ WebElement elementToClick = getItemByIndex(elementIndex);
elementToClick.click();
- this.checkIsItemClicked(elementToClick);
+ checkIsItemClicked(elementToClick);
}
public void selectItemByValue(String elementValue) {
- WebElement elementToClick = this.getItemByValue(elementValue);
+ WebElement elementToClick = getItemByValue(elementValue);
elementToClick.click();
- this.checkIsItemClicked(elementToClick);
+ checkIsItemClicked(elementToClick);
}
private void checkIsItemClicked(WebElement element) {
- if (this.isItemSelected(element)) {
- System.out.println(getElementTypeName() + ": " + this.toString() + " isn't clicked.");
+ if (isItemSelected(element)) {
+ System.out.println(getElementTypeName() + ": " + toString() + " isn't clicked.");
}
}
private String[] getTextArray() {
- return this.getElement()
+ return getElement()
.getText()
.trim()
.split("\n");
}
private void setInputChildsSelector(By selector) {
- this.inputChildsSelector = selector;
+ inputChildsSelector = selector;
}
private void setSelectedAttributes(List listSelectedAttributes) {
@@ -144,50 +144,48 @@ private boolean isItemSelected(WebElement el) {
}
private void setItems() {
- setListItems(this.getElement()
+ setListItems(getElement()
.findElements(inputChildsSelector));
}
private WebElement getItemByIndex(int index) {
- this.setItems();
+ setItems();
- if (this.listElements.isEmpty()) {
+ if (listElements.isEmpty()) {
throw new BFElementNotFoundException("Any " + getElementTypeName() + " element was found.");
}
- return this.listElements.get(index);
+ return listElements.get(index);
}
private WebElement getItemByText(String visibleText) {
- for (int i = 0; i < this.getItemsCount(); i++) {
- if (this.listElements.get(i)
+ for (int i = 0; i < getItemsCount(); i++) {
+ if (listElements.get(i)
.getText()
.equals(visibleText)) {
- return this.listElements.get(i);
+ return listElements.get(i);
}
}
throw new BFElementNotFoundException(getElementTypeName() + " with text: " + visibleText + " wasn't found in "
- + this.getTextArray()
- .toString());
+ + Arrays.toString(getTextArray()));
}
private WebElement getItemByValue(String value) {
- this.setItems();
- for (int i = 0; i < this.getItemsCount(); i++) {
- if (this.listElements.get(i)
+ setItems();
+ for (int i = 0; i < getItemsCount(); i++) {
+ if (listElements.get(i)
.getAttribute("value")
.equals(value)) {
- return this.listElements.get(i);
+ return listElements.get(i);
}
}
throw new BFElementNotFoundException(
- getElementTypeName() + " with value: " + value + " wasn't found in " + this.getTextArray()
- .toString());
+ getElementTypeName() + " with value: " + value + " wasn't found in " + Arrays.toString(getTextArray()));
}
private boolean isClassContainSelectionAttributes(String classAttribute) {
- for (int i = 0; i < this.listSelectedAttributes.size(); i++) {
- if (classAttribute.contains(this.listSelectedAttributes.get(i))) {
+ for (String listSelectedAttribute : listSelectedAttributes) {
+ if (classAttribute.contains(listSelectedAttribute)) {
return true;
}
}
@@ -195,15 +193,14 @@ private boolean isClassContainSelectionAttributes(String classAttribute) {
}
private WebElement getSelectedItem() {
- this.setItems();
- for (int i = 0; i < this.listElements.size(); i++) {
- if (this.isItemSelected(this.listElements.get(i))
- || isClassContainSelectionAttributes(this.listElements.get(i)
+ setItems();
+ for (WebElement listElement : listElements) {
+ if (isItemSelected(listElement)
+ || isClassContainSelectionAttributes(listElement
.getAttribute("class"))) {
- return this.listElements.get(i);
+ return listElement;
}
}
- throw new BFElementNotFoundException("Any element is selected in " + this.getTextArray()
- .toString());
+ throw new BFElementNotFoundException("Any element is selected in " + Arrays.toString(getTextArray()));
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/TabElement.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/TabElement.java
index 6be24169..7ce8cb02 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/TabElement.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/newDrivers/elementType/TabElement.java
@@ -1,43 +1,42 @@
package com.capgemini.mrchecker.selenium.core.newDrivers.elementType;
-import org.openqa.selenium.By;
-
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
+import org.openqa.selenium.By;
+
/**
* Created by LKURZAJ on 06.03.2017.
*/
public class TabElement extends RadioButtonElement implements IBasicElement {
- public TabElement(By cssSelector)
/**
* @param cssSelector
* - selector of Tab element's set
**/
- {
+ public TabElement(By cssSelector) {
this(cssSelector, By.cssSelector("li"));
}
+ /**
+ * @param cssSelector
+ * - selector of Tab element's set
+ * @param inputChildsSelector
+ * - selector of relative path from Tab element's set to basic input element
+ **/
public TabElement(By cssSelector, By inputChildsSelector) {
- /**
- * @param cssSelector
- * - selector of Tab element's set
- * @param inputChildsSelector
- * - selector of relative path from Tab element's set to basic input element
- **/
- super(ElementType.TAB, cssSelector, inputChildsSelector, Arrays.asList("ui-tabs-active ui-state-active"));
+ super(ElementType.TAB, cssSelector, inputChildsSelector, Collections.singletonList("ui-tabs-active ui-state-active"));
}
+ /**
+ * @param cssSelector
+ * - selector of Tab element's set
+ * @param inputChildsSelector
+ * - selector of relative path from Tab element's set to basic input element
+ * @param listSelectedAttributes
+ * - list of class name describing selected item
+ **/
public TabElement(By cssSelector, By inputChildsSelector, List listSelectedAttributes) {
- /**
- * @param cssSelector
- * - selector of Tab element's set
- * @param inputChildsSelector
- * - selector of relative path from Tab element's set to basic input element
- * @param listSelectedAttributes
- * - list of class name describing selected item
- **/
super(ElementType.TAB, cssSelector, inputChildsSelector, listSelectedAttributes);
}
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ColorsUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ColorsUtils.java
index f0d10631..15bc199b 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ColorsUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ColorsUtils.java
@@ -15,14 +15,10 @@ private ColorsUtils() {
* @param color
* from ColorsEnum
* @return True if element text is displayed in black, false otherwise
- * @author
*/
public static boolean isElementTextInGivenColor(WebElement element, ColorsEnum color) {
String elementColor = element.getCssValue("color");
- if (elementColor == null || !elementColor.contains(color.toString())) {
- return false;
- }
- return true;
+ return elementColor != null && elementColor.contains(color.toString());
}
/**
@@ -31,7 +27,6 @@ public static boolean isElementTextInGivenColor(WebElement element, ColorsEnum c
* @param validator
* - IColorValidator
* @return True if element has correct color coresponding to IColorValidator, false otherwise
- * @author
*/
public static boolean isColorCorrectForValue(WebElement element, IColorValidator validator) {
return validator.isValid(element);
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/DateUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/DateUtils.java
index 33ffbbba..8c5fef50 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/DateUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/DateUtils.java
@@ -15,8 +15,6 @@
/**
* This class contains utility functions related to date (matching, conversion etc.).
- *
- * @author
*/
public class DateUtils {
@@ -28,15 +26,15 @@ private DateUtils() {
// MM/DD/YYYY regexp
public static final String DATE_REGEX = "(0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/((19|20)\\d\\d)";
// timestamp with 'AS OF' prefix regexp: AS OF MM/DD/YYYY HH:MM A/PM ET
- public static final String AS_OF_TIMESTAMPT_REGEX = "(AS OF )" + DateUtils.DATE_REGEX + " "
+ public static final String AS_OF_TIMESTAMPT_REGEX = "(AS OF )" + DateUtils.DATE_REGEX + " "
+ DateUtils.TIME_12H_REGEX + "( ET)";
- public static final String COMMON_DATE_REGEX = "\\d{2}/\\d{2}/\\d{4}";
- public static final String US_DATE_FORMAT = "MM/dd/yyyy";
- public static final String[] MOTHS = new String[] { "January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December" };
+ public static final String COMMON_DATE_REGEX = "\\d{2}/\\d{2}/\\d{4}";
+ public static final String US_DATE_FORMAT = "MM/dd/yyyy";
+ public static final String[] MOTHS = new String[] { "January", "February", "March", "April", "May", "June", "July",
+ "August", "September", "October", "November", "December" };
- private static final String HTTP_RESPONSE_DATE_REGEX = "(\\w+,\\s\\d{1,2}\\s\\w+\\s\\d{4}\\s\\d{2}:\\d{2}:\\d{2}\\s\\w{2,6})";
- private static final String HTTP_RESPONSE_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
+ private static final String HTTP_RESPONSE_DATE_REGEX = "(\\w+,\\s\\d{1,2}\\s\\w+\\s\\d{4}\\s\\d{2}:\\d{2}:\\d{2}\\s\\w{2,6})";
+ private static final String HTTP_RESPONSE_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
/**
* Matches date with MM/DD/YYYY pattern
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ImageUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ImageUtils.java
index acfcd02a..0e924a69 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ImageUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/ImageUtils.java
@@ -1,13 +1,18 @@
package com.capgemini.mrchecker.selenium.core.utils;
import java.awt.image.BufferedImage;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
import javax.imageio.ImageIO;
import org.apache.commons.io.FileUtils;
-import org.openqa.selenium.*;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebElement;
import com.capgemini.mrchecker.selenium.core.BasePage;
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/TestUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/TestUtils.java
index 947b7be8..cb49a2c7 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/TestUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/TestUtils.java
@@ -6,7 +6,7 @@
import org.openqa.selenium.By;
import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.enums.SubUrl;
+import com.capgemini.mrchecker.selenium.core.enums.ISubUrl;
import com.capgemini.mrchecker.test.core.exceptions.BFInputDataException;
import com.capgemini.mrchecker.test.core.logger.BFLogger;
@@ -20,7 +20,7 @@ public class TestUtils {
* @param pageSubUrl
* @return Returns true if current URL contains subURL specified by parameter
*/
- public static boolean isOnPage(SubUrl pageSubUrl) {
+ public static boolean isOnPage(ISubUrl pageSubUrl) {
return isCurrentUrlContains(pageSubUrl.subURL());
}
@@ -30,14 +30,14 @@ public static boolean isOnPage(SubUrl pageSubUrl) {
*/
public static boolean isCurrentUrlContains(String url) {
if (BasePage.getDriver()
- .getCurrentUrl()
- .contains(url)) {
+ .getCurrentUrl()
+ .contains(url)) {
BFLogger.logDebug("Current page as expected: " + BasePage.getDriver()
- .getCurrentUrl());
+ .getCurrentUrl());
return true;
} else {
BFLogger.logDebug("Not on " + url + " page. Current page: " + BasePage.getDriver()
- .getCurrentUrl());
+ .getCurrentUrl());
return false;
}
}
@@ -49,8 +49,8 @@ public static boolean isCurrentUrlContains(String url) {
public static boolean isCurrentUrlMatchesPattern(String toMatch) {
Pattern pattern = Pattern.compile(toMatch);
return pattern.matcher(BasePage.getDriver()
- .getCurrentUrl())
- .matches();
+ .getCurrentUrl())
+ .matches();
}
public static boolean isCurrentUrlContains(String[] pageSubUrls) {
@@ -65,14 +65,14 @@ public static boolean isCurrentUrlContains(String[] pageSubUrls) {
public static boolean isCurrentPageTitle(String title) {
if (BasePage.getDriver()
- .getTitle()
- .contains(title)) {
+ .getTitle()
+ .contains(title)) {
BFLogger.logDebug("Current page as expected: " + BasePage.getDriver()
- .getTitle());
+ .getTitle());
return true;
} else {
BFLogger.logDebug("Not on " + title + " page. Current page: " + BasePage.getDriver()
- .getTitle());
+ .getTitle());
return false;
}
}
@@ -84,12 +84,12 @@ public static boolean isCurrentPageTitle(String title) {
*/
public void goToPage(String pageUrl) {
BasePage.getDriver()
- .get(pageUrl);
+ .get(pageUrl);
}
public String getCurrentPageURL() {
return BasePage.getDriver()
- .getCurrentUrl();
+ .getCurrentUrl();
}
/**
@@ -100,9 +100,9 @@ public String getCurrentPageURL() {
@SuppressWarnings("deprecation")
public boolean isTextOnPage(String text) {
return BasePage.getDriver()
- .findElement(By.cssSelector("body"))
- .getText()
- .contains(text);
+ .findElement(By.cssSelector("body"))
+ .getText()
+ .contains(text);
}
/**
@@ -113,8 +113,8 @@ public static String getAbsolutePathFor(String path) {
String absolutePath = "";
try {
String resourceFile = TestUtils.class.getClassLoader()
- .getResource(path)
- .getFile();
+ .getResource(path)
+ .getFile();
absolutePath = new File(resourceFile).getAbsolutePath();
} catch (NullPointerException e) {
throw new BFInputDataException("Given path: (" + path + ") does not exists in src/test/resources");
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WebElementUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WebElementUtils.java
index fd435ac7..10346697 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WebElementUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WebElementUtils.java
@@ -81,7 +81,7 @@ public static boolean isWebElementHighlightedInColor(WebElement webElement, Stri
public static WebElement hoverOnElement(By elementSelector, By waitForSelector) {
@SuppressWarnings("deprecation")
WebElement element = BasePage.getDriver()
- .findElement(elementSelector);
+ .findElement(elementSelector);
return hoverOnElement(element, waitForSelector);
}
@@ -98,11 +98,11 @@ public static WebElement hoverOnElement(By elementSelector, By waitForSelector)
public static WebElement hoverOnElement(WebElement elementToHoverOn, By waitForSelector) {
long startTime = System.currentTimeMillis();
BasePage.getAction()
- .moveToElement(elementToHoverOn)
- .build()
- .perform();
+ .moveToElement(elementToHoverOn)
+ .build()
+ .perform();
- WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICITYWAITTIMER);
+ WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICIT_WAIT_TIMER);
WebElement element = wait.until((Function super WebDriver, WebElement>) ExpectedConditions.visibilityOfElementLocated(waitForSelector));
BFLogger.logTime(startTime, "hoverOnElement", waitForSelector.toString());
return element;
@@ -120,11 +120,11 @@ public static WebElement hoverOnElement(WebElement elementToHoverOn, By waitForS
public static WebElement hoverOnElement(WebElement elementToHoverOn, WebElement waitForElement) {
long startTime = System.currentTimeMillis();
BasePage.getAction()
- .moveToElement(elementToHoverOn)
- .build()
- .perform();
+ .moveToElement(elementToHoverOn)
+ .build()
+ .perform();
- WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICITYWAITTIMER);
+ WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICIT_WAIT_TIMER);
WebElement element = wait.until((Function super WebDriver, WebElement>) ExpectedConditions.visibilityOf(waitForElement));
BFLogger.logTime(startTime, "hoverOnElement", waitForElement.toString());
return element;
@@ -139,7 +139,7 @@ public static WebElement hoverOnElement(WebElement elementToHoverOn, WebElement
* after {@link BasePage.EXPLICITYWAITTIMER}
*/
public static void waitForElementVisible(By elementToWaitFor) {
- waitForElementVisible(elementToWaitFor, BasePage.EXPLICITYWAITTIMER);
+ waitForElementVisible(elementToWaitFor, BasePage.EXPLICIT_WAIT_TIMER);
}
/**
@@ -167,7 +167,7 @@ public static void waitForElementVisible(By elementToWaitFor, int tiemout) {
*/
public static WebElement waitForElementVisible(WebElement elementToWaitFor) {
long startTime = System.currentTimeMillis();
- WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICITYWAITTIMER);
+ WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICIT_WAIT_TIMER);
WebElement element = wait.until((Function super WebDriver, WebElement>) ExpectedConditions.visibilityOf(elementToWaitFor));
BFLogger.logTime(startTime, "waitForElementVisible", elementToWaitFor.toString());
return element;
@@ -183,7 +183,7 @@ public static WebElement waitForElementVisible(WebElement elementToWaitFor) {
*/
public static boolean waitForElementNotVisible(By elementToWaitFor) {
long startTime = System.currentTimeMillis();
- WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICITYWAITTIMER);
+ WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICIT_WAIT_TIMER);
Boolean elementInvisibility = wait.until((Function super WebDriver, Boolean>) ExpectedConditions.invisibilityOfElementLocated(elementToWaitFor));
BFLogger.logTime(startTime, "waitForElementNotVisible", elementToWaitFor.toString());
return elementInvisibility;
@@ -197,9 +197,9 @@ public static boolean waitForElementNotVisible(By elementToWaitFor) {
*/
public static boolean waitForElementNotVisible(WebElement elementToWaitFor) {
long startTime = System.currentTimeMillis();
- WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICITYWAITTIMER);
+ WebDriverWait wait = new WebDriverWait(BasePage.getDriver(), BasePage.EXPLICIT_WAIT_TIMER);
Boolean elementInvisibility = wait
- .until((Function super WebDriver, Boolean>) ExpectedConditions.not(ExpectedConditions.visibilityOf(elementToWaitFor)));
+ .until((Function super WebDriver, Boolean>) ExpectedConditions.not(ExpectedConditions.visibilityOf(elementToWaitFor)));
BFLogger.logTime(startTime, "waitForElementNotVisible", elementToWaitFor.toString());
return elementInvisibility;
}
@@ -211,8 +211,8 @@ public static boolean waitForElementNotVisible(WebElement elementToWaitFor) {
*/
public static void dynamicClick(By selector) {
BasePage.getDriver()
- .waitUntilElementIsClickable(selector)
- .click();
+ .waitUntilElementIsClickable(selector)
+ .click();
}
/**
@@ -225,9 +225,9 @@ public static void dynamicClick(By selector) {
*/
public static void moveMousePointer(int xOffset, int yOffset) {
BasePage.getAction()
- .moveByOffset(xOffset, yOffset)
- .build()
- .perform();
+ .moveByOffset(xOffset, yOffset)
+ .build()
+ .perform();
}
/**
@@ -280,15 +280,15 @@ public static void sendNewKeys(WebElement field, String keys) {
* @return WebElement matching selector
*/
public static WebElement getExpectedElement(WebElement parent,
- By selector,
- Class retriever,
- String expectedElementDescription) {
+ By selector,
+ Class retriever,
+ String expectedElementDescription) {
WebElement e;
try {
e = parent.findElement(selector);
} catch (NoSuchElementException ex) {
throw new BFComponentStateException(retriever.getSimpleName(), "get " + expectedElementDescription,
- "not found");
+ "not found");
}
return e;
}
@@ -328,11 +328,11 @@ public static void waitForAnimationEnd(By selector) {
long startTime = System.currentTimeMillis();
@SuppressWarnings("deprecation")
WebElement sliderElement = BasePage.getDriver()
- .findElement(selector);
+ .findElement(selector);
String leftOffset = "";
while (!leftOffset.equals(sliderElement.getAttribute("style"))) {
- if (System.currentTimeMillis() - startTime > BasePage.EXPLICITYWAITTIMER * 1000) {
- throw new BFWaitingTimeoutException("Animation is to long", BasePage.EXPLICITYWAITTIMER * 1000);
+ if (System.currentTimeMillis() - startTime > BasePage.EXPLICIT_WAIT_TIMER * 1000) {
+ throw new BFWaitingTimeoutException("Animation is to long", BasePage.EXPLICIT_WAIT_TIMER * 1000);
}
leftOffset = sliderElement.getAttribute("style");
TimeUtills.waitMiliseconds(100);
@@ -352,8 +352,8 @@ public static void waitForAnimationEnd(By selector) {
public static void clickIfVisible(By selector, String elementName) {
if (BasePage.isElementDisplayedNoException(selector)) {
BasePage.getDriver()
- .findElement(selector)
- .click();
+ .findElement(selector)
+ .click();
} else {
throw new BFComponentStateException(elementName, "click", "element not found");
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WindowUtils.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WindowUtils.java
index 79a945bc..4853632c 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WindowUtils.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/core/utils/WindowUtils.java
@@ -56,7 +56,7 @@ public static void switchWindow(String url, boolean switchToGivenURL) {
*
* @param title
* - title/part of title, at which you want to get driver
- * @param switchToGivenURL
+ * @param switchToGiven
* - true if you want switch on this window, false if the another one
*/
public static void switchToWindowByTitle(String title, boolean switchToGiven) {
@@ -244,7 +244,7 @@ public static Set waitForOpeningSecondBrowserWindow(String timeoutDescri
long startTime = System.currentTimeMillis();
Set allBrowserWindows = BasePage.getDriver()
.getWindowHandles();
- int tmp_timeout = BasePage.PROGRESSBARWAITTIMER;
+ int tmp_timeout = BasePage.PROGRESS_BAR_WAIT_TIMER;
while (allBrowserWindows.size() < 2) {
TimeUtills.waitMiliseconds(1000);
if (tmp_timeout-- <= 0)
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/jsoupHelper/JsoupHelper.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/jsoupHelper/JsoupHelper.java
index 975c0ff4..7e9424e3 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/jsoupHelper/JsoupHelper.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/main/java/com/capgemini/mrchecker/selenium/jsoupHelper/JsoupHelper.java
@@ -180,12 +180,12 @@ public static List getSelectors(By elementToReturn, By elementToCheck, S
String selector = createStringSelector(elementToReturn);
Elements rowListE = doc.body()
- .select(selector);
+ .select(selector);
for (Element row : rowListE) {
String selectorOfElementTocheck = createStringSelector(elementToCheck);
String containsQuery = valueToCheck == null || valueToCheck.isEmpty()
- ? ""
- : ":contains(" + valueToCheck + ")";
+ ? ""
+ : ":contains(" + valueToCheck + ")";
Elements returnCandidates = row.select(selectorOfElementTocheck + containsQuery);
if (!returnCandidates.isEmpty())
result.add(row.cssSelector());
@@ -266,7 +266,7 @@ private static List getElements(String text, List selectors)
By elementSelector = By.cssSelector(selector);
@SuppressWarnings("deprecation")
WebElement foundElement = BasePage.getDriver()
- .findElement(elementSelector);
+ .findElement(elementSelector);
elementsToReturn.add(foundElement);
}
return elementsToReturn;
@@ -294,8 +294,7 @@ private static Document initDocument(WebElement searchArea) {
} else if (isConversionToListRequired(innerHtml)) {
innerHtml = convertToList(innerHtml);
}
- Document doc = Jsoup.parse("" + innerHtml + "");
- return doc;
+ return Jsoup.parse("" + innerHtml + "");
}
private static boolean isConversionToTableRequired(String innerHtml) {
@@ -312,46 +311,38 @@ private static boolean isConversionToTableRequired(String innerHtml) {
}
private static String convertToTable(String innerHtml) {
- innerHtml = "";
- return innerHtml;
+ return "";
}
private static boolean isConversionToListRequired(String innerHtml) {
if (innerHtml.contains("";
- return innerHtml;
+ return "";
}
private static Document initDocument() {
Document doc = Jsoup.parse(BasePage.getDriver()
- .getPageSource());
+ .getPageSource());
return doc;
}
private static String createStringSelector(By from) {
String selector = from.toString();
int substringBegin = from.toString()
- .indexOf(":") + 2;
+ .indexOf(":") + 2;
selector = selector.substring(substringBegin);
selector = removeQuotes(selector);
return selector;
}
private static String removeQuotes(String selector) {
- String openingQuote = "=\\s*'";
- String closingQuote = "'\\s*\\]";
- selector = selector.replaceAll(openingQuote, "=");
- selector = selector.replaceAll(closingQuote, "]");
- return selector;
+ return selector.replaceAll("=\\s*'", "=")
+ .replaceAll("'\\s*]", "]");
}
-
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/resources/settings.properties b/mrchecker-framework-modules/mrchecker-selenium-module/src/resources/settings.properties
index d056fcf9..f6e30fad 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/resources/settings.properties
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/resources/settings.properties
@@ -6,7 +6,7 @@ selenium.opera=./lib/webdrivers/opera/operadriver.exe
selenium.webdrivers=./lib/webdrivers
selenium.proxy=
selenium.driverAutoUpdate=true
-wdm.chromeDriverVersion=75.0.3770.90
+wdm.chromeDriverVersion=83.0.4103.39
wdm.internetExplorerDriverVersion=
wdm.geckoDriverVersion=
wdm.edgeVersion=
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/runtime/RuntimeParametersTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/runtime/RuntimeParametersTest.java
deleted file mode 100644
index 250ae651..00000000
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/runtime/RuntimeParametersTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package com.capgemini.mrchecker.selenium.core.base.runtime;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang.BooleanUtils;
-import org.hamcrest.Matchers;
-import org.hamcrest.core.IsInstanceOf;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class RuntimeParametersTest {
-
- private Map values = new HashMap();
-
- @Rule
- public ExpectedException exceptionGrabber = ExpectedException.none();
-
- @Before
- public void setUp() throws Exception {
-
- values.put("browser", "magicBrowser");
- values.put("browserVersion", "11.0");
- values.put("seleniumGrid", "smth");
- values.put("os", "linux");
- values.put("browserOptions", "headless;window-size=1200x600;testEquals=FirstEquals=SecondEquals;--testMe;acceptInsecureCerts=true;maxInstances=3");
-
- values.forEach(System::setProperty);
-
- RuntimeParametersSelenium.BROWSER.refreshParameterValue();
- RuntimeParametersSelenium.BROWSER_VERSION.refreshParameterValue();
- RuntimeParametersSelenium.OS.refreshParameterValue();
- RuntimeParametersSelenium.SELENIUM_GRID.refreshParameterValue();
- RuntimeParametersSelenium.BROWSER_OPTIONS.refreshParameterValue();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGetProperty() {
-
- assertThat("System parameters for empty property 'browser' should be 'magicbrowser'", RuntimeParametersSelenium.BROWSER.getValue(), Matchers.equalTo("magicbrowser"));
- assertThat("System parameters for empty property 'browserVersion' should be '11.0'", RuntimeParametersSelenium.BROWSER_VERSION.getValue(), Matchers.equalTo("11.0"));
- assertThat("System parameters for empty property 'seleniumGrid' should be 'smth'", RuntimeParametersSelenium.SELENIUM_GRID.getValue(), Matchers.equalTo("smth"));
- assertThat("System parameters for empty property 'os' should be 'linux'", RuntimeParametersSelenium.OS.getValue(), Matchers.equalTo("linux"));
- assertThat(
- "System parameters for empty property 'browserOptions' should be 'headless;window-size=1200x600;testEquals=FirstEquals=SecondEquals;--testMe;acceptInsecureCerts=true;maxInstances=3'",
- RuntimeParametersSelenium.BROWSER_OPTIONS.getValue(),
- Matchers.equalTo("headless;window-size=1200x600;testEquals=FirstEquals=SecondEquals;--testMe;acceptInsecureCerts=true;maxInstances=3"));
-
- }
-
- @Test
- public void testConvertToCorrectTypeBoolean() throws Exception {
-
- // validate type as Boolean
- String value = "true";
- Object convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat(BooleanUtils.toBooleanObject((boolean) convertToCorrectType), IsInstanceOf.instanceOf(Boolean.class));
-
- value = "false";
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat(BooleanUtils.toBooleanObject((boolean) convertToCorrectType), IsInstanceOf.instanceOf(Boolean.class));
-
- value = "blue";
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- exceptionGrabber.expect(ClassCastException.class);
- exceptionGrabber.expectMessage("java.lang.String cannot be cast to java.lang.Boolean");
- assertThat(BooleanUtils.toBooleanObject((boolean) convertToCorrectType), Matchers.not(IsInstanceOf.instanceOf(Boolean.class)));
-
- }
-
- @Test
- public void testConvertToCorrectTypeInteger() throws Exception {
-
- String value = "1";
- Object convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat((Integer) convertToCorrectType, IsInstanceOf.instanceOf(Integer.class));
-
- value = "0.23";
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat((Float) convertToCorrectType, IsInstanceOf.instanceOf(Float.class));
-
- value = "blue";
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- exceptionGrabber.expect(ClassCastException.class);
- exceptionGrabber.expectMessage("java.lang.String cannot be cast to java.lang.Integer");
- assertThat((Integer) convertToCorrectType, IsInstanceOf.instanceOf(Integer.class));
- }
-
- @Test
- public void testConvertToCorrectTypeString() throws Exception {
-
- String value = "hello";
- Object convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat((String) convertToCorrectType, IsInstanceOf.instanceOf(String.class));
-
- value = "";
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat((String) convertToCorrectType, IsInstanceOf.instanceOf(String.class));
-
- value = null;
- convertToCorrectType = RuntimeParametersSelenium.convertToCorrectType(value);
- assertThat((String) convertToCorrectType, Matchers.isEmptyOrNullString());
-
- }
-
- @Test
- public void testBrowserOptionsVariable() throws Exception {
-
- Map expected = new HashMap();
- expected.put("testEquals", "FirstEquals=SecondEquals");
- expected.put("headless", "");
- expected.put("--testMe", "");
- expected.put("window-size", "1200x600");
- expected.put("acceptInsecureCerts", true);
- expected.put("maxInstances", 3);
-
- assertThat(RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
- .size(),
- Matchers.is(6));
-
- assertThat(RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
- .toString(),
- Matchers.is(expected.toString()));
-
- }
-
- @Test
- public void testBrowserOptionsSet() throws Exception {
-
- RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
- .forEach((key, value) -> {
- String item = (value.toString()
- .isEmpty()) ? key : key + "=" + value;
- System.out.println(item);
- });
-
- }
-
- @Test
- public void testBrowserIE() throws Exception {
- System.setProperty("browser", "ie");
- RuntimeParametersSelenium.BROWSER.refreshParameterValue();
-
- assertEquals("System parameters for empty property 'browser' should be 'internet explorer'", "internet explorer", RuntimeParametersSelenium.BROWSER.getValue());
-
- }
-
- @Test
- public void testGetEmptyProperty() {
- values.forEach((String key, String value) -> System.clearProperty(key));
-
- RuntimeParametersSelenium.BROWSER.refreshParameterValue();
- RuntimeParametersSelenium.BROWSER_VERSION.refreshParameterValue();
- RuntimeParametersSelenium.OS.refreshParameterValue();
- RuntimeParametersSelenium.SELENIUM_GRID.refreshParameterValue();
- RuntimeParametersSelenium.BROWSER_OPTIONS.refreshParameterValue();
-
- assertThat("System parameters for empty property 'browser' should be 'chrome'", RuntimeParametersSelenium.BROWSER.getValue(), Matchers.equalTo("chrome"));
- assertThat("System parameters for empty property 'browserVersion' should be 'null'", RuntimeParametersSelenium.BROWSER_VERSION.getValue(), Matchers.isEmptyString());
- assertThat("System parameters for empty property 'seleniumGrid' should be 'false'", RuntimeParametersSelenium.SELENIUM_GRID.getValue(), Matchers.isEmptyString());
- assertThat("System parameters for empty property 'os' should be 'null'", RuntimeParametersSelenium.OS.getValue(), Matchers.isEmptyString());
- assertThat("System parameters for empty property 'browserOptions' should be 'null'", RuntimeParametersSelenium.BROWSER_OPTIONS.getValue(), Matchers.isEmptyString());
-
- }
-
- @Test
- public void testParamsToString() throws Exception {
-
- RuntimeParametersSelenium.valueOf("BROWSER")
- .toString()
- .equals("browser=magicBrowser");
-
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManagerTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManagerTest.java
index b9c273af..2db99875 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManagerTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/newDrivers/DriverManagerTest.java
@@ -2,30 +2,31 @@
import static org.junit.Assert.assertTrue;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import com.capgemini.mrchecker.selenium.core.base.properties.PropertiesSelenium;
-import com.capgemini.mrchecker.selenium.core.newDrivers.DriverManager;
import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
import com.google.inject.Guice;
+@Disabled
public class DriverManagerTest {
private DriverManager driverManager;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
PropertiesSelenium propertiesSelenium = Guice.createInjector(PropertiesSettingsModule.init())
@@ -35,7 +36,7 @@ public void setUp() throws Exception {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
driverManager.stop();
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ButtonTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ButtonTest.java
index dfc5d04b..92e19839 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ButtonTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ButtonTest.java
@@ -1,39 +1,43 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
/**
* Created by LKURZAJ on 03.03.2017.
*/
+@Disabled
public class ButtonTest extends BaseTest {
- private QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private static By buttonSubmit = By.cssSelector("button#submit");
-
- @AfterClass
- public static void tearDownAll() {
-
+ private QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private static By buttonSubmit = By.cssSelector("button#submit");
+
+ @Override
+ public void setUp() {
+ quickFixSeleniumPage = new QuickFixSeleniumPage();
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
}
-
+
@Test
public void test() {
// check if element is displayed
assertTrue(BasePage.getDriver()
.elementButton(ButtonTest.buttonSubmit)
.isDisplayed());
-
+
// check if element type equals Button
assertEquals("Button", BasePage.getDriver()
.elementButton(ButtonTest.buttonSubmit)
.getElementTypeName());
-
+
// click on button and verify if url was changed
BasePage.getDriver()
.elementButton(ButtonTest.buttonSubmit)
@@ -42,17 +46,4 @@ public void test() {
.getCurrentUrl()
.contains("&submit="));
}
-
- @Override
- public void setUp() {
- quickFixSeleniumPage = new QuickFixSeleniumPage();
- BasePage.getDriver()
- .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
- return;
- }
-
- @Override
- public void tearDown() {
- // TODO Auto-generated method stub
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/CheckBoxTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/CheckBoxTest.java
index dfa731a1..8190813a 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/CheckBoxTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/CheckBoxTest.java
@@ -1,29 +1,36 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.CheckBox;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static org.junit.Assert.*;
/**
* Created by LKURZAJ on 06.03.2017.
*/
+@Disabled
public class CheckBoxTest extends BaseTest {
- private QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private static final By hobbyCheckBoxSelector = By
+ private QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private static final By hobbyCheckBoxSelector = By
.cssSelector("li.fields.pageFields_1:nth-child(3) div.radio_wrap");
- CheckBox checkBoxElement;
-
- @AfterClass
- public static void tearDownAll() {
-
+ CheckBox checkBoxElement;
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
+ checkBoxElement = BasePage.getDriver()
+ .elementCheckbox(CheckBoxTest.hobbyCheckBoxSelector);
}
-
+
@Test
public void testCheckBoxByIndex() {
checkBoxElement.setCheckBoxByIndex(0);
@@ -31,7 +38,7 @@ public void testCheckBoxByIndex() {
checkBoxElement.unsetCheckBoxByIndex(0);
assertFalse(checkBoxElement.isCheckBoxSetByIndex(0));
}
-
+
@Test
public void testCheckBoxByValue() {
checkBoxElement.setCheckBoxByValue("reading");
@@ -39,22 +46,22 @@ public void testCheckBoxByValue() {
checkBoxElement.unsetCheckBoxByValue("reading");
assertFalse(checkBoxElement.isCheckBoxSetByValue("reading"));
}
-
+
@Test
public void testCheckBoxByText() {
checkBoxElement.setCheckBoxByText("Cricket");
assertTrue(checkBoxElement.isCheckBoxSetByText("Cricket"));
checkBoxElement.unsetCheckBoxByText("Cricket");
assertFalse(checkBoxElement.isCheckBoxSetByText("Cricket"));
-
+
}
-
+
@Test
public void testNumberOfCheckBoxes() {
assertEquals(checkBoxElement.getTextList()
.size(), 3);
}
-
+
@Test
public void testCheckBoxAllValues() {
checkBoxElement.setAllCheckBoxes();
@@ -62,16 +69,5 @@ public void testCheckBoxAllValues() {
checkBoxElement.unsetAllCheckBoxes();
assertFalse(checkBoxElement.isAllCheckboxesSet());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
- this.checkBoxElement = BasePage.getDriver()
- .elementCheckbox(CheckBoxTest.hobbyCheckBoxSelector);
- }
-
- @Override
- public void tearDown() {
- }
+
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/DropdownListTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/DropdownListTest.java
index 18430f8a..5bf819fa 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/DropdownListTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/DropdownListTest.java
@@ -1,70 +1,68 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.DropdownListElement;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
/**
* Created by LKURZAJ on 06.03.2017.
*/
+@Disabled
public class DropdownListTest extends BaseTest {
QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
-
- private static final By dropdownSelector = By.cssSelector("select#dropdown_7");
- private DropdownListElement dropdownObject;
-
- @AfterClass
+
+ private static final By dropdownSelector = By.cssSelector("select#dropdown_7");
+ private DropdownListElement dropdownObject;
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
+ dropdownObject = BasePage.getDriver()
+ .elementDropdownList(DropdownListTest.dropdownSelector);
+ }
+
+ @AfterAll
public static void tearDownAll() {
}
-
+
@Test
public void testPossibleOptionsNumber() {
assertTrue(dropdownObject.isDisplayed());
assertEquals(dropdownObject.getAmountOfPossibleValues(), 204);
}
-
+
@Test
public void testSelectOptionByIndex() {
dropdownObject.selectDropdownByIndex(0);
assertTrue(dropdownObject.isDropdownElementSelectedByIndex(0));
}
-
+
@Test
public void testSelectOptionByValue() {
dropdownObject.selectDropdownByValue("Vietnam");
assertTrue(dropdownObject.isDropdownElementSelectedByValue("Vietnam"));
}
-
+
@Test
public void testSelectOptionByText() {
dropdownObject.selectDropdownByVisibleText("Vietnam");
assertEquals(dropdownObject.getFirstSelectedOptionText(), "Vietnam");
}
-
+
@Test
public void testAllSelectedOptions() {
dropdownObject.selectDropdownByIndex(5);
assertEquals(dropdownObject.getAllSelectedOptionsText()
.size(), 1);
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
- this.dropdownObject = BasePage.getDriver()
- .elementDropdownList(DropdownListTest.dropdownSelector);
- }
-
- @Override
- public void tearDown() {
-
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/HorizontalSliderTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/HorizontalSliderTest.java
index 089cd6e4..c5924a7e 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/HorizontalSliderTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/HorizontalSliderTest.java
@@ -1,51 +1,49 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
-import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
-import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.Test;
-import org.openqa.selenium.By;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
-public class HorizontalSliderTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private static final By sliderParent = By.cssSelector("div#tabs-2");
- private static final By sliderSelector = By.cssSelector("div#slider-range-max");
- private static final By valueSelector = By.cssSelector("#amount1");
+import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
+import com.capgemini.mrchecker.test.core.BaseTest;
+@Disabled
+public class HorizontalSliderTest extends BaseTest {
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private static final By sliderParent = By.cssSelector("div#tabs-2");
+ private static final By sliderSelector = By.cssSelector("div#slider-range-max");
+ private static final By valueSelector = By.cssSelector("#amount1");
+
private static final String HORIZONTAL_SLIDER_INITIAL_VALUE = "2";
-
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.SLIDER.subURL());
+ }
+
@Test
public void test() {
// check if element is displayed
assertTrue(BasePage.getDriver()
.elementHorizontalSlider(sliderParent)
.isDisplayed());
-
+
// check if element type equals HoizontalSlider
assertEquals("Horizontal Slider", BasePage.getDriver()
.elementHorizontalSlider(sliderParent, sliderSelector, valueSelector)
.getElementTypeName());
-
+
// check if element's initial value is equal to 2
assertEquals(new BigDecimal(HORIZONTAL_SLIDER_INITIAL_VALUE), BasePage.getDriver()
.elementHorizontalSlider(sliderParent, sliderSelector, valueSelector)
.getCurrentSliderValue());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.SLIDER.subURL());
- }
-
- @Override
- public void tearDown() {
-
- }
-
+
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ImageTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ImageTest.java
index 8042c33e..a487fc1e 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ImageTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/ImageTest.java
@@ -1,26 +1,29 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static junit.framework.TestCase.assertTrue;
/**
* Created by TTRZCINSKI on 19.10.2018.
*/
+@Disabled
public class ImageTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private static By img1 = By.cssSelector("img");
-
- @AfterClass
- public static void tearDownAll() {
-
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private static By img1 = By.cssSelector("img");
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
}
-
+
@Test
public void test() {
// check if label is displayed
@@ -28,16 +31,4 @@ public void test() {
.elementImage(ImageTest.img1)
.isDisplayed());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
- return;
- }
-
- @Override
- public void tearDown() {
- // TODO Auto-generated method stub
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/InputTextTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/InputTextTest.java
index fe727d53..fc0bd814 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/InputTextTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/InputTextTest.java
@@ -1,55 +1,46 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.InputTextElement;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
/**
* Created by LKURZAJ on 03.03.2017.
*/
+@Disabled
public class InputTextTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private static By firstNameInputText = By.cssSelector("input[id='name_3_firstname']");
-
- @AfterClass
- public static void tearDownAll() {
-
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private static By firstNameInputText = By.cssSelector("input[id='name_3_firstname']");
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
}
-
+
@Test()
public void testInputData() {
InputTextElement inputElement = BasePage.getDriver()
.elementInputText(InputTextTest.firstNameInputText);
-
+
// verify if input text is displayed
assertTrue(inputElement.isDisplayed());
-
+
// clear current text and verify (what to call getValue() or getText() depends
// on implementation)
inputElement.clearInputText();
assertEquals("", inputElement.getValue());
-
+
// input some text into input text and verify value
inputElement.setInputText("John");
assertEquals("John", inputElement.getValue());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
- return;
- }
-
- @Override
- public void tearDown() {
- // TODO Auto-generated method stub
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/LabelTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/LabelTest.java
index d6b7d826..66b3aac4 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/LabelTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/LabelTest.java
@@ -1,55 +1,46 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
/**
* Created by LKURZAJ on 03.03.2017.
*/
+@Disabled
public class LabelTest extends BaseTest {
QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
-
+
private static By text1Label = By.cssSelector("span.bcd");
-
- @AfterClass
- public static void tearDownAll() {
-
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
}
-
+
@Test
public void test() {
// check if label is displayed
assertTrue(BasePage.getDriver()
.elementLabel(LabelTest.text1Label)
.isDisplayed());
-
+
// check if label has properly text
assertEquals("Text1", BasePage.getDriver()
.elementLabel(LabelTest.text1Label)
.getText());
-
+
// check if label has properly class field
assertEquals("bcd", BasePage.getDriver()
.elementLabel(LabelTest.text1Label)
.getClassName());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.TOOLS_QA.subURL() + PageSubURLsEnum.AUTOMATION_PRACTICE_FORM.subURL());
- return;
- }
-
- @Override
- public void tearDown() {
- // TODO Auto-generated method stub
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/MenuTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/MenuTest.java
index 1c10a43d..38abe601 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/MenuTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/MenuTest.java
@@ -1,37 +1,40 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.MenuElement;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
/**
* Created by LKURZAJ on 08.03.2017.
*/
+@Disabled
public class MenuTest extends BaseTest {
QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
-
- private final static By menuSelector = By.cssSelector("div#tabs-1 ul.top-level");
- private final static By menu2Selector = By.cssSelector("div#tabs-2 ul.top-level");
- private final static By menuChildsSelector = By.cssSelector("li");
- private final static By subMenuSelector = By.cssSelector("ul");
- private final static By subMenuChildsSelector = By.cssSelector("li");
- private final static By subMenuTabSelector = By.cssSelector("li[aria-controls='tabs-2']");
- private MenuElement menuElement;
- private MenuElement menu2Element;
-
- @AfterClass
- public static void tearDownAll() {
-
+
+ private final static By menuSelector = By.cssSelector("div#tabs-1 ul.top-level");
+ private final static By menu2Selector = By.cssSelector("div#tabs-2 ul.top-level");
+ private final static By menuChildsSelector = By.cssSelector("li");
+ private final static By subMenuSelector = By.cssSelector("ul");
+ private final static By subMenuChildsSelector = By.cssSelector("li");
+ private final static By subMenuTabSelector = By.cssSelector("li[aria-controls='tabs-2']");
+ private MenuElement menuElement;
+ private MenuElement menu2Element;
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.MENU.subURL());
}
-
+
@Test
public void testMenuByIndex() {
menuElement = BasePage.getDriver()
@@ -39,7 +42,7 @@ public void testMenuByIndex() {
menuElement.selectItemByIndex(0);
assertEquals(this.getCurrentURL() + "#", menuElement.getItemLinkByIndex(0));
}
-
+
@Test
public void testMenuByText() {
menuElement = BasePage.getDriver()
@@ -47,21 +50,21 @@ public void testMenuByText() {
menuElement.selectItemByText("About");
assertEquals(this.getCurrentURL() + "#", menuElement.getItemLinkByText("About"));
}
-
+
@Test
public void testMenuItemsCount() {
menuElement = BasePage.getDriver()
.elementMenu(MenuTest.menuSelector);
assertEquals(5, menuElement.getItemsCount());
}
-
+
@Test
public void testMenuItemsText() {
menuElement = BasePage.getDriver()
.elementMenu(MenuTest.menuSelector);
assertEquals(Arrays.asList("Home", "About", "Contact", "FAQ", "News"), menuElement.getItemsTextList());
}
-
+
@Test
public void testSelectSubMenuItemByText() {
BasePage.getDriver()
@@ -72,7 +75,7 @@ public void testSelectSubMenuItemByText() {
MenuTest.subMenuSelector);
assertEquals(getCurrentURL() + "#", menu2Element.getSubMenuItemLinkByText("FAQ", "Sub Menu Item 3"));
}
-
+
@Test
public void testSelectSubMenuItemByIndex() {
BasePage.getDriver()
@@ -82,7 +85,7 @@ public void testSelectSubMenuItemByIndex() {
.elementMenu(MenuTest.menu2Selector, MenuTest.menuChildsSelector);
menu2Element.selectSubMenuItemByIndex(0, 1);
}
-
+
@Test
public void testLinkSubMenuItemByIndex() {
BasePage.getDriver()
@@ -92,7 +95,7 @@ public void testLinkSubMenuItemByIndex() {
.elementMenu(MenuTest.menu2Selector, MenuTest.menuChildsSelector);
assertEquals(getCurrentURL() + "#", menu2Element.getSubMenuItemLinkByIndex(0, 1));
}
-
+
@Test
public void testLinkSubMenuItemByText() {
BasePage.getDriver()
@@ -103,18 +106,7 @@ public void testLinkSubMenuItemByText() {
MenuTest.subMenuSelector, MenuTest.subMenuChildsSelector);
menu2Element.selectSubMenuItemByText("FAQ", "Sub Menu Item 3");
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.MENU.subURL());
- }
-
- @Override
- public void tearDown() {
-
- }
-
+
private String getCurrentURL() {
return PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.MENU.subURL();
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/NavigationBarTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/NavigationBarTest.java
index abf1ee97..080e3b24 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/NavigationBarTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/NavigationBarTest.java
@@ -1,48 +1,53 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.NavigationBarElement;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
/**
* Created by LKURZAJ on 07.03.2017.
*/
+@Disabled
public class NavigationBarTest extends BaseTest {
- private NavigationBarElement navigationBarElement;
- private final static By navigationBarSelector = By.cssSelector("ol#breadcrumbs");
- private final static By childsSelector = By.cssSelector("li");
-
- @AfterClass
- public static void tearDownAll() {
-
+ private NavigationBarElement navigationBarElement;
+ private final static By navigationBarSelector = By.cssSelector("ol#breadcrumbs");
+ private final static By childsSelector = By.cssSelector("li");
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TABS.subURL());
+ navigationBarElement = BasePage.getDriver()
+ .elementNavigationBar(NavigationBarTest.navigationBarSelector);
}
-
+
@Test
public void testGets() {
assertEquals("Home", this.navigationBarElement.getFirstItemText());
assertEquals("Tabs", this.navigationBarElement.getActiveItemText());
}
-
+
@Test
public void testClickByIndex() {
this.navigationBarElement.clickItemByIndex(1);
assertEquals("Tabs", this.navigationBarElement.getActiveItemText());
}
-
+
@Test
public void testClickByText() {
this.navigationBarElement.clickItemByText("Home");
assertEquals("Home", this.navigationBarElement.getActiveItemText());
}
-
+
@Test
public void testClickActiveItem() {
String url = BasePage.getDriver()
@@ -51,30 +56,17 @@ public void testClickActiveItem() {
assertEquals(url, BasePage.getDriver()
.getCurrentUrl());
}
-
+
@Test
public void testClickFirstItem() {
this.navigationBarElement.clickFirstItem();
assertEquals(1, this.navigationBarElement.getDepth());
}
-
+
@Test
public void testConstructor() {
NavigationBarElement navBarElem = BasePage.getDriver()
.elementNavigationBar(NavigationBarTest.navigationBarSelector, NavigationBarTest.childsSelector);
assertEquals(Arrays.asList("Home", "Tabs"), navBarElem.getItemsTextList());
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TABS.subURL());
- this.navigationBarElement = BasePage.getDriver()
- .elementNavigationBar(NavigationBarTest.navigationBarSelector);
- }
-
- @Override
- public void tearDown() {
-
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/QuickFixSeleniumPage.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/QuickFixSeleniumPage.java
index 6b4d47fa..279c406a 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/QuickFixSeleniumPage.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/QuickFixSeleniumPage.java
@@ -1,22 +1,25 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import org.junit.jupiter.api.Disabled;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
+@Disabled
public class QuickFixSeleniumPage extends BasePage {
- //This page is created to fix Selenium Session Exception from tes.WebElements test cases.
- //When the test cases are refactored, this page should be deleted.
-
+ // This page is created to fix Selenium Session Exception from tes.WebElements test cases.
+ // When the test cases are refactored, this page should be deleted.
+
@Override
public boolean isLoaded() {
getDriver().waitForPageLoaded();
return true;
}
-
+
@Override
public void load() {
-
+
}
-
+
@Override
public String pageTitle() {
return getActualPageTitle();
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/RadioButtonTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/RadioButtonTest.java
index b16a8068..6f9f5fa7 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/RadioButtonTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/RadioButtonTest.java
@@ -1,40 +1,45 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
-import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.RadioButtonElement;
-import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
+import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.RadioButtonElement;
+import com.capgemini.mrchecker.test.core.BaseTest;
/**
* Created by LKURZAJ on 28.02.2017.
*/
+@Disabled
public class RadioButtonTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private RadioButtonElement maritalStatusRadioButton;
- private final static By selectorMaritalStatus = By.cssSelector("div[class='radio_wrap']");
- private final static int radioElementsCount = 3;
- private final static List possibleValues = Arrays.asList("Single", "Married", "Divorced");
-
- @AfterClass
- public static void tearDownAll() {
-
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private RadioButtonElement maritalStatusRadioButton;
+ private final static By selectorMaritalStatus = By.cssSelector("div[class='radio_wrap']");
+ private final static int radioElementsCount = 3;
+ private final static List possibleValues = Arrays.asList("Single", "Married", "Divorced");
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
+ maritalStatusRadioButton = BasePage.getDriver()
+ .elementRadioButton(selectorMaritalStatus);
}
-
+
@Test
public void testRadioButtonElementsCount() {
// check if appropriate number of radio button elements is displayed
assertEquals(radioElementsCount, maritalStatusRadioButton.getItemsCount());
}
-
+
@Test
public void testPossibleValues() {
List elementValues = this.maritalStatusRadioButton.getTextList();
@@ -42,20 +47,20 @@ public void testPossibleValues() {
assertEquals(RadioButtonTest.possibleValues.get(i), elementValues.get(i));
}
}
-
+
@Test
public void testSelection() {
// select and check by index
maritalStatusRadioButton.selectItemByIndex(0);
assertEquals(maritalStatusRadioButton.getSelectedItemIndex(), 0);
assertTrue(maritalStatusRadioButton.isItemSelectedByIndex(0));
-
+
// select and check by value
maritalStatusRadioButton.selectItemByValue("married");
assertEquals(maritalStatusRadioButton.getSelectedItemValue(), "married");
assertTrue(maritalStatusRadioButton.isItemSelectedByValue("married"));
}
-
+
@Test
public void testSelectionSpecifiedItem() {
// example of usage Radio Button with other constructor's arguments
@@ -66,18 +71,5 @@ public void testSelectionSpecifiedItem() {
assertEquals(maritalStatusRadioButton.getSelectedItemIndex(), 2);
assertTrue(maritalStatusRadioButton.isItemSelectedByIndex(2));
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.REGISTRATION.subURL());
- this.maritalStatusRadioButton = BasePage.getDriver()
- .elementRadioButton(selectorMaritalStatus);
- }
-
- @Override
- public void tearDown() {
- // TODO Auto-generated method stub
- }
-
+
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TabTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TabTest.java
index 3e26e421..a8f05fc2 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TabTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TabTest.java
@@ -1,41 +1,47 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
-import com.capgemini.mrchecker.selenium.core.BasePage;
-import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
-import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TabElement;
-import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
+import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
+import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TabElement;
+import com.capgemini.mrchecker.test.core.BaseTest;
/**
* Created by LKURZAJ on 06.03.2017.
*/
-public class TabTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private final static By tabSelector = By.cssSelector("ul[role='tablist']");
- private TabElement tabObject;
- private final static List possibleValues = Arrays.asList("Tab 1", "Tab 2", "Tab 3");
- private final static By tabChildsSelector = By.cssSelector("li");
- private final static List listSelectedAttributes = Arrays.asList("ui-tabs-active ui-state-active");
-
- @AfterClass
- public static void tearDownAll() {
+@Disabled
+public class TabTest extends BaseTest {
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private final static By tabSelector = By.cssSelector("ul[role='tablist']");
+ private TabElement tabObject;
+ private final static List possibleValues = Arrays.asList("Tab 1", "Tab 2", "Tab 3");
+ private final static By tabChildsSelector = By.cssSelector("li");
+ private final static List listSelectedAttributes = Arrays.asList("ui-tabs-active ui-state-active");
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TABS.subURL());
+ tabObject = BasePage.getDriver()
+ .elementTab(TabTest.tabSelector);
}
-
+
@Test
public void testRadioButtonElementsCount() {
// check if appropriate number of radio button elements is displayed
assertEquals(3, tabObject.getItemsCount());
}
-
+
@Test
public void testPossibleValues() {
List elementValues = this.tabObject.getTextList();
@@ -43,19 +49,19 @@ public void testPossibleValues() {
assertEquals(TabTest.possibleValues.get(i), elementValues.get(i));
}
}
-
+
@Test
public void testSelection() {
// select and check by index
tabObject.selectItemByIndex(2);
assertEquals(tabObject.getSelectedItemIndex(), 2);
assertTrue(tabObject.isItemSelectedByIndex(2));
-
+
// select and check by text
tabObject.selectItemByText("Tab 1");
assertEquals(tabObject.getSelectedItemText(), "Tab 1");
}
-
+
@Test
public void testSelectionSpecifiedItem() {
tabObject = BasePage.getDriver()
@@ -65,16 +71,5 @@ public void testSelectionSpecifiedItem() {
assertEquals(tabObject.getSelectedItemIndex(), 1);
assertTrue(tabObject.isItemSelectedByIndex(1));
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TABS.subURL());
- this.tabObject = BasePage.getDriver()
- .elementTab(TabTest.tabSelector);
- }
-
- @Override
- public void tearDown() {
- }
+
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TooltipTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TooltipTest.java
index fc4ea286..6677e3fa 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TooltipTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/TooltipTest.java
@@ -1,28 +1,32 @@
package com.capgemini.mrchecker.selenium.core.tests.webElements;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+
import com.capgemini.mrchecker.selenium.core.BasePage;
import com.capgemini.mrchecker.selenium.core.enums.PageSubURLsEnum;
import com.capgemini.mrchecker.selenium.core.newDrivers.elementType.TooltipElement;
import com.capgemini.mrchecker.test.core.BaseTest;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.openqa.selenium.By;
-
-import static org.junit.Assert.assertTrue;
/**
* Created by LKURZAJ on 08.03.2017.
*/
+@Disabled
public class TooltipTest extends BaseTest {
- QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
- private final static By tooltipSelector = By.cssSelector("div.ui-tooltip");
- private final static By inputTextSelector = By.cssSelector("input[id='age']");
- TooltipElement tooltipElement;
-
- @AfterClass
- public static void tearDownAll() {
+ QuickFixSeleniumPage quickFixSeleniumPage = new QuickFixSeleniumPage();
+ private final static By tooltipSelector = By.cssSelector("div.ui-tooltip");
+ private final static By inputTextSelector = By.cssSelector("input[id='age']");
+ TooltipElement tooltipElement;
+
+ @Override
+ public void setUp() {
+ BasePage.getDriver()
+ .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TOOLTIP.subURL());
}
-
+
@Test
public void test() {
// hover mouse on input text element
@@ -32,21 +36,11 @@ public void test() {
.perform();
this.tooltipElement = BasePage.getDriver()
.elementTooltip(TooltipTest.tooltipSelector);
-
+
// check if tooltip is displayed
assertTrue(this.tooltipElement.isDisplayed());
-
+
// check if tooltip text contains appropriate expression
assertTrue(this.tooltipElement.isTextContains("We ask for your age"));
}
-
- @Override
- public void setUp() {
- BasePage.getDriver()
- .get(PageSubURLsEnum.WWW_FONT_URL.subURL() + PageSubURLsEnum.TOOLTIP.subURL());
- }
-
- @Override
- public void tearDown() {
- }
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/_TestSuiteRemote.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/_TestSuiteRemote.java
deleted file mode 100644
index e0894191..00000000
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/tests/webElements/_TestSuiteRemote.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.capgemini.mrchecker.selenium.core.tests.webElements;
-
-import org.junit.runner.RunWith;
-
-import com.googlecode.junittoolbox.ExcludeCategories;
-import com.googlecode.junittoolbox.SuiteClasses;
-import com.googlecode.junittoolbox.WildcardPatternSuite;
-
-@RunWith(WildcardPatternSuite.class)
-@ExcludeCategories({})
-@SuiteClasses({ "*Test.class" })
-
-public class _TestSuiteRemote {
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/utils/OperationsOnFilesTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/utils/OperationsOnFilesTest.java
index f297f505..1d66c8d1 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/utils/OperationsOnFilesTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/utils/OperationsOnFilesTest.java
@@ -3,13 +3,13 @@
import java.io.File;
import java.io.IOException;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.capgemini.mrchecker.selenium.core.utils.OperationsOnFiles;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+@Disabled
public class OperationsOnFilesTest {
private String testSourceFile = "sourceTest.txt";
@@ -25,7 +25,7 @@ public class OperationsOnFilesTest {
File goodTargetFile;
File badTargetfile;
- @Before
+ @BeforeEach
public void setUp() throws IOException {
goodSourceFile = new File(goodSourceFilePath);
badSourceFile = new File(badSourceFilePath);
@@ -33,13 +33,13 @@ public void setUp() throws IOException {
badTargetfile = new File(badTargetFilePath);
Assert.assertTrue("Failed to create source directories.", goodSourceFile.getParentFile()
- .mkdirs());
+ .mkdirs());
Assert.assertTrue("Failed to create source file.", goodSourceFile.createNewFile());
Assert.assertTrue("Failed to create target directories.", goodTargetFile.getParentFile()
- .mkdirs());
+ .mkdirs());
}
- @After
+ @AfterEach
public void tearDown() throws IOException {
OperationsOnFiles.removeFileAndParentsIfEmpty(goodSourceFile.toPath());
OperationsOnFiles.removeFileAndParentsIfEmpty(goodTargetFile.toPath());
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/IntegrationTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/IntegrationTest.java
new file mode 100644
index 00000000..5940fd0f
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/IntegrationTest.java
@@ -0,0 +1,14 @@
+package com.capgemini.mrchecker.selenium.tags;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.junit.jupiter.api.Tag;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Tag("IntegrationTest")
+public @interface IntegrationTest {
+}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/UnitTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/UnitTest.java
new file mode 100644
index 00000000..aba7915d
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/tags/UnitTest.java
@@ -0,0 +1,14 @@
+package com.capgemini.mrchecker.selenium.tags;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.junit.jupiter.api.Tag;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Tag("UnitTest")
+public @interface UnitTest {
+}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/testsuites/UnitTestsSuite.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/testsuites/UnitTestsSuite.java
new file mode 100644
index 00000000..6788bfb5
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/testsuites/UnitTestsSuite.java
@@ -0,0 +1,12 @@
+package com.capgemini.mrchecker.selenium.testsuites;
+
+import org.junit.platform.runner.JUnitPlatform;
+import org.junit.platform.suite.api.IncludeTags;
+import org.junit.platform.suite.api.SelectPackages;
+import org.junit.runner.RunWith;
+
+@RunWith(JUnitPlatform.class)
+@IncludeTags({ "UnitTest" })
+@SelectPackages("com.capgemini.mrchecker.selenium")
+public class UnitTestsSuite {
+}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/BasePageTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/BasePageTest.java
similarity index 57%
rename from mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/BasePageTest.java
rename to mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/BasePageTest.java
index 775d7460..dd09af76 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/BasePageTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/BasePageTest.java
@@ -1,33 +1,28 @@
-package com.capgemini.mrchecker.selenium;
+package com.capgemini.mrchecker.selenium.unit;
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
import com.capgemini.mrchecker.selenium.core.BasePage;
+import com.capgemini.mrchecker.selenium.tags.UnitTest;
import com.capgemini.mrchecker.test.core.BaseTest;
+import com.capgemini.mrchecker.test.core.utils.PageFactory;
+@UnitTest
+@ResourceLock(value = "SingleThread")
public class BasePageTest extends BaseTest {
- @Override
- public void setUp() {
-
- }
-
- @Override
- public void tearDown() {
-
- }
-
@Test
public void testGetDriver() {
- TestPage testPage = new TestPage();
+ TestPage testPage = PageFactory.getPageInstance(TestPage.class);
assertEquals("", "Google", testPage.pageTitle());
}
- private class TestPage extends BasePage {
+ public static class TestPage extends BasePage {
@Override
public boolean isLoaded() {
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/properties/PropertiesManagerTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/properties/PropertiesManagerTest.java
similarity index 59%
rename from mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/properties/PropertiesManagerTest.java
rename to mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/properties/PropertiesManagerTest.java
index 1c08ae72..39de6456 100644
--- a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/core/base/properties/PropertiesManagerTest.java
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/properties/PropertiesManagerTest.java
@@ -1,72 +1,93 @@
-package com.capgemini.mrchecker.selenium.core.base.properties;
+package com.capgemini.mrchecker.selenium.unit.base.properties;
-import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import org.junit.*;
+import static org.junit.Assert.assertEquals;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
import java.nio.file.Paths;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
-public class PropertiesManagerTest {
+import com.capgemini.mrchecker.selenium.core.base.properties.PropertiesSelenium;
+import com.capgemini.mrchecker.selenium.tags.UnitTest;
+import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
+import com.capgemini.mrchecker.test.core.exceptions.BFInputDataException;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
- @BeforeClass
+@UnitTest
+@ResourceLock(value = "SingleThread")
+public class PropertiesManagerTest {
+
+ @BeforeAll
public static void setUpBeforeClass() {
}
-
- @AfterClass
+
+ @AfterAll
public static void tearDownAfterClass() {
}
-
+
private PropertiesSelenium propertiesSelenium;
-
- @Before
+
+ @BeforeEach
public void setUp() {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
- this.propertiesSelenium = i.getInstance(PropertiesSelenium.class);
+ try {
+ InputStream fileSource = new FileInputStream(path);
+
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(fileSource));
+ this.propertiesSelenium = i.getInstance(PropertiesSelenium.class);
+ } catch (FileNotFoundException e) {
+ throw new BFInputDataException("Default file not found in: " + path);
+ }
+
}
-
- @After
+
+ @AfterEach
public void tearDown() {
PropertiesSettingsModule.delInstance();
}
-
+
@Test
public void testParamterGetChrome() {
assertEquals("", "chromedriver.exe", propertiesSelenium.getSeleniumChrome());
}
-
+
@Test
public void testParamterGetFirefox() {
assertEquals("", "geckodriver.exe", propertiesSelenium.getSeleniumFirefox());
}
-
+
@Test
public void testParamterGetIE() {
assertEquals("", "IEDriverServer.exe", propertiesSelenium.getSeleniumIE());
}
-
+
@Test
public void testParamterGetEdge() {
assertEquals("", "edgedriver.exe", propertiesSelenium.getSeleniumEdge());
}
-
+
@Test
public void testParamterGetOpera() {
assertEquals("", "operadriver.exe", propertiesSelenium.getSeleniumOpera());
}
-
+
// @Ignore
@Test
public void testDefaultParamters() {
PropertiesSettingsModule.delInstance();
-
+
Injector i = Guice.createInjector(PropertiesSettingsModule.init());
PropertiesSelenium propertiesSelenium = i.getInstance(PropertiesSelenium.class);
-
+
assertEquals("", "./lib/webdrivers/chrome/chromedriver.exe", propertiesSelenium.getSeleniumChrome());
}
-
+
}
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/runtime/RuntimeParametersTest.java b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/runtime/RuntimeParametersTest.java
new file mode 100644
index 00000000..16c02361
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/java/com/capgemini/mrchecker/selenium/unit/base/runtime/RuntimeParametersTest.java
@@ -0,0 +1,189 @@
+package com.capgemini.mrchecker.selenium.unit.base.runtime;
+
+import static com.capgemini.mrchecker.selenium.core.base.runtime.RuntimeParametersSelenium.INVALID_IE_NAME;
+import static com.capgemini.mrchecker.selenium.core.base.runtime.RuntimeParametersSelenium.VALID_IE_NAME;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.hamcrest.core.IsNull.nullValue;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
+
+import com.capgemini.mrchecker.selenium.core.base.runtime.RuntimeParametersSelenium;
+import com.capgemini.mrchecker.selenium.tags.UnitTest;
+
+@UnitTest
+@ResourceLock(value = "SingleThread")
+public class RuntimeParametersTest {
+
+ private static final Map STARTUP_PARAMETERS_VALUES = new LinkedHashMap() {
+ {
+ put("browser", "magicbrowser");
+ put("browserVersion", "11.0");
+ put("seleniumGrid", "smth");
+ put("os", "linux");
+ put("browserOptions",
+ "headless;window-size=1200x600;testEquals=FirstEquals=SecondEquals;--testMe;acceptInsecureCerts=true;maxInstances=3");
+ }
+ };
+
+ public static final String DEFAULT_BROWSER_VALUE = "chrome";
+ public static final String BROWSER_OPTIONS_TEST_KEY = "browserOptionsTestKey";
+
+ @BeforeEach
+ public void setUp() {
+ STARTUP_PARAMETERS_VALUES.forEach(System::setProperty);
+ refreshAllParameters();
+ }
+
+ @AfterEach
+ public void tearDown() {
+ STARTUP_PARAMETERS_VALUES.forEach((k, v) -> System.clearProperty(k));
+ refreshAllParameters();
+ }
+
+ private static void refreshAllParameters() {
+ doForEachParam(RuntimeParametersSelenium::refreshParameterValue);
+ }
+
+ private static void doForEachParam(Consumer applyFunction) {
+ Arrays.stream(RuntimeParametersSelenium.values())
+ .forEach(applyFunction);
+ }
+
+ @Test
+ public void shouldGetAllStartupProperties() {
+ doForEachParam((e) -> assertThat(e.toString() + " failed!", e.getValue(), is(equalTo(STARTUP_PARAMETERS_VALUES.get(e.getKey())))));
+ }
+
+ @Test
+ public void shouldGetReturnLowercaseBrowserValue() {
+ System.setProperty("browser", STARTUP_PARAMETERS_VALUES.get("browser")
+ .toUpperCase());
+
+ refreshAllParameters();
+ String browserValue = RuntimeParametersSelenium.BROWSER.getValue();
+
+ assertThat(browserValue, is(equalTo(STARTUP_PARAMETERS_VALUES.get(RuntimeParametersSelenium.BROWSER.getKey()))));
+ }
+
+ @Test
+ public void shouldGetReturnDefaultBrowserValue() {
+ Arrays.stream(new String[] { "", "null" })
+ .forEach((s) -> {
+ System.setProperty("browser", s);
+
+ refreshAllParameters();
+ String browserValue = RuntimeParametersSelenium.BROWSER.getValue();
+
+ assertThat("Failed for '" + s + "'!", browserValue, is(equalTo(DEFAULT_BROWSER_VALUE)));
+ });
+ }
+
+ @Test
+ public void shouldGetReturnDefaultBrowserValueWhenNoSystemProperty() {
+ System.clearProperty("browser");
+
+ refreshAllParameters();
+ String browserValue = RuntimeParametersSelenium.BROWSER.getValue();
+
+ assertThat(browserValue, is(equalTo(DEFAULT_BROWSER_VALUE)));
+ }
+
+ @Test
+ public void shouldGetValidIEName() {
+ System.setProperty("browser", INVALID_IE_NAME);
+
+ refreshAllParameters();
+ String browserValue = RuntimeParametersSelenium.BROWSER.getValue();
+
+ assertThat(browserValue, is(equalTo(VALID_IE_NAME)));
+
+ }
+
+ @Test
+ public void shouldBrowserOptionBeBoolean() {
+ shouldBrowserOptionBeOfClass("true", Boolean.class);
+ }
+
+ @Test
+ public void shouldBrowserOptionBeInteger() {
+ shouldBrowserOptionBeOfClass("123", Integer.class);
+ }
+
+ @Test
+ public void shouldBrowserOptionBeIntegerFloat() {
+ shouldBrowserOptionBeOfClass("123.321", Float.class);
+ }
+
+ @Test
+ public void shouldBrowserOptionBeIntegerString() {
+ shouldBrowserOptionBeOfClass("blue", String.class);
+ }
+
+ private void shouldBrowserOptionBeOfClass(String value, Class> clazz) {
+ System.setProperty("browserOptions", BROWSER_OPTIONS_TEST_KEY + "=" + value);
+
+ refreshAllParameters();
+ Map browserOptionsValues = RuntimeParametersSelenium.BROWSER_OPTIONS.getValues();
+ Object optionValue = browserOptionsValues.get(BROWSER_OPTIONS_TEST_KEY);
+
+ assertThat(optionValue, is(instanceOf(clazz)));
+ }
+
+ @Test
+ public void shouldGetProperBrowserOptionsValuesSize() {
+ final String[] browserOptions = STARTUP_PARAMETERS_VALUES.get(RuntimeParametersSelenium.BROWSER_OPTIONS.getKey())
+ .split(";");
+
+ int browserOptionsCount = RuntimeParametersSelenium.BROWSER_OPTIONS.getValues()
+ .size();
+
+ assertThat(browserOptionsCount, is(equalTo(browserOptions.length)));
+ }
+
+ @Test
+ public void shouldGetProperBrowserOptionsValuesContents() {
+ final String[] browserOptions = STARTUP_PARAMETERS_VALUES.get(RuntimeParametersSelenium.BROWSER_OPTIONS.getKey())
+ .split(";");
+
+ Map browserOptionsValues = RuntimeParametersSelenium.BROWSER_OPTIONS.getValues();
+
+ browserOptionsValues.forEach((key, value) -> {
+ try {
+ String browserOption = Arrays.stream(browserOptions)
+ .filter(s -> s.startsWith(key))
+ .findFirst()
+ .orElseThrow(Exception::new);
+
+ assertThat(browserOption.endsWith(value.toString()), is(equalTo(true)));
+ } catch (Exception e) {
+ fail(key + " does NOT exist");
+ }
+ });
+ }
+
+ @Test
+ public void shouldGetProperBrowserOptionsValuesBeNull() {
+ Map browserOptionsValues = RuntimeParametersSelenium.BROWSER.getValues();
+
+ assertThat(browserOptionsValues, is(nullValue()));
+ }
+
+ @Test
+ public void shouldToStringReturnKeyValue() {
+ String toStringValue = RuntimeParametersSelenium.BROWSER.toString();
+
+ assertThat(toStringValue, is(equalTo("browser=" + STARTUP_PARAMETERS_VALUES.get("browser"))));
+ }
+}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/allure.properties b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/allure.properties
new file mode 100644
index 00000000..6c1e0bb1
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/allure.properties
@@ -0,0 +1 @@
+allure.results.directory=target/allure-results
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/junit-platform.properties b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/junit-platform.properties
new file mode 100644
index 00000000..0a5f88f7
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-selenium-module/src/test/resources/junit-platform.properties
@@ -0,0 +1,8 @@
+junit.jupiter.extensions.autodetection.enabled=true
+junit.jupiter.execution.parallel.enabled=true
+#junit.jupiter.execution.parallel.mode.default=concurrent
+junit.jupiter.execution.parallel.mode.default=same_thread
+junit.jupiter.execution.parallel.mode.classes.default=concurrent
+#junit.jupiter.execution.parallel.mode.classes.default=same_thread
+junit.jupiter.execution.parallel.config.strategy=dynamic
+junit.jupiter.execution.parallel.config.dynamic.factor=1
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/pom.xml b/mrchecker-framework-modules/mrchecker-webapi-module/pom.xml
index 5e1717b6..6e1caeda 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/pom.xml
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/pom.xml
@@ -1,25 +1,25 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
mrchecker-test-framework
com.capgemini.mrchecker
- 2.4.2-SNAPSHOT
+ 3.0.1-SNAPSHOT
mrchecker-webapi-module
- 1.2.3-SNAPSHOT
+ 1.2.4-SNAPSHOT
jar
MrChecker - WebApi - Module
-
+
MrChecker WebApi supports:
- testing REST and SOAP services,
- sending REST queries (POST, GET, PUT, PATCH, DELETE),
- parsing XML, JSON and HTML documents,
- handling Cookies,
- - SSO (Single Sign-On) authentication process.
+ - SSO (Single Sign-On) authentication process.
https://github.com/devonfw/devonfw-testing
@@ -32,21 +32,21 @@
Lukasz Stefaniszyn
lukasz.stefaniszyn@capgemini.com
- Capgemini - Nearshore Test Center - Poland
+ Capgemini - Nearshore Test Center - Poland
http://nsc.capgemini.com/nearshoretestcenter
Tomasz Supel
tomasz.supel@capgemini.com
- Capgemini - Nearshore Test Center - Poland
+ Capgemini - Nearshore Test Center - Poland
http://nsc.capgemini.com/nearshoretestcenter
Pawel Szczesny
pawel.szczesny@capgemini.com
- Capgemini - Nearshore Test Center - Poland
+ Capgemini - Nearshore Test Center - Poland
http://nsc.capgemini.com/nearshoretestcenter
@@ -65,12 +65,9 @@
-
-
UTF8
- 4.12.1.4-SNAPSHOT
-
+ 5.6.2.1-SNAPSHOT
2.21.0
@@ -123,6 +120,24 @@
jasypt
+
+
+
+ io.qameta.allure
+ allure-junit5
+ test
+
+
+
+ io.qameta.allure
+ allure-junit-platform
+
+
+
+ io.qameta.allure
+ allure-java-commons
+
+
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPI.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPI.java
index bbf13022..d4c532fa 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPI.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPI.java
@@ -1,16 +1,7 @@
package com.capgemini.mrchecker.webapi.core;
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.BaseTestWatcher;
-import com.capgemini.mrchecker.test.core.ITestObserver;
-import com.capgemini.mrchecker.test.core.ModuleType;
-import com.capgemini.mrchecker.test.core.analytics.IAnalytics;
-import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.core.base.properties.PropertiesFileSettings;
-import com.capgemini.mrchecker.webapi.core.base.runtime.RuntimeParameters;
import java.io.IOException;
+import java.util.Objects;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
@@ -20,21 +11,30 @@
import org.xml.sax.SAXException;
-import com.capgemini.mrchecker.webapi.soap.SoapMessageGenerator;
+import com.capgemini.mrchecker.test.core.BaseTest;
+import com.capgemini.mrchecker.test.core.ModuleType;
+import com.capgemini.mrchecker.test.core.Page;
+import com.capgemini.mrchecker.test.core.analytics.IAnalytics;
+import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
+import com.capgemini.mrchecker.test.core.logger.BFLogger;
+import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
+import com.capgemini.mrchecker.webapi.core.base.properties.PropertiesFileSettings;
+import com.capgemini.mrchecker.webapi.core.base.runtime.RuntimeParameters;
+import com.capgemini.mrchecker.webapi.core.soap.SoapMessageGenerator;
import com.google.inject.Guice;
import com.jamesmurty.utils.XMLBuilder;
-abstract public class BasePageWebAPI implements ITestObserver, IWebAPI {
+public abstract class BasePageWebAPI extends Page implements IWebAPI {
private static DriverManager driver = null;
private final static PropertiesFileSettings propertiesFileSettings;
- private final static IAnalytics analytics;
- public final static String analitycsCategoryName = "WebAPI-Module";
+ private final static IAnalytics ANALYTICS;
+ public final static String ANALYTICS_CATEGORY_NAME = "WebAPI-Module";
static {
// Get analytics instance created in BaseTets
- analytics = BaseTest.getAnalytics();
+ ANALYTICS = BaseTest.getAnalytics();
// Get and then set properties information from selenium.settings file
propertiesFileSettings = setPropertiesSettings();
@@ -43,53 +43,15 @@ abstract public class BasePageWebAPI implements ITestObserver, IWebAPI {
setRuntimeParametersWebApi();
// Read Environment variables either from environmnets.csv or any other input data.
- setEnvironmetInstance();
+ setEnvironmentInstance();
}
public static IAnalytics getAnalytics() {
- return BasePageWebAPI.analytics;
+ return ANALYTICS;
}
public BasePageWebAPI() {
- this(getDriver());
- }
-
- public BasePageWebAPI(DriverManager driver) {
- // Add given module to Test core Observable list
- this.addObserver();
- }
-
- @Override
- public void addObserver() {
- BaseTestWatcher.addObserver(this);
- }
-
- @Override
- public void onTestFailure() {
- BFLogger.logDebug("BasePage.onTestFailure " + this.getClass()
- .getSimpleName());
- }
-
- @Override
- public void onTestSuccess() {
- // All actions needed while test method is success
- BFLogger.logDebug("BasePage.onTestSuccess " + this.getClass()
- .getSimpleName());
- }
-
- @Override
- public void onTestFinish() {
- // All actions needed while test class is finishing
- BFLogger.logDebug("BasePage.onTestFinish " + this.getClass()
- .getSimpleName());
- BaseTestWatcher.removeObserver(this);
- }
-
- @Override
- public void onTestClassFinish() {
- BFLogger.logDebug("BasePage.onTestClassFinish " + this.getClass()
- .getSimpleName());
- BFLogger.logDebug("driver:" + getDriver().toString());
+ getDriver();
}
@Override
@@ -98,7 +60,7 @@ public ModuleType getModuleType() {
}
public static DriverManager getDriver() {
- if (BasePageWebAPI.driver == null) {
+ if (Objects.isNull(BasePageWebAPI.driver)) {
// Create module driver
BasePageWebAPI.driver = new DriverManager(propertiesFileSettings);
}
@@ -107,19 +69,18 @@ public static DriverManager getDriver() {
private static PropertiesFileSettings setPropertiesSettings() {
// Get and then set properties information from settings.properties file
- PropertiesFileSettings propertiesFileSettings = Guice.createInjector(PropertiesSettingsModule.init())
- .getInstance(PropertiesFileSettings.class);
- return propertiesFileSettings;
+ return Guice.createInjector(PropertiesSettingsModule.init())
+ .getInstance(PropertiesFileSettings.class);
}
private static void setRuntimeParametersWebApi() {
// Read System or maven parameters
BFLogger.logDebug(java.util.Arrays.asList(RuntimeParameters.values())
- .toString());
+ .toString());
}
- private static void setEnvironmetInstance() {
+ private static void setEnvironmentInstance() {
/*
* Environment variables either from environmnets.csv or any other input data. For now there is no properties
* settings file for Selenium module. In future, please have a look on Core Module IEnvironmentService
@@ -128,7 +89,7 @@ private static void setEnvironmetInstance() {
}
- public class SOAPTemplate {
+ public static class SOAPTemplate {
private XMLBuilder xmlBody;
@@ -146,9 +107,10 @@ public String getMessage() {
String message = "";
try {
SOAPMessage soapMessage = SoapMessageGenerator.createSOAPmessage(this.getRoot()
- .asString());
+ .asString());
message = SoapMessageGenerator.printSoapMessage(soapMessage);
} catch (SOAPException | SAXException | IOException | ParserConfigurationException | TransformerException e) {
+ // TODO: refactor that
new Exception(e);
}
return message;
@@ -170,6 +132,7 @@ private void setRoot(String nodeName) {
try {
this.xmlBody = XMLBuilder.create(nodeName);
} catch (ParserConfigurationException | FactoryConfigurationError e) {
+ // TODO: refactor that
new Exception(e);
}
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPIAutoRegistration.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPIAutoRegistration.java
new file mode 100644
index 00000000..0672fde3
--- /dev/null
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/BasePageWebAPIAutoRegistration.java
@@ -0,0 +1,14 @@
+package com.capgemini.mrchecker.webapi.core;
+
+/**
+ * The instances of BasePageWebAPIAutoRegistration class are added to the test execution observer automatically in
+ * constructor.
+ * Although this operation is unsafe, it's been added to support migration from MrChecker Junit4 to Junit5.
+ */
+@Deprecated
+public abstract class BasePageWebAPIAutoRegistration extends BasePageWebAPI {
+
+ public BasePageWebAPIAutoRegistration() {
+ addToTestExecutionObserver();
+ }
+}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/IWebAPI.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/IWebAPI.java
index dbb159eb..7a34a42e 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/IWebAPI.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/IWebAPI.java
@@ -5,5 +5,5 @@ public interface IWebAPI {
/**
* @return URL Endpoint in String format
*/
- public String getEndpoint();
+ String getEndpoint();
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManager.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManager.java
index 2850ca6e..98c8ad46 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManager.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManager.java
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.net.ServerSocket;
+import java.util.Objects;
import com.capgemini.mrchecker.test.core.logger.BFLogger;
import com.capgemini.mrchecker.webapi.core.base.properties.PropertiesFileSettings;
@@ -30,16 +31,14 @@ public class DriverManager {
@Inject
public DriverManager(@Named("properties") PropertiesFileSettings propertiesFileSettings) {
-
- if (null == DriverManager.propertiesFileSettings) {
+ if (Objects.isNull(DriverManager.propertiesFileSettings)) {
DriverManager.propertiesFileSettings = propertiesFileSettings;
}
- this.start();
+ start();
}
public void start() {
-
if (DriverManager.propertiesFileSettings.isVirtualServerEnabled()) {
DriverManager.getDriverVirtualService();
}
@@ -51,19 +50,21 @@ public void stop() {
closeDriverVirtualServer();
BFLogger.logDebug("Closing Driver in stop()");
} catch (Exception e) {
+ // TODO: refactor that
e.printStackTrace();
}
}
+ // TODO: refactor that
@Override
protected void finalize() throws Throwable {
super.finalize();
- this.stop();
+ stop();
}
public static void clearAllDrivers() {
- driverVirtualizedService = new ThreadLocal();
-// driverVirtualizedService.remove();
+ driverVirtualizedService = new ThreadLocal<>();
+ // driverVirtualizedService.remove();
}
public static WireMock getDriverVirtualService() {
@@ -89,7 +90,7 @@ public static String getHttpHost() {
VirtualizedService virtualizedService = getVirtualizedService();
return virtualizedService.getHttpHost();
}
-
+
public static String getEndpointBaseUri() {
VirtualizedService virtualizedService = getVirtualizedService();
return virtualizedService.getEndpointBaseUri();
@@ -97,7 +98,7 @@ public static String getEndpointBaseUri() {
private static VirtualizedService getVirtualizedService() {
VirtualizedService virtualizedService = driverVirtualizedService.get();
- if (null == virtualizedService) {
+ if (Objects.isNull(virtualizedService)) {
virtualizedService = createDriverVirtualServer();
driverVirtualizedService.set(virtualizedService);
}
@@ -113,18 +114,18 @@ public static RequestSpecification getDriverWebAPI() {
public static void closeDriverVirtualServer() {
VirtualizedService virtualizedService = driverVirtualizedService.get();
- if (null != virtualizedService) {
+ if (!Objects.isNull(virtualizedService)) {
WireMock driver = virtualizedService.getDriver();
WireMockServer driverServer = virtualizedService.getDriverServer();
BFLogger.logDebug(
"Closing communication to Virualize Service under: " + driver.toString());
try {
- if (null != driver) {
+ if (!Objects.isNull(driver)) {
// driver.shutdown();
}
- if (null != driverServer) {
+ if (!Objects.isNull(driverServer)) {
driverServer.stop();
}
@@ -195,7 +196,7 @@ private String getHost() {
private int getPort() {
return RuntimeParameters.MOCK_HTTP_PORT.getValue()
.isEmpty()
- ? this.findFreePort()
+ ? findFreePort()
: getInteger(RuntimeParameters.MOCK_HTTP_PORT.getValue());
}
@@ -210,9 +211,7 @@ private int getPort() {
* if unable to find a free port
*/
private int findFreePort() throws IllegalStateException {
- ServerSocket socket = null;
- try {
- socket = new ServerSocket(0);
+ try (ServerSocket socket = new ServerSocket(0)) {
socket.setReuseAddress(true);
int port = socket.getLocalPort();
try {
@@ -222,14 +221,7 @@ private int findFreePort() throws IllegalStateException {
}
return port;
} catch (IOException e) {
- } finally {
- if (socket != null) {
- try {
- socket.close();
- } catch (IOException e) {
- // Ignore IOException on close()
- }
- }
+ // TODO: refactor that
}
throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
}
@@ -249,6 +241,5 @@ private int getInteger(String value) {
public VirtualizedService getDriver() {
return null;
}
-
}
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/VirtualizedService.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/VirtualizedService.java
index fec7d799..d1db627e 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/VirtualizedService.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/driver/VirtualizedService.java
@@ -5,10 +5,10 @@
public class VirtualizedService {
- private WireMock driver;
- private WireMockServer driverServer;
- private String httpHost;
- private int httpPort;
+ private final WireMock driver;
+ private final WireMockServer driverServer;
+ private final String httpHost;
+ private final int httpPort;
VirtualizedService(WireMock driver, WireMockServer driverServer, String httpHost, int httpPort) {
this.driver = driver;
@@ -33,13 +33,11 @@ public int getHttpPort() {
public String getHttpHost() {
return httpHost;
}
-
- public String getEndpointBaseUri(){
+
+ public String getEndpointBaseUri() {
return getHttpHost() + ":" + getHttpPort();
}
-
-
-
+
@Override
public String toString() {
return "Service for host " + getEndpointBaseUri();
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettings.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettings.java
index 7353204a..74efa671 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettings.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettings.java
@@ -5,16 +5,16 @@
public class PropertiesFileSettings {
- private boolean isVirtualServerEnabled = true; // default value
+ private boolean isVirtualServerEnabled = true;
@Inject(optional = true)
private void setProperty_isVirtualServerEnabled(@Named("webapi.isVirtualServerEnabled") String value) {
- this.isVirtualServerEnabled = value.toLowerCase()
- .equals("false") ? false : true;
+ this.isVirtualServerEnabled = !value.toLowerCase()
+ .equals("false");
}
public boolean isVirtualServerEnabled() {
- return this.isVirtualServerEnabled;
+ return isVirtualServerEnabled;
}
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/runtime/RuntimeParameters.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/runtime/RuntimeParameters.java
index bb10a8f9..f6f40aab 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/runtime/RuntimeParameters.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/base/runtime/RuntimeParameters.java
@@ -1,6 +1,8 @@
package com.capgemini.mrchecker.webapi.core.base.runtime;
-import com.capgemini.mrchecker.test.core.base.runtime.RuntimeParametersI;
+import org.apache.commons.lang.StringUtils;
+
+import com.capgemini.mrchecker.test.core.base.runtime.IRuntimeParameters;
/**
* This class stores various system properties These parameters are accessible while test case executes Example :
@@ -8,37 +10,35 @@
*
* @author LUSTEFAN
*/
-public enum RuntimeParameters implements RuntimeParametersI {
+public enum RuntimeParameters implements IRuntimeParameters {
// NAME(, )
MOCK_HTTP_PORT("mock_http_port", ""), // -Dmock_http_port="" Default random
- MOCK_HTTP_HOST("mock_http_host", "http://localhost"), // -Dmock_http_host="" Default localhost
- ;
+ MOCK_HTTP_HOST("mock_http_host", "http://localhost"); // -Dmock_http_host="" Default localhost
- private String paramName;
- private String paramValue;
- private String defaultValue;
+ private final String paramName;
+ private String paramValue;
+ private final String defaultValue;
- private RuntimeParameters(String paramName, String defaultValue) {
+ RuntimeParameters(String paramName, String defaultValue) {
this.paramName = paramName;
this.defaultValue = defaultValue;
setValue();
-
}
@Override
public String getValue() {
- return this.paramValue;
+ return paramValue;
}
-
+
@Override
public String getKey() {
- return this.paramName;
+ return paramName;
}
-
+
@Override
public String toString() {
- return paramName + "=" + this.getValue();
+ return getKey() + "=" + getValue();
}
@Override
@@ -50,11 +50,10 @@ private void setValue() {
String paramValue = System.getProperty(this.paramName);
paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue.toLowerCase();
this.paramValue = paramValue;
-
}
private boolean isSystemParameterEmpty(String systemParameterValue) {
- return (null == systemParameterValue || "".equals(systemParameterValue) || "null".equals(systemParameterValue));
+ return (StringUtils.isEmpty(systemParameterValue) || "null".equals(systemParameterValue));
}
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/soap/SoapMessageGenerator.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/soap/SoapMessageGenerator.java
similarity index 90%
rename from mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/soap/SoapMessageGenerator.java
rename to mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/soap/SoapMessageGenerator.java
index 2d9eae53..6cd6ac8b 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/soap/SoapMessageGenerator.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/soap/SoapMessageGenerator.java
@@ -1,4 +1,4 @@
-package com.capgemini.mrchecker.webapi.soap;
+package com.capgemini.mrchecker.webapi.core.soap;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -50,7 +50,7 @@ public class SoapMessageGenerator {
*
*
*
- *
+ *
* @param xmlRequestBody
* the body of the SOAP message pasted in XML format
*
@@ -63,7 +63,7 @@ public class SoapMessageGenerator {
* @throws SAXException
*/
public static SOAPMessage createSOAPmessage(String xmlRequestBody)
- throws SOAPException, SAXException, IOException, ParserConfigurationException {
+ throws SOAPException, SAXException, IOException, ParserConfigurationException {
SOAPElement body = stringToSOAPElement(xmlRequestBody);
@@ -88,8 +88,8 @@ public static SOAPMessage createSOAPmessage(String xmlRequestBody)
}
public static String printSoapMessage(final SOAPMessage soapMessage)
- throws TransformerFactoryConfigurationError,
- TransformerConfigurationException, SOAPException, TransformerException {
+ throws TransformerFactoryConfigurationError,
+ TransformerConfigurationException, SOAPException, TransformerException {
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
final Transformer transformer = transformerFactory.newTransformer();
@@ -98,7 +98,7 @@ public static String printSoapMessage(final SOAPMessage soapMessage)
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
final Source soapContent = soapMessage.getSOAPPart()
- .getContent();
+ .getContent();
final ByteArrayOutputStream streamOut = new ByteArrayOutputStream();
final StreamResult result = new StreamResult(streamOut);
@@ -109,7 +109,7 @@ public static String printSoapMessage(final SOAPMessage soapMessage)
/**
* Transform a String to a SOAP element
- *
+ *
* @param xmlRequestBody
* the string body representation
* @return a SOAP element
@@ -119,17 +119,17 @@ public static String printSoapMessage(final SOAPMessage soapMessage)
* @throws ParserConfigurationException
*/
private static SOAPElement stringToSOAPElement(String xmlRequestBody)
- throws SOAPException, SAXException, IOException,
- ParserConfigurationException {
+ throws SOAPException, SAXException, IOException,
+ ParserConfigurationException {
// Load the XML text into a DOM Document
final DocumentBuilderFactory builderFactory = DocumentBuilderFactory
- .newInstance();
+ .newInstance();
builderFactory.setNamespaceAware(true);
final InputStream stream = new ByteArrayInputStream(
- xmlRequestBody.getBytes());
+ xmlRequestBody.getBytes());
final Document doc = builderFactory.newDocumentBuilder()
- .parse(stream);
+ .parse(stream);
// Use SAAJ to convert Document to SOAPElement
// Create SoapMessage
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParser.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParser.java
index 9fed78fd..90760e1b 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParser.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParser.java
@@ -1,35 +1,39 @@
package com.capgemini.mrchecker.webapi.core.utils;
+import java.util.List;
+import java.util.stream.Collectors;
+
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
-import java.util.List;
-import java.util.stream.Collectors;
-
public final class HTMLParser {
-
+
private HTMLParser() {
}
-
+
public static Document parse(String html) {
return Jsoup.parse(html);
}
-
+
public static Elements getElements(String html, String tag) {
return getElements(parse(html), tag);
}
-
+
public static Elements getElements(Document document, String tag) {
return document.select(tag);
}
-
+
public static List getAttributeValueFromElements(Elements elements, String attributeKey) {
- return elements.stream().map(el -> el.attr(attributeKey)).collect(Collectors.toList());
+ return elements.stream()
+ .map(el -> el.attr(attributeKey))
+ .collect(Collectors.toList());
}
-
+
public static List getTextFromElements(Elements elements) {
- return elements.stream().map(Element::text).collect(Collectors.toList());
+ return elements.stream()
+ .map(Element::text)
+ .collect(Collectors.toList());
}
}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/utils/SimpleXMLParser.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/SimpleXMLParser.java
similarity index 92%
rename from mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/utils/SimpleXMLParser.java
rename to mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/SimpleXMLParser.java
index ff21c7de..a33c8cbb 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/utils/SimpleXMLParser.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/core/utils/SimpleXMLParser.java
@@ -1,4 +1,4 @@
-package com.capgemini.mrchecker.webapi.pages.utils;
+package com.capgemini.mrchecker.webapi.core.utils;
import java.io.IOException;
import java.io.InputStream;
@@ -35,7 +35,9 @@ public class SimpleXMLParser {
* - input stream XML document representation
* @return - normalized Document representation of XML
* @throws IOException
+ * IOException
* @throws SAXException
+ * SAXException
*/
public static Document convertToDocumentNormalized(InputStream inputStream) throws IOException, SAXException {
Document simpleXMLPageDocument = dBuilder.parse(inputStream);
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromCode.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromCode.java
deleted file mode 100644
index 8ef33519..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromCode.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.soap;
-
-import java.io.IOException;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.TransformerException;
-
-import org.xml.sax.SAXException;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.soap.SoapMessageGenerator;
-import com.jamesmurty.utils.XMLBuilder;
-
-/**
- * SOAP endpoint for a SOAP web service that matches a request body with the following SOAP envelope:
- *
- *
- *
- *
- * 100
- *
- *
- *
- **/
-public class FarenheitToCelsiusMethod_Request_FromCode extends BasePageWebAPI {
-
- /*
- * SOAP response built from Java code
- */
-
- public FarenheitToCelsiusMethod_Request_FromCode() {
- setRoot("FahrenheitToCelsius");
- }
-
- /**
- * @return Generate SOAP request in String format
- */
- public String getMessage() {
- String message = "";
- try {
- SOAPMessage soapMessage = SoapMessageGenerator.createSOAPmessage(this.getRoot()
- .asString());
- message = SoapMessageGenerator.printSoapMessage(soapMessage);
- } catch (SOAPException | SAXException | IOException | ParserConfigurationException | TransformerException e) {
- new Exception(e);
- }
- return message;
- }
-
- /**
- * @return Root XML structure
- */
- public XMLBuilder getRoot() {
- return xmlBody;
- }
-
- // Set any type of "nodes" under xml Root
- /**
- * Set "Fahrenheit" node under xml Root
- *
- * @param fahrenheit
- * @return
- * 100
- *
- */
- public FarenheitToCelsiusMethod_Request_FromCode setFahrenheit(int fahrenheit) {
- getRoot().element("Fahrenheit")
- .text(Integer.toString(fahrenheit));
- return this;
- }
-
- // Set any nodes under xml Root
- /**
- * Set "Smth" node under xml Root
- *
- * @param fahrenheit
- * @return
- * Hello
- *
- */
- public FarenheitToCelsiusMethod_Request_FromCode setSmth(String Smth) {
- getRoot().element("Smth")
- .text(Smth);
- return this;
- }
-
- /*
- * ----------------------------------
- * Any handy actions after this point
- * ----------------------------------
- */
- private XMLBuilder xmlBody;
-
- private void setRoot(String nodeName) {
- try {
- this.xmlBody = XMLBuilder.create(nodeName);
- } catch (ParserConfigurationException | FactoryConfigurationError e) {
- new Exception(e);
- }
- }
-
- public String getEndpoint() {
- // Useful only for REST Tests
- return null;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromFile.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromFile.java
deleted file mode 100644
index 3f247989..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Request_FromFile.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.soap;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-
-/**
- * SOAP endpoint for a SOAP web service that matches a response body with the following SOAP envelope:
- *
- *
- *
- *
- * 100
- *
- *
- *
- **/
-public class FarenheitToCelsiusMethod_Request_FromFile extends BasePageWebAPI {
-
- /*
- * SOAP response built from Java code
- */
- // optional parameters
- private String path = "/src/test/resources/soapInput/farenheittocelsius/samplerequest.xml";
-
- public FarenheitToCelsiusMethod_Request_FromFile() {
- }
-
- public FarenheitToCelsiusMethod_Request_FromFile setFilePath(String path) {
- this.path = path;
- return this;
- }
-
- public String getMessage() {
- String message = "";
- try {
- message = getStringOutOfFile(this.path);
- } catch (IOException e) {
- new Exception(e);
- }
- return message;
- }
-
- /*
- * ------------
- * Util methods
- * ------------
- */
-
- private String getStringOutOfFile(final String filePath) throws IOException {
- String path = System.getProperty("user.dir") + Paths.get(filePath);
- if (!exists(path)) {
- throw new IOException("Could not find file. Path='" + path + "' does not exist");
- }
-
- String responseEnvelope = readFile(path, StandardCharsets.UTF_8);
- return responseEnvelope;
- }
-
- private boolean exists(String path) {
- File f = new File(path);
- return f.exists();
- }
-
- private String readFile(String path, Charset encoding) throws IOException {
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- return new String(encoded, encoding);
- }
-
- public String getEndpoint() {
- // Useful only for REST Tests
- return null;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromCode.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromCode.java
deleted file mode 100644
index d3cdf359..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromCode.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.soap;
-
-import java.io.IOException;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.TransformerException;
-
-import org.xml.sax.SAXException;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.soap.SoapMessageGenerator;
-import com.jamesmurty.utils.XMLBuilder;
-
-public class FarenheitToCelsiusMethod_Response_FromCode extends BasePageWebAPI {
-
- /*
- * SOAP response built from Java code
- */
-
- public FarenheitToCelsiusMethod_Response_FromCode() {
- setRoot("FahrenheitToCelsiusResponse");
- }
-
- /**
- * @return Generate SOAP request in String format
- */
- public String getMessage() {
- String message = "";
- try {
- SOAPMessage soapMessage = SoapMessageGenerator.createSOAPmessage(this.getRoot()
- .asString());
- message = SoapMessageGenerator.printSoapMessage(soapMessage);
- } catch (SOAPException | SAXException | IOException | ParserConfigurationException | TransformerException e) {
- new Exception(e);
- }
- return message;
- }
-
- /**
- * @return Root XML structure
- */
- public XMLBuilder getRoot() {
- return xmlBody;
- }
-
- // Set any nodes type under xml Root
-
- /**
- * Set "FahrenheitToCelsiusResult" node under xml Root
- *
- * @param fahrenheit
- * @return
- * 37.777
- *
- */
- public FarenheitToCelsiusMethod_Response_FromCode setFahrenheitToCelsiusResult(double value) {
- getRoot()
- .element("FahrenheitToCelsiusResult")
- .text(Double.toString(value));
- return this;
- }
-
- /**
- * Set "Smth" node under xml Root
- *
- * @param fahrenheit
- * @return
- * Hello
- *
- */
- public FarenheitToCelsiusMethod_Response_FromCode setSmth(String Smth) {
- getRoot().element("Smth")
- .text(Smth);
- return this;
- }
-
- /*
- * ----------------------------------
- * Any handy actions after this point
- * ----------------------------------
- */
- private XMLBuilder xmlBody;
-
- private void setRoot(String nodeName) {
- try {
- this.xmlBody = XMLBuilder.create(nodeName);
- } catch (ParserConfigurationException | FactoryConfigurationError e) {
- new Exception(e);
- }
- }
-
- public String getEndpoint() {
- // Useful only for REST Tests
- return null;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromFile.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromFile.java
deleted file mode 100644
index 7d794fda..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/soap/FarenheitToCelsiusMethod_Response_FromFile.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.soap;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-
-public class FarenheitToCelsiusMethod_Response_FromFile extends BasePageWebAPI {
-
- /*
- * SOAP response built from Java code
- */
- private String path = "/src/test/resources/soapInput/farenheittocelsius/sampleresponse.xml";
-
- public FarenheitToCelsiusMethod_Response_FromFile() {
- }
-
- public FarenheitToCelsiusMethod_Response_FromFile setFilePath(String path) {
- this.path = path;
- return this;
- }
-
- public String getMessage() {
- String message = "";
- try {
- message = getStringOutOfFile(this.path);
- } catch (IOException e) {
- new Exception(e);
- }
- return message;
- }
-
- /*
- * ------------
- * Util methods
- * ------------
- */
-
- private String getStringOutOfFile(final String filePath) throws IOException {
- String path = System.getProperty("user.dir") + Paths.get(filePath);
- if (!exists(path)) {
- throw new IOException("Could not find file. Path='" + path + "' does not exist");
- }
-
- String responseEnvelope = readFile(path, StandardCharsets.UTF_8);
- return responseEnvelope;
- }
-
- private boolean exists(String path) {
- File f = new File(path);
- return f.exists();
- }
-
- private String readFile(String path, Charset encoding) throws IOException {
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- return new String(encoded, encoding);
- }
-
- public String getEndpoint() {
- // Useful only for REST Tests
- return null;
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubREST_Builder.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubREST_Builder.java
deleted file mode 100644
index 63f77105..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubREST_Builder.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.stubs;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.any;
-import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
-import java.util.UUID;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-import io.restassured.http.ContentType;
-
-public class StubREST_Builder {
-
- // required parameters
- private String endpointURI;
-
- // optional parameters
- private int statusCode;
-
- //Driver config
- private final String endpointBaseUri;
-
- public String getEndpointURI() {
- return endpointURI;
- }
-
- public String getEndpointBaseUri() {
- return this.endpointBaseUri;
- }
-
-
-
- public int getStatusCode() {
- return statusCode;
- }
-
- private StubREST_Builder(StubBuilder builder) {
- this.endpointURI = builder.endpointURI;
- this.statusCode = builder.statusCode;
- this.endpointBaseUri = builder.endpointBaseUri;
-
- }
-
- // Builder Class
- public static class StubBuilder {
-
- // required parameters
- private String endpointURI;
-
- // optional parameters
- private int statusCode = 200;
- private String response = "{ \"message\": \"Hello\" }";
-
- ///Driver config
- private String endpointBaseUri;
-
- public StubBuilder(String endpointURI) {
- this.endpointURI = endpointURI;
- }
-
- public StubBuilder setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- return this;
- }
-
- public StubBuilder setResponse(String response) {
- this.response = response;
- return this;
- }
-
- public StubREST_Builder build() {
- UUID id;
-
- // Bind all stubbers to running WireMock client connection
- WireMock driver = DriverManager.getDriverVirtualService();
- this.endpointBaseUri = DriverManager.getEndpointBaseUri();
- WireMock.configureFor(driver);
-
- // GET
- id = WireMock
- .givenThat(
- // Given that request with ...
- get(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo(ContentType.JSON.toString()))
- // Return given response ...
- .willReturn(aResponse()
- .withStatus(this.statusCode)
- .withHeader("Content-Type", ContentType.JSON.toString())
- .withBody(this.response)
- .withTransformers("body-transformer")))
- .getId();
- BFLogger.logDebug("Mapped GET with ID=" + id.toString());
-
- // POST
- id = WireMock
- .givenThat(
- // Given that request with ...
- post(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo(ContentType.JSON.toString()))
- // Return given response ...
- .willReturn(aResponse()
- .withStatus(this.statusCode)
- .withHeader("Content-Type", ContentType.JSON.toString())
- .withBody(this.response)
- .withTransformers("body-transformer")))
- .getId();
- BFLogger.logDebug("Mapped POST with ID=" + id.toString());
-
- // PUT
- id = WireMock
- .givenThat(
- // Given that request with ...
- put(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo(ContentType.JSON.toString()))
- // Return given response ...
- .willReturn(aResponse()
- .withStatus(this.statusCode)
- .withHeader("Content-Type", ContentType.JSON.toString())
- .withBody(this.response)
- .withTransformers("body-transformer")))
- .getId();
- BFLogger.logDebug("Mapped PUT with ID=" + id.toString());
-
- // DELETE
- id = WireMock
- .givenThat(
- // Given that request with ...
- delete(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo(ContentType.JSON.toString()))
- // Return given response ...
- .willReturn(aResponse()
- .withStatus(this.statusCode)
- .withHeader("Content-Type", ContentType.JSON.toString())
- .withBody(this.response)
- .withTransformers("body-transformer")))
- .getId();
- BFLogger.logDebug("Mapped DELETE with ID=" + id.toString());
-
- // CATCH any other requests
- id = WireMock
- .givenThat(
- any(anyUrl())
- .atPriority(10)
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", ContentType.JSON.toString())
- .withBody("{\"status\":\"Error\",\"message\":\"Endpoint not found\"}")
- .withTransformers("body-transformer")))
- .getId();
- BFLogger.logDebug("Mapped AnyOther with ID=" + id.toString());
- return new StubREST_Builder(this);
- }
-
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubSOAP_Builder.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubSOAP_Builder.java
deleted file mode 100644
index 5b267163..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/endpoint/stubs/StubSOAP_Builder.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.capgemini.mrchecker.webapi.endpoint.stubs;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.any;
-import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.matchingXPath;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-public class StubSOAP_Builder {
-
- // required parameters
- private String endpointURI;
-
- // optional parameters
- private int statusCode;
-
- //Driver config
- private final String endpointBaseUri;
-
- public String getEndpointURI() {
- return endpointURI;
- }
-
- public int getStatusCode() {
- return statusCode;
- }
-
- public String getEndpointBaseUri() {
- return this.endpointBaseUri;
- }
-
- private StubSOAP_Builder(StubBuilder builder) {
- this.endpointURI = builder.endpointURI;
- this.statusCode = builder.statusCode;
- this.endpointBaseUri = builder.endpointBaseUri;
- }
-
- // Builder Class
- public static class StubBuilder {
-
- // required parameters
- private String endpointURI;
-
- // optional parameters
- private int statusCode = 200;
- private String response = "Hello";
- private String requestXPathQuery = "";
-
- ///Driver config
- private String endpointBaseUri;
-
- public StubBuilder(String endpointURI) {
- this.endpointURI = endpointURI;
- }
-
- public StubBuilder setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- return this;
- }
-
- public StubBuilder setResponse(String response) {
- this.response = response;
- return this;
- }
-
- public StubBuilder setRequestXPathQuery(String requestXPathQuery) {
- this.requestXPathQuery = requestXPathQuery;
- return this;
-
- }
-
- public StubSOAP_Builder build() {
-
- // Bind all stubbers to running WireMock client connection
- WireMock driver = DriverManager.getDriverVirtualService();
- this.endpointBaseUri = DriverManager.getEndpointBaseUri();
- WireMock.configureFor(driver);
-
- // GET
- WireMock
- .givenThat(
- // Given that request with ...
- get(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo("application/soap+xml"))
- .withRequestBody(matchingXPath(this.requestXPathQuery))
- // Return given response ...
- .willReturn(aResponse().withStatus(this.statusCode)
- .withStatus(this.statusCode)
- .withHeader("Content-Type", "application/soap+xml")
- .withBody(this.response)
- .withTransformers("body-transformer")));
-
- // POST
- WireMock
- .givenThat(
- // Given that request with ...
- // post(urlEqualTo(this.endpointURI))
- post(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo("application/soap+xml"))
- .withRequestBody(matchingXPath(this.requestXPathQuery))
- // Return given response ...
- .willReturn(aResponse().withStatus(this.statusCode)
- .withStatus(this.statusCode)
- .withHeader("Content-Type", "application/soap+xml")
- .withBody(this.response)
- .withTransformers("body-transformer")));
-
- // PUT
- WireMock
- .givenThat(
- // Given that request with ...
- put(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo("application/soap+xml"))
- .withRequestBody(matchingXPath(this.requestXPathQuery))
- // Return given response ...
- .willReturn(aResponse().withStatus(this.statusCode)
- .withStatus(this.statusCode)
- .withHeader("Content-Type", "application/soap+xml")
- .withBody(this.response)
- .withTransformers("body-transformer")));
-
- // DELETE
- WireMock
- .givenThat(
- // Given that request with ...
- delete(urlMatching(this.endpointURI))
- .withHeader("Content-Type", equalTo("application/soap+xml"))
- .withRequestBody(matchingXPath(this.requestXPathQuery))
- // Return given response ...
- .willReturn(aResponse().withStatus(this.statusCode)
- .withStatus(this.statusCode)
- .withHeader("Content-Type", "application/soap+xml")
- .withBody(this.response)
- .withTransformers("body-transformer")));
-
- // CATCH any other requests
- WireMock
- .givenThat(
- any(anyUrl())
- .atPriority(10)
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "application/soap+xml")
- .withBody("Endpoint not found")
- .withTransformers("body-transformer")));
-
- return new StubSOAP_Builder(this);
- }
-
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/AddPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/AddPage.java
deleted file mode 100644
index 78d69c96..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/AddPage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.calculator_soap;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-
-import io.restassured.response.Response;
-
-public class AddPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = "http://www.dneonline.com";
- private final static String PATH = "/calculator.asmx?op=Add";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private final static String ROOT = "Add";
-
- private SOAPTemplate soapTemplate = new SOAPTemplate(ROOT);
-
- {
- soapTemplate.addAttributeToRoot("xmlns", "http://tempuri.org/");
- }
-
- public Response sendPOST() {
- return DriverManager.getDriverWebAPI()
- .with()
- .contentType("text/xml; charset=utf-8")
- .header("SOAPAction", "http://tempuri.org/Add")
- .body(soapTemplate.getMessage())
- .log()
- .all()
- .when()
- .post(ENDPOINT)
- .thenReturn();
- }
-
- public void setIntA(int numberA) {
- soapTemplate.getRoot()
- .element("intA")
- .text(String.valueOf(numberA));
- }
-
- public void setIntB(int numberB) {
- soapTemplate.getRoot()
- .element("intB")
- .text(String.valueOf(numberB));
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- /*
- * SAMPLE REQUEST:
- *
- *
- *
- * int
- * int
- *
- *
- *
- */
-
- /*
- * SAMPLE RESPONSE:
- *
- *
- *
- * int
- *
- *
- *
- */
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/DividePage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/DividePage.java
deleted file mode 100644
index c568f853..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/DividePage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.calculator_soap;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-
-import io.restassured.response.Response;
-
-public class DividePage extends BasePageWebAPI {
-
- private final static String HOSTNAME = "http://www.dneonline.com";
- private final static String PATH = "/calculator.asmx?op=Divide";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private final static String ROOT = "Divide";
-
- private SOAPTemplate soapTemplate = new SOAPTemplate(ROOT);
-
- {
- soapTemplate.addAttributeToRoot("xmlns", "http://tempuri.org/");
- }
-
- public Response sendPOST() {
- return DriverManager.getDriverWebAPI()
- .with()
- .contentType("text/xml; charset=utf-8")
- .header("SOAPAction", "http://tempuri.org/Divide")
- .body(soapTemplate.getMessage())
- .log()
- .all()
- .when()
- .post(ENDPOINT)
- .thenReturn();
- }
-
- public void setIntA(int numberA) {
- soapTemplate.getRoot()
- .element("intA")
- .text(String.valueOf(numberA));
- }
-
- public void setIntB(int numberB) {
- soapTemplate.getRoot()
- .element("intB")
- .text(String.valueOf(numberB));
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- /*
- * SAMPLE REQUEST:
- *
- *
- *
- * int
- * int
- *
- *
- *
- */
-
- /*
- * SAMPLE RESPONSE:
- *
- *
- *
- * int
- *
- *
- *
- */
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/MultiplyPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/MultiplyPage.java
deleted file mode 100644
index bb5db04e..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/MultiplyPage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.calculator_soap;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-
-import io.restassured.response.Response;
-
-public class MultiplyPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = "http://www.dneonline.com";
- private final static String PATH = "/calculator.asmx?op=Multiply";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private final static String ROOT = "Multiply";
-
- private SOAPTemplate soapTemplate = new SOAPTemplate(ROOT);
-
- {
- soapTemplate.addAttributeToRoot("xmlns", "http://tempuri.org/");
- }
-
- public Response sendPOST() {
- return DriverManager.getDriverWebAPI()
- .with()
- .contentType("text/xml; charset=utf-8")
- .header("SOAPAction", "http://tempuri.org/Multiply")
- .body(soapTemplate.getMessage())
- .log()
- .all()
- .when()
- .post(ENDPOINT)
- .thenReturn();
- }
-
- public void setIntA(int numberA) {
- soapTemplate.getRoot()
- .element("intA")
- .text(String.valueOf(numberA));
- }
-
- public void setIntB(int numberB) {
- soapTemplate.getRoot()
- .element("intB")
- .text(String.valueOf(numberB));
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- /*
- * SAMPLE REQUEST:
- *
- *
- *
- * int
- * int
- *
- *
- *
- */
-
- /*
- * SAMPLE RESPONSE:
- *
- *
- *
- * int
- *
- *
- *
- */
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/SubtractPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/SubtractPage.java
deleted file mode 100644
index 8d0b1728..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/calculator_soap/SubtractPage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.calculator_soap;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-
-import io.restassured.response.Response;
-
-public class SubtractPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = "http://www.dneonline.com";
- private final static String PATH = "/calculator.asmx?op=Subtract";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private final static String ROOT = "Subtract";
-
- private SOAPTemplate soapTemplate = new SOAPTemplate(ROOT);
-
- {
- soapTemplate.addAttributeToRoot("xmlns", "http://tempuri.org/");
- }
-
- public Response sendPOST() {
- return DriverManager.getDriverWebAPI()
- .with()
- .contentType("text/xml; charset=utf-8")
- .header("SOAPAction", "http://tempuri.org/Subtract")
- .body(soapTemplate.getMessage())
- .log()
- .all()
- .when()
- .post(ENDPOINT)
- .thenReturn();
- }
-
- public void setIntA(int numberA) {
- soapTemplate.getRoot()
- .element("intA")
- .text(String.valueOf(numberA));
- }
-
- public void setIntB(int numberB) {
- soapTemplate.getRoot()
- .element("intB")
- .text(String.valueOf(numberB));
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- /*
- * SAMPLE REQUEST:
- *
- *
- *
- * int
- * int
- *
- *
- *
- */
-
- /*
- * SAMPLE RESPONSE:
- *
- *
- *
- * int
- *
- *
- *
- */
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/environment/GetEnvironmentParam.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/environment/GetEnvironmentParam.java
deleted file mode 100644
index 90b2941b..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/environment/GetEnvironmentParam.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.environment;
-
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.exceptions.BFInputDataException;
-
-public enum GetEnvironmentParam {
-
- // Name if enum must be in line with cell name in /src/resources/vironments/environment.csv
- HTTPBIN;
-
- public String getValue() {
-
- if (null == BaseTest.getEnvironmentService()) {
- throw new BFInputDataException("Environment Parameters class wasn't initialized properly");
- }
-
- return BaseTest.getEnvironmentService()
- .getValue(this.name());
-
- }
-
- @Override
- public String toString() {
-
- return this.getValue();
-
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/Base64Page.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/Base64Page.java
deleted file mode 100644
index 4f1a5eac..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/Base64Page.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-import io.restassured.response.Response;
-
-public class Base64Page extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/base64/{value}";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private Response sendGETQuery(String value) {
- return DriverManager.getDriverWebAPI()
- .given().pathParam("value", value)
- .get(ENDPOINT);
- }
-
- public String getDecodedValue(String base64Data) {
- Response response = sendGETQuery(base64Data);
- if (response.statusCode() == 200 && !response.body().equals(null)) {
- return response.body().asString();
- }
- return null;
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/BasicAuthPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/BasicAuthPage.java
deleted file mode 100644
index 763ef1b3..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/BasicAuthPage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.response.Response;
-
-public class BasicAuthPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/basic-auth/user/passwd";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response sendBasicAuthGETQuery(String username, String password) {
- return DriverManager.getDriverWebAPI()
- .auth()
- .basic(username, password)
- .when()
- .get(ENDPOINT);
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/HtmlPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/HtmlPage.java
deleted file mode 100644
index dbce7023..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/HtmlPage.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-import io.restassured.response.Response;
-
-public class HtmlPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/html";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response getHtmlDocument() {
- return DriverManager.getDriverWebAPI()
- .get(ENDPOINT);
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/LinksPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/LinksPage.java
deleted file mode 100644
index 05afd654..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/LinksPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-import io.restassured.response.Response;
-
-public class LinksPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/links/{n}/{offset}";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response getHtmlDocument(int n, int offset) {
- return DriverManager.getDriverWebAPI()
- .pathParam("n", n)
- .pathParam("offset", offset)
- .get(ENDPOINT);
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/RandomNBytesPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/RandomNBytesPage.java
deleted file mode 100644
index 414104b4..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/RandomNBytesPage.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-import io.restassured.response.Response;
-
-public class RandomNBytesPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/bytes/{length}";
- private final static String ENDPOINT = HOSTNAME + PATH;
- private Response response = null;
-
- public void sendGETQuery(String length) {
- response = DriverManager.getDriverWebAPI()
- .given().pathParam("length", length)
- .get(ENDPOINT);
- }
-
- public byte[] getBytesFromResponse() {
- if (response != null) {
- return response.body().asByteArray();
- }
- return null;
- }
-
- public int getStatusCodeFromResponse() {
- if (response != null) {
- return response.getStatusCode();
- }
- return -1;
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleFormPOSTPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleFormPOSTPage.java
deleted file mode 100644
index efbd9074..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleFormPOSTPage.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.response.Response;
-
-public class SimpleFormPOSTPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/post";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private Map requestFields = new HashMap<>();
-
- {
- requestFields.put("custname", "");
- requestFields.put("custtel", "");
- requestFields.put("custemail", "");
- requestFields.put("comments", "");
- requestFields.put("delivery", "");
- requestFields.put("size", "");
- requestFields.put("topping", "");
- }
-
- public Response submitForm() {
- return DriverManager.getDriverWebAPI()
- .formParams(requestFields)
- .when()
- .post(ENDPOINT);
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- public void setCustomerName(String customerName) {
- requestFields.replace("custname", customerName);
- }
-
- public void setTelephoneNumber(String telephoneNumber) {
- requestFields.replace("custtel", telephoneNumber);
- }
-
- public void setEmailAddress(String emailAddress) {
- requestFields.replace("custemail", emailAddress);
- }
-
- public void pickPizzaSize(PizzaSize pizzaSize) {
- requestFields.replace("size", pizzaSize.getPizzaSizeValue());
- }
-
- public void pickPizzaToppings(PizzaToppings... pizzaToppings) {
- List toppings = new ArrayList<>(Arrays.asList(pizzaToppings));
- List toppingsStrings = toppings.stream()
- .map(element -> element.getPizzaToppingValue())
- .collect(Collectors.toList());
- requestFields.replace("topping", toppingsStrings);
-
- }
-
- public void setPrefferedDeliveryTime(int hours, int minutes) {
- requestFields.replace("delivery", hours + ":" + minutes);
- }
-
- public void setDeliveryInstruction(String deliveryInstruction) {
- requestFields.put("comments", deliveryInstruction);
- }
-
- public enum PizzaSize {
- SMALL("small"),
- MEDIUM("medium"),
- LARGE("large");
-
- private String pizzaSizeValue;
-
- PizzaSize(String pizzaSizeValue) {
- this.pizzaSizeValue = pizzaSizeValue;
- }
-
- public String getPizzaSizeValue() {
- return pizzaSizeValue;
- }
- }
-
- public enum PizzaToppings {
- BACON("bacon"),
- EXTRA_CHEESE("cheese"),
- ONION("onion"),
- MUSHROOM("mushroom");
-
- private String pizzaToppingValue;
-
- PizzaToppings(String pizzaToppingValue) {
- this.pizzaToppingValue = pizzaToppingValue;
- }
-
- public String getPizzaToppingValue() {
- return pizzaToppingValue;
- }
- }
-
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleGETPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleGETPage.java
deleted file mode 100644
index c0421738..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleGETPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.response.Response;
-
-public class SimpleGETPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/get";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response sendGETQuery() {
- return DriverManager.getDriverWebAPI()
- .when()
- .get(ENDPOINT);
- }
-
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleXMLPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleXMLPage.java
deleted file mode 100644
index dac419a1..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/SimpleXMLPage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.response.Response;
-
-public class SimpleXMLPage extends BasePageWebAPI {
-
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/xml";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response getXMLDocument() {
- return DriverManager.getDriverWebAPI()
- .get(ENDPOINT);
- }
-
- @Override
- public String getEndpoint() {
- return ENDPOINT;
- }
-
- /**
- * Elements of XML that can be used in searches
- */
- public enum XML_ELEMENT {
- SLIDESHOW("slideshow"),
- ITEM("item");
- private String element;
-
- XML_ELEMENT(String element) {
- this.element = element;
- }
-
- public String getElementKey() {
- return element;
- }
- }
-
- /**
- * Attribute keys that can be used in tests
- */
- public enum XML_ATTRIBUTE {
- DATE("date");
-
- private String attribute;
-
- XML_ATTRIBUTE(String attribute) {
- this.attribute = attribute;
- }
-
- public String getAttributeKey() {
- return attribute;
- }
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/CookieSession.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/CookieSession.java
deleted file mode 100644
index 54696065..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/CookieSession.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin.cookies;
-
-import io.restassured.filter.cookie.CookieFilter;
-
-public class CookieSession {
-
- private static CookieFilter cookieSession = null;
-
- private CookieSession() {
- }
-
- public static CookieFilter getSession() {
- if (cookieSession == null) {
- cookieSession = createSession();
- }
- return cookieSession;
- }
-
- public static void createNewSession() {
- cookieSession = createSession();
- }
-
- private static CookieFilter createSession() {
- return new CookieFilter();
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/DeleteCookiesPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/DeleteCookiesPage.java
deleted file mode 100644
index 99bd6691..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/DeleteCookiesPage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin.cookies;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.config.RedirectConfig;
-import io.restassured.config.RestAssuredConfig;
-import io.restassured.response.Response;
-
-public class DeleteCookiesPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/cookies/delete";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private String deleteCookiesEndpointWithValues;
-
- public Response deleteCookie(String name, String value) {
- deleteCookiesEndpointWithValues = ENDPOINT
- .concat("?")
- .concat(name)
- .concat("=")
- .concat(value);
-
- return DriverManager.getDriverWebAPI()
- .config(RestAssuredConfig.newConfig()
- .redirect(RedirectConfig.redirectConfig()
- .followRedirects(false)))
- .filter(CookieSession.getSession())
- .when()
- .get(deleteCookiesEndpointWithValues);
- }
-
- public String getEndpoint() {
- return deleteCookiesEndpointWithValues == null ? ENDPOINT : deleteCookiesEndpointWithValues;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/GetCookiesPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/GetCookiesPage.java
deleted file mode 100644
index f3ebe77b..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/GetCookiesPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin.cookies;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.response.Response;
-
-public class GetCookiesPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/cookies";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- public Response getCookies() {
- return DriverManager.getDriverWebAPI()
- .filter(CookieSession.getSession())
- .when()
- .get(ENDPOINT);
- }
-
- public String getEndpoint() {
- return ENDPOINT;
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/SetCookiesPage.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/SetCookiesPage.java
deleted file mode 100644
index 47959538..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/main/java/com/capgemini/mrchecker/webapi/pages/httbin/cookies/SetCookiesPage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.capgemini.mrchecker.webapi.pages.httbin.cookies;
-
-import com.capgemini.mrchecker.webapi.core.BasePageWebAPI;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.pages.environment.GetEnvironmentParam;
-
-import io.restassured.config.RedirectConfig;
-import io.restassured.config.RestAssuredConfig;
-import io.restassured.response.Response;
-
-public class SetCookiesPage extends BasePageWebAPI {
- private final static String HOSTNAME = GetEnvironmentParam.HTTPBIN.getValue();
- private final static String PATH = "/cookies/set";
- private final static String ENDPOINT = HOSTNAME + PATH;
-
- private String setCookiesEndpointWithValues;
-
- public Response setCookie(String name, String value) {
- setCookiesEndpointWithValues = ENDPOINT
- .concat("?")
- .concat(name)
- .concat("=")
- .concat(value);
-
- return DriverManager.getDriverWebAPI()
- .config(RestAssuredConfig.newConfig()
- .redirect(RedirectConfig.redirectConfig()
- .followRedirects(false)))
- .filter(CookieSession.getSession())
- .when()
- .get(setCookiesEndpointWithValues);
- }
-
- public String getEndpoint() {
- return setCookiesEndpointWithValues == null ? ENDPOINT : setCookiesEndpointWithValues;
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_DynamicResponse.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_DynamicResponse.java
deleted file mode 100644
index fb1c7e61..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_DynamicResponse.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.capgemini.mrchecker.endpoint.rest;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.endpoint.stubs.StubREST_Builder;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-import io.restassured.http.ContentType;
-import io.restassured.response.Response;
-
-public class REST_FarenheitToCelsiusMethod_DynamicResponse extends BaseTest {
-
- private static String endpointBaseUri;
-
- @BeforeClass
- public static void beforeClass() {
- DriverManager.clearAllDrivers();
-
- // Start Virtual Server
- WireMock driverVirtualService = DriverManager.getDriverVirtualService();
-
- // Get Virtual Server running http and https ports
- int httpPort = DriverManager.getHttpPort();
- String baseURI = DriverManager.getHttpHost();
- endpointBaseUri = baseURI + ":" + httpPort;
- }
-
- @Override
- public void setUp() {
- }
-
- @Override
- public void tearDown() {
- }
-
- @Test
- public void testRestMock_post_ResponseBodyBasedOnRequestBody() throws Exception {
-
- /*
- * ----------
- * Mock response. Map request with virtual asset from file
- * -----------
- */
- BFLogger.logInfo("#1 Create Stub content message");
- BFLogger.logInfo("#2 Add resource to wiremock server");
- new StubREST_Builder.StubBuilder("/some/thing")
- .setResponse("{ \"FahrenheitToCelsiusResponse\":{\"FahrenheitToCelsiusResult\":$(FahrenheitToCelsius.Fahrenheit)}}")
- .setStatusCode(200)
- .build();
-
- /*
- * ----------
- * Time to validate virtual response. Send POST request and validate response
- * -----------
- */
- BFLogger.logInfo("#3 Send request to generated stub");
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .header("Content-Type", ContentType.JSON.toString())
- .body("{\"FahrenheitToCelsius\":{\"Fahrenheit\":500}}")
- .log()
- .all()
- .when()
- .post(endpointBaseUri + "/some/thing")
- .thenReturn();
-
- BFLogger.logInfo("#4 Validate response ");
- BFLogger.logDebug("/some/thing: " + response.jsonPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- assertThat(response.body()
- .jsonPath()
- .get("FahrenheitToCelsiusResponse.FahrenheitToCelsiusResult"), is(500));
- }
-
- @Test
- public void testRestMock_post_ResponseBodyBasedOnRequestUrlArgs() throws Exception {
-
- /*
- * ----------
- * Mock response. Map request with virtual asset from file
- * -----------
- */
- BFLogger.logInfo("#1 Create Stub content message");
- BFLogger.logInfo("#2 Add resource to wiremock server");
- new StubREST_Builder.StubBuilder("/some/thing.*")
- .setResponse("{ \"FahrenheitToCelsiusResponse\":{\"FahrenheitToCelsiusResult\":$(one), \"Value2\":\"$(two)\"} }")
- .setStatusCode(200)
- .build();
-
- /*
- * ----------
- * Time to validate virtual response. Send POST request and validate response
- * -----------
- */
- BFLogger.logInfo("#3 Send request to generated stub");
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .header("Content-Type", ContentType.JSON.toString())
- .log()
- .all()
- .when()
- .post(endpointBaseUri + "/some/thing?one=100&two=HelloWorld")
- .thenReturn();
-
- BFLogger.logInfo("#4 Validate response ");
- BFLogger.logDebug("/some/thing?one=100&two=HelloWorld: " + response.jsonPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- assertThat(response.getBody()
- .jsonPath()
- .get("FahrenheitToCelsiusResponse.FahrenheitToCelsiusResult"), is(100));
- assertThat(response.getBody()
- .jsonPath()
- .get("FahrenheitToCelsiusResponse.Value2"), is("HelloWorld"));
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_Test.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_Test.java
deleted file mode 100644
index 67b437b0..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/rest/REST_FarenheitToCelsiusMethod_Test.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.capgemini.mrchecker.endpoint.rest;
-
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.endpoint.stubs.StubREST_Builder;
-import io.restassured.http.ContentType;
-import io.restassured.response.Response;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-public class REST_FarenheitToCelsiusMethod_Test extends BaseTest {
-
- private static String endpointBaseUri;
-
- @BeforeClass
- public static void beforeClass() {
- // DriverManager.clearAllDrivers();
- //
- // // Start Virtual Server
- // WireMock driverVirtualService = DriverManager.getDriverVirtualService();
- //
- // // Get Virtual Server running http port
- // int httpPort = DriverManager.getHttpPort();
- // String baseURI = DriverManager.getHttpHost();
- // endpointBaseUri = baseURI + ":" + httpPort;
- }
-
- @Override
- public void setUp() {
- /*
- * ----------
- * Mock response. Map request with virtual asset from file
- * -----------
- */
- BFLogger.logInfo("#1 Create Stub content message");
- BFLogger.logInfo("#2 Add resource to wiremock server");
- StubREST_Builder stubREST_builder = new StubREST_Builder.StubBuilder("/some/thing")
- .setResponse("{ \"FahrenheitToCelsiusResponse\":{\"FahrenheitToCelsiusResult\":37.7777777777778}}")
- .setStatusCode(200)
- .build();
-
- // Get Virtual Server running endpoint URI
- endpointBaseUri = stubREST_builder.getEndpointBaseUri();
-
-
- }
-
- @Override
- public void tearDown() {
- }
-
- @Test
- public void testRestMock_UrlExists() {
-
- BFLogger.logInfo("#3 Send request to generated stub");
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .header("Content-Type", ContentType.JSON.toString())
- .log()
- .all()
- .when()
- .get(endpointBaseUri + "/some/thing")
- .thenReturn();
-
- BFLogger.logInfo("#4 Validate response ");
- BFLogger.logDebug("/some/thing: " + response.jsonPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- }
-
- @Test
- public void testRestMock_UrlDoesNotExist() throws Exception {
-
- BFLogger.logInfo("#3 Send request to generated stub");
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .header("Content-Type", ContentType.JSON.toString())
- .log()
- .all()
- .when()
- .get(endpointBaseUri + "/notexisting")
- .thenReturn();
-
- BFLogger.logInfo("#4 Validate response ");
- assertThat(response.statusCode(), is(404));
-
- }
-
- @Test
- public void testRestMock_post() throws Exception {
-
- BFLogger.logInfo("#3 Send request to generated stub");
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .header("Content-Type", ContentType.JSON.toString())
- .body("{\"FahrenheitToCelsius\":{\"Fahrenheit\":10}}")
- .log()
- .all()
- .when()
- .post(endpointBaseUri + "/some/thing")
- .thenReturn();
-
- BFLogger.logInfo("#4 Validate response ");
- BFLogger.logDebug("/some/thing: " + response.jsonPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/soap/SOAP_FarenheitToCelsiusMethod_Test.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/soap/SOAP_FarenheitToCelsiusMethod_Test.java
deleted file mode 100644
index 102e4536..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/endpoint/soap/SOAP_FarenheitToCelsiusMethod_Test.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.capgemini.mrchecker.endpoint.soap;
-
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.core.base.driver.DriverManager;
-import com.capgemini.mrchecker.webapi.endpoint.soap.FarenheitToCelsiusMethod_Request_FromCode;
-import com.capgemini.mrchecker.webapi.endpoint.soap.FarenheitToCelsiusMethod_Request_FromFile;
-import com.capgemini.mrchecker.webapi.endpoint.soap.FarenheitToCelsiusMethod_Response_FromCode;
-import com.capgemini.mrchecker.webapi.endpoint.soap.FarenheitToCelsiusMethod_Response_FromFile;
-import com.capgemini.mrchecker.webapi.endpoint.stubs.StubSOAP_Builder;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.restassured.RestAssured;
-import io.restassured.config.EncoderConfig;
-import io.restassured.config.RestAssuredConfig;
-import io.restassured.response.Response;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-public class SOAP_FarenheitToCelsiusMethod_Test extends BaseTest {
-
-
- @BeforeClass
- public static void beforeClass() {
-// DriverManager.clearAllDrivers();
-//
-// // Start Virtual Server
-// BFLogger.logInfo("#1 Start wiremock server");
-// WireMock driverVirtualService = DriverManager.getDriverVirtualService();
-//
-// // Get Virtual Server running http port
-// int httpPort = DriverManager.getHttpPort();
-// String baseURI = DriverManager.getHttpHost();
-// endpointBaseUri = baseURI + ":" + httpPort;
-//
-// RestAssured.config = new RestAssuredConfig().encoderConfig(new EncoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false));
-
- }
-
- @Override
- public void setUp() {
- }
-
- @Override
- public void tearDown() {
- }
-
- @Test
- public void testSoapMessageFromFileWithVitualResponse() throws IOException {
-
- BFLogger.logInfo("#2 Create Stub content message");
- final String responseMessage = new FarenheitToCelsiusMethod_Response_FromFile().getMessage();
- String requestXPathQuery = "//soap12:Envelope | //soap12:Body | //FahrenheitToCelsius | //Fahrenheit";
-
- /*
- * ----------
- * Mock response. Map request with virtual asset from file
- * -----------
- */
- BFLogger.logInfo("#3 Add resource to wiremock server");
- String endpointUriRegExp = "/tempconvert.asmx.*";
- StubSOAP_Builder stubSOAP_builder = new StubSOAP_Builder.StubBuilder(endpointUriRegExp)
- .setRequestXPathQuery(requestXPathQuery)
- .setResponse(responseMessage)
- .setStatusCode(200)
- .build();
-
- // Get Virtual Server running endpoint URI
- String endpointBaseUri = stubSOAP_builder.getEndpointBaseUri();
-
- /*
- * ----------
- * Time to validate virtual response
- * -----------
- */
- BFLogger.logInfo("#4 Send request to generated stub");
- String endpointUri = "/tempconvert.asmx";
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .contentType("application/soap+xml")
- .body(new FarenheitToCelsiusMethod_Request_FromCode()
- .setFahrenheit(30)
- .setSmth("Hello")
- .getMessage())
- .log()
- .all()
- .when()
- .post(endpointBaseUri + endpointUri)
- .thenReturn();
-
- BFLogger.logInfo("#5 Validate reposponse ");
- BFLogger.logDebug("NEW RESPONSE /tempconvert.asmx?op=FahrenheitToCelsius: " + response.xmlPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- }
-
- @Test
- public void testSoapMessageFromClassObjectWithVitualResponse() throws Exception {
- BFLogger.logInfo("#1 Start wiremock server");
- DriverManager.getDriverVirtualService();
-
- BFLogger.logInfo("#2 Create Stub content message");
- final String responseMessage = new FarenheitToCelsiusMethod_Response_FromCode().setFahrenheitToCelsiusResult(37.8888)
- .getMessage();
- String requestXPathQuery = "//soap12:Envelope | //soap12:Body | //FahrenheitToCelsius | //Fahrenheit";
-
- /*
- * ----------
- * Mock response. Map request with virtual asset from Object SOAP representation
- * -----------
- */
- BFLogger.logInfo("#3 Add resource to wiremock server");
- String endpointUriRegExp = "/tempconvert.asmx\\?op=FahrenheitToCelsius";
-
- StubSOAP_Builder stubSOAP_builder = new StubSOAP_Builder.StubBuilder(endpointUriRegExp)
- .setRequestXPathQuery(requestXPathQuery)
- .setResponse(responseMessage)
- .setStatusCode(200)
- .build();
-
- // Get Virtual Server running endpoint URI
- String endpointBaseUri = stubSOAP_builder.getEndpointBaseUri();
-
-
- /*
- * ----------
- * Time to validate virtual response
- * -----------
- */
- BFLogger.logInfo("#4 Send request to generated stub");
- String endpointUri = "/tempconvert.asmx?op=FahrenheitToCelsius";
- Response response = DriverManager.getDriverWebAPI()
- .with()
- .contentType("application/soap+xml")
- .body(new FarenheitToCelsiusMethod_Request_FromFile().getMessage())
- .log()
- .all()
- .when()
- .post(endpointBaseUri + endpointUri)
- .thenReturn();
-
- BFLogger.logInfo("#5 Validate reposponse ");
- BFLogger.logDebug("NEW RESPONSE /tempconvert.asmx?op=FahrenheitToCelsius: " + response.xmlPath()
- .prettyPrint());
- assertThat(response.statusCode(), is(200));
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/AddTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/AddTest.java
deleted file mode 100644
index 069c2d34..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/AddTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.capgemini.mrchecker.webapi.calculator_soap;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.calculator_soap.AddPage;
-
-import io.restassured.response.Response;
-
-public class AddTest extends BasePageWebApiTest {
-
- private AddPage addPage = new AddPage();
-
- @Test
- public void addTwoPositiveNumbers() {
- int firstNumberToAdd = 10;
- int secondNumberToAdd = 11;
-
- runAddingTest(firstNumberToAdd, secondNumberToAdd);
- }
-
- @Test
- public void addTwoNegativeNumbers() {
- int firstNumberToAdd = -10;
- int secondNumberToAdd = -11;
-
- runAddingTest(firstNumberToAdd, secondNumberToAdd);
- }
-
- @Test
- public void addTwoMixedNumbers() {
- int firstNumberToAdd = 10;
- int secondNumberToAdd = -11;
-
- runAddingTest(firstNumberToAdd, secondNumberToAdd);
- }
-
- private void runAddingTest(int firstNumberToAdd, int secondNumberToAdd) {
- BFLogger.logInfo("Step 1 - Setting first number to add: " + firstNumberToAdd);
- addPage.setIntA(firstNumberToAdd);
-
- BFLogger.logInfo("Step 2 - Setting second number to add: " + secondNumberToAdd);
- addPage.setIntB(secondNumberToAdd);
-
- BFLogger.logInfo("Step 3 - Sending SOAP query to add two numbers. Endpoint: " + addPage.getEndpoint());
- Response response = addPage.sendPOST();
-
- BFLogger.logInfo("Step 4 - Validating the response status code");
- assertThat(response.statusCode(), is(200));
-
- BFLogger.logInfo("Step 5 - Validating the response result of adding");
- assertThat(response.xmlPath()
- .getInt("Envelope.Body.AddResponse"), is(firstNumberToAdd + secondNumberToAdd));
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/DivideTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/DivideTest.java
deleted file mode 100644
index 5c888db3..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/DivideTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.capgemini.mrchecker.webapi.calculator_soap;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.calculator_soap.DividePage;
-
-import io.restassured.response.Response;
-
-public class DivideTest extends BasePageWebApiTest {
-
- private DividePage dividePage = new DividePage();
-
- @Test
- public void divideTwoPositiveNumbers() {
- int firstNumberToDivide = 100;
- int secondNumberToDivide = 10;
-
- runDividingTest(firstNumberToDivide, secondNumberToDivide);
- }
-
- @Test
- public void divideTwoNegativeNumbers() {
- int firstNumberToDivide = -100;
- int secondNumberToDivide = -10;
-
- runDividingTest(firstNumberToDivide, secondNumberToDivide);
- }
-
- @Test
- public void divideTwoMixedNumbers() {
- int firstNumberToDivide = 100;
- int secondNumberToDivide = -10;
-
- runDividingTest(firstNumberToDivide, secondNumberToDivide);
- }
-
- private void runDividingTest(int firstNumberToDivide, int secondNumberToDivide) {
- BFLogger.logInfo("Step 1 - Setting first number to divide: " + firstNumberToDivide);
- dividePage.setIntA(firstNumberToDivide);
-
- BFLogger.logInfo("Step 2 - Setting second number to divide: " + secondNumberToDivide);
- dividePage.setIntB(secondNumberToDivide);
-
- BFLogger.logInfo("Step 3 - Sending SOAP query to divide two numbers. Endpoint: " + dividePage.getEndpoint());
- Response response = dividePage.sendPOST();
-
- BFLogger.logInfo("Step 4 - Validating the response status code");
- assertThat(response.statusCode(), is(200));
-
- BFLogger.logInfo("Step 5 - Validating the response result of dividing");
- assertThat(response.xmlPath()
- .getInt("Envelope.Body.DivideResponse"), is(firstNumberToDivide / secondNumberToDivide));
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/MultiplyTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/MultiplyTest.java
deleted file mode 100644
index a19e11a1..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/MultiplyTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.capgemini.mrchecker.webapi.calculator_soap;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.calculator_soap.MultiplyPage;
-
-import io.restassured.response.Response;
-
-public class MultiplyTest extends BasePageWebApiTest {
-
- private MultiplyPage multiplyPage = new MultiplyPage();
-
- @Test
- public void multiplyTwoPositiveNumbers() {
- int firstNumberToMultiply = 15;
- int secondNumberToMultiply = 20;
-
- runMultiplicationTest(firstNumberToMultiply, secondNumberToMultiply);
- }
-
- @Test
- public void multiplyTwoNegativeNumbers() {
- int firstNumberToMultiply = -15;
- int secondNumberToMultiply = -20;
-
- runMultiplicationTest(firstNumberToMultiply, secondNumberToMultiply);
- }
-
- @Test
- public void multiplyTwoMixedNumbers() {
- int firstNumberToMultiply = 15;
- int secondNumberToMultiply = -20;
-
- runMultiplicationTest(firstNumberToMultiply, secondNumberToMultiply);
- }
-
- private void runMultiplicationTest(int firstNumberToMultiply, int secondNumberToMultiply) {
- BFLogger.logInfo("Step 1 - Setting first number to multiply: " + firstNumberToMultiply);
- multiplyPage.setIntA(firstNumberToMultiply);
-
- BFLogger.logInfo("Step 2 - Setting second number to multiply: " + secondNumberToMultiply);
- multiplyPage.setIntB(secondNumberToMultiply);
-
- BFLogger.logInfo("Step 3 - Sending SOAP query to multiplication two numbers. Endpoint: " + multiplyPage.getEndpoint());
- Response response = multiplyPage.sendPOST();
-
- BFLogger.logInfo("Step 4 - Validating the response status code");
- assertThat(response.statusCode(), is(200));
-
- BFLogger.logInfo("Step 5 - Validating the response result of multiplication");
- assertThat(response.xmlPath()
- .getInt("Envelope.Body.MultiplyResponse"), is(firstNumberToMultiply * secondNumberToMultiply));
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/SubtractTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/SubtractTest.java
deleted file mode 100644
index 5af12ed0..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/calculator_soap/SubtractTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.capgemini.mrchecker.webapi.calculator_soap;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.calculator_soap.SubtractPage;
-
-import io.restassured.response.Response;
-
-public class SubtractTest extends BasePageWebApiTest {
-
- private SubtractPage subtractPage = new SubtractPage();
-
- @Test
- public void subtractTwoPositiveNumbers() {
- int firstNumberToSubtract = 29;
- int secondNumberToSubtract = 40;
-
- runSubtractingTest(firstNumberToSubtract, secondNumberToSubtract);
- }
-
- @Test
- public void SubtractTwoNegativeNumbers() {
- int firstNumberToSubtract = -29;
- int secondNumberToSubtract = -40;
-
- runSubtractingTest(firstNumberToSubtract, secondNumberToSubtract);
- }
-
- @Test
- public void SubtractTwoMixedNumbers() {
- int firstNumberToSubtract = 29;
- int secondNumberToSubtract = -40;
-
- runSubtractingTest(firstNumberToSubtract, secondNumberToSubtract);
- }
-
- private void runSubtractingTest(int firstNumberToSubtract, int secondNumberToSubtract) {
- BFLogger.logInfo("Step 1 - Setting first number to subtract: " + firstNumberToSubtract);
- subtractPage.setIntA(firstNumberToSubtract);
-
- BFLogger.logInfo("Step 2 - Setting second number to subtract: " + secondNumberToSubtract);
- subtractPage.setIntB(secondNumberToSubtract);
-
- BFLogger.logInfo("Step 3 - Sending SOAP query to subtract two numbers. Endpoint: " + subtractPage.getEndpoint());
- Response response = subtractPage.sendPOST();
-
- BFLogger.logInfo("Step 4 - Validating the response status code");
- assertThat(response.statusCode(), is(200));
-
- BFLogger.logInfo("Step 5 - Validating the response result of subtracting");
- assertThat(response.xmlPath()
- .getInt("Envelope.Body.SubtractResponse"), is(firstNumberToSubtract - secondNumberToSubtract));
- }
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest.java
index e467d551..ecedc597 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest.java
@@ -1,81 +1,79 @@
package com.capgemini.mrchecker.webapi.core.base.driver;
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
+
import com.capgemini.mrchecker.test.core.BaseTest;
import com.capgemini.mrchecker.webapi.core.base.runtime.RuntimeParameters;
+import com.capgemini.mrchecker.webapi.tags.UnitTest;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.common.FatalStartupException;
-import org.junit.AfterClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+@UnitTest
+@ResourceLock("PropertiesFileSettings.class")
public class DriverManagerTest extends BaseTest {
-
+
WireMockServer driver;
-
+
@Override
public void setUp() {
DriverManager.closeDriverVirtualServer();
driver = null;
}
-
+
@Override
public void tearDown() {
DriverManager.closeDriverVirtualServer();
-
+
System.clearProperty("mock_http_host");
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
-
+
System.clearProperty("mock_http_port");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
-
+
try {
driver.shutdown();
} catch (Exception e) {
}
}
-
- @AfterClass
+
+ @AfterAll
public static void afterAll() {
DriverManager.clearAllDrivers();
}
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
+
@Test
public void testRuntimeEnvironmentHostHttp() {
System.setProperty("mock_http_host", "http://test.org");
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
assertEquals("System parameters for 'mock_http_host' should be 'http://test.org'", "http://test.org", RuntimeParameters.MOCK_HTTP_HOST.getValue());
}
-
+
@Test
public void testRuntimeEnvironmentHostHttpDefaultValue() {
System.clearProperty("mock_http_host");
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
assertEquals("System parameters for 'mock_http_host' should be 'http://localhost'", "http://localhost", RuntimeParameters.MOCK_HTTP_HOST.getValue());
}
-
+
@Test
public void testRuntimeEnvironmentPortHttp() {
System.setProperty("mock_http_port", "8080");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
assertEquals("System parameters for 'mock_http_port' should be '8080'", "8080", RuntimeParameters.MOCK_HTTP_PORT.getValue());
}
-
+
@Test
public void testRuntimeEnvironmentPortHttpDefaultValue() {
System.clearProperty("mock_http_port");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
assertEquals("Default value for system parameters 'mock_http_port' should be ''", "", RuntimeParameters.MOCK_HTTP_PORT.getValue());
}
-
+
@Test
public void testWireMockStartPortHttpRandomPortHttps() {
System.setProperty("mock_http_port", "8090");
@@ -85,26 +83,25 @@ public void testWireMockStartPortHttpRandomPortHttps() {
WireMockServer driver = DriverManager.getDriverVirtualServerService();
assertEquals("Mock server for http does not run o specified port", 8090, driver.port());
}
-
+
@Test
public void testWireMockStartTwoServersWithTheSameHttpPort() {
System.setProperty("mock_http_port", "8081");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
-
+
DriverManager.closeDriverVirtualServer();
-
+
// Start #1 server
driver = DriverManager.getDriverVirtualServerService();
assertEquals("Mock server for http does not run o port 8081", 8081, driver.port());
-
+
// Enable to add new server instances in this thread. Simulation of multi thread and bind to the same port
DriverManager.clearAllDrivers();
-
+
// Start #2 server and expect Error
- thrown.expect(FatalStartupException.class);
- thrown.expectMessage(containsString("Address already in use"));
- driver = DriverManager.getDriverVirtualServerService();
+ assertThrows(FatalStartupException.class, DriverManager::getDriverVirtualServerService);
+ // thrown.expectMessage(containsString("Address already in use"));
assertEquals("Mock server for http does not run o port 8081", 8081, driver.port());
}
-
+
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest_standaloneWiremock.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest_standaloneWiremock.java
index 2e88a4d5..42ec106b 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest_standaloneWiremock.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/driver/DriverManagerTest_standaloneWiremock.java
@@ -1,14 +1,7 @@
package com.capgemini.mrchecker.webapi.core.base.driver;
-import com.capgemini.mrchecker.test.core.BaseTest;
-import com.capgemini.mrchecker.test.core.base.runtime.RuntimeParametersCore;
-import com.capgemini.mrchecker.webapi.core.base.runtime.RuntimeParameters;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.io.IOException;
@@ -17,17 +10,22 @@
import java.net.UnknownHostException;
import java.nio.file.Paths;
-import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
+import com.capgemini.mrchecker.test.core.BaseTest;
+import com.capgemini.mrchecker.webapi.core.base.runtime.RuntimeParameters;
+import com.capgemini.mrchecker.webapi.tags.UnitTest;
+import com.github.tomakehurst.wiremock.client.WireMock;
+@UnitTest
+@ResourceLock("PropertiesFileSettings.class")
public class DriverManagerTest_standaloneWiremock extends BaseTest {
-
- private static Process process_wiremock = null;
- private static final String WIREMOCK_STANDALONE_PORT = "8111";
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
+
+ private static Process process_wiremock = null;
+ private static final String WIREMOCK_STANDALONE_PORT = "8111";
@Test
public void testStandaloneWireMockStartDedicatedPortHttp() throws UnknownHostException {
@@ -36,9 +34,7 @@ public void testStandaloneWireMockStartDedicatedPortHttp() throws UnknownHostExc
System.out.println("IP Address:- " + hostAddress);
String hostName = inetAddress.getHostName();
System.out.println("Host Name:- " + hostName);
-
-
-
+
System.setProperty("mock_http_host", hostAddress);
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
assertEquals("System parameters for 'mock_http_host'", hostAddress, RuntimeParameters.MOCK_HTTP_HOST.getValue());
@@ -58,11 +54,11 @@ public void testStandaloneWireMockWrongHostname() {
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
System.setProperty("mock_http_port", "8100");
- RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
+ RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
+
+ assertThrows(java.net.UnknownHostException.class, DriverManager::getDriverVirtualService);
+ // thrown.expectMessage(startsWith("http"));
- thrown.expect(java.net.UnknownHostException.class);
- thrown.expectMessage(startsWith("http"));
- WireMock driver = DriverManager.getDriverVirtualService();
}
@Test
@@ -73,59 +69,51 @@ public void testStandaloneWireMockStartRandomPortHttp() {
System.setProperty("mock_http_port", "1000");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
- thrown.expect(java.net.UnknownHostException.class);
- thrown.expectMessage(startsWith("http"));
- WireMock driver = DriverManager.getDriverVirtualService();
+ assertThrows(java.net.UnknownHostException.class, DriverManager::getDriverVirtualService);
+ // thrown.expectMessage(startsWith("http"));
}
-
- @BeforeClass
+
+ @BeforeAll
public static void beforeAll() throws IOException {
startWiremockStandalone();
-
}
-
-
-
- @AfterClass
- public static void afterAll(){
+
+ @AfterAll
+ public static void afterAll() {
try {
process_wiremock.destroyForcibly();
- }catch (Exception e){
- //No need to catch Exception
+ } catch (Exception e) {
+ // No need to catch Exception
}
DriverManager.clearAllDrivers();
-
+
System.clearProperty("mock_http_host");
RuntimeParameters.MOCK_HTTP_HOST.refreshParameterValue();
-
+
System.clearProperty("mock_http_port");
RuntimeParameters.MOCK_HTTP_PORT.refreshParameterValue();
-
+
}
-
+
@Override
public void setUp() {
DriverManager.closeDriverVirtualServer();
-
-
-
-
+
}
@Override
public void tearDown() {
DriverManager.closeDriverVirtualServer();
}
-
-
+
private static void startWiremockStandalone() throws IOException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/wiremock/wiremock-standalone-2.21.0.jar");
File file = new File(path);
-
+
ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", file.getAbsolutePath(), "--port", WIREMOCK_STANDALONE_PORT);
processBuilder.redirectOutput(Redirect.INHERIT);
processBuilder.redirectError(Redirect.INHERIT);
-
+
process_wiremock = processBuilder.start();
}
}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettingsTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettingsTest.java
index 913ce085..cfa2af09 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettingsTest.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/base/properties/PropertiesFileSettingsTest.java
@@ -2,80 +2,85 @@
import static org.junit.Assert.assertEquals;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.nio.file.Paths;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule;
-import com.capgemini.mrchecker.webapi.core.base.properties.PropertiesFileSettings;
+import com.capgemini.mrchecker.webapi.tags.UnitTest;
import com.google.inject.Guice;
import com.google.inject.Injector;
+@UnitTest
+@ResourceLock("PropertiesFileSettings.class")
public class PropertiesFileSettingsTest {
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
}
private PropertiesFileSettings propertiesFileSettings;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
PropertiesSettingsModule.delInstance();
}
@Test
- public void testParameterEnableVirtualServer_True() {
+ public void testParameterEnableVirtualServer_True() throws FileNotFoundException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(new FileInputStream(path)));
this.propertiesFileSettings = i.getInstance(PropertiesFileSettings.class);
assertEquals("", true, propertiesFileSettings.isVirtualServerEnabled());
}
@Test
- public void testParameterEnableVirtualServer_False() {
+ public void testParameterEnableVirtualServer_False() throws FileNotFoundException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings2.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(new FileInputStream(path)));
this.propertiesFileSettings = i.getInstance(PropertiesFileSettings.class);
assertEquals("", false, propertiesFileSettings.isVirtualServerEnabled());
}
@Test
- public void testParameterEnableVirtualServer_NoValue() {
+ public void testParameterEnableVirtualServer_NoValue() throws FileNotFoundException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings3.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(new FileInputStream(path)));
this.propertiesFileSettings = i.getInstance(PropertiesFileSettings.class);
assertEquals("", true, propertiesFileSettings.isVirtualServerEnabled());
}
@Test
- public void testParameterEnableVirtualServer_Text() {
+ public void testParameterEnableVirtualServer_Text() throws FileNotFoundException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings4.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(new FileInputStream(path)));
this.propertiesFileSettings = i.getInstance(PropertiesFileSettings.class);
assertEquals("", true, propertiesFileSettings.isVirtualServerEnabled());
}
@Test
- public void testParameterEnableVirtualServer_NoParameter() {
+ public void testParameterEnableVirtualServer_NoParameter() throws FileNotFoundException {
String path = System.getProperty("user.dir") + Paths.get("/src/test/resources/settings5.properties");
- Injector i = Guice.createInjector(PropertiesSettingsModule.init(path));
+ Injector i = Guice.createInjector(PropertiesSettingsModule.init(new FileInputStream(path)));
this.propertiesFileSettings = i.getInstance(PropertiesFileSettings.class);
assertEquals("", true, propertiesFileSettings.isVirtualServerEnabled());
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParserTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParserTest.java
index 44e82aa9..976b0e70 100644
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParserTest.java
+++ b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/core/utils/HTMLParserTest.java
@@ -1,39 +1,44 @@
package com.capgemini.mrchecker.webapi.core.utils;
-import org.jsoup.nodes.Document;
-import org.jsoup.select.Elements;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.jsoup.nodes.Document;
+import org.jsoup.select.Elements;
+import org.junit.jupiter.api.Test;
+
+import com.capgemini.mrchecker.webapi.tags.UnitTest;
+@UnitTest
public class HTMLParserTest {
private final String SAMPLE_HTML = "My titleBody contentContents of a first div element
Contents of a second div element
";
-
+
@Test
public void testHTMLParser_parse_checkTitle() {
Document doc = HTMLParser.parse(SAMPLE_HTML);
assertNotNull(doc);
assertEquals(doc.title(), "My title");
}
-
+
@Test
public void testHTMLParser_getElements_html_checkTitle() {
Elements elements = HTMLParser.getElements(SAMPLE_HTML, "title");
assertEquals(elements.size(), 1);
- assertEquals(elements.first().ownText(), "My title");
+ assertEquals(elements.first()
+ .ownText(), "My title");
}
-
+
@Test
public void testHTMLParser_getElements_doc_checkTitle() {
Document doc = HTMLParser.parse(SAMPLE_HTML);
Elements elements = HTMLParser.getElements(doc, "title");
assertEquals(elements.size(), 1);
- assertEquals(elements.first().ownText(), "My title");
+ assertEquals(elements.first()
+ .ownText(), "My title");
}
-
+
@Test
public void testHTMLParser_getElements_html_allDiv_text() {
Elements elements = HTMLParser.getElements(SAMPLE_HTML, "div");
@@ -42,7 +47,7 @@ public void testHTMLParser_getElements_html_allDiv_text() {
assertEquals(texts.get(0), "Contents of a first div element");
assertEquals(texts.get(1), "Contents of a second div element");
}
-
+
@Test
public void testHTMLParser_getElements_html_allDiv_attributesId() {
Elements elements = HTMLParser.getElements(SAMPLE_HTML, "div");
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/Base64Test.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/Base64Test.java
deleted file mode 100644
index 76885915..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/Base64Test.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.capgemini.mrchecker.webapi.httpbin;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.httbin.Base64Page;
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.text.MessageFormat;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-@RunWith(JUnitParamsRunner.class)
-public class Base64Test extends BasePageWebApiTest {
- private Base64Page base64Page = new Base64Page();
-
- @Test
- @Parameters({
- "SFRUUEJJTiBpcyBhd2Vzb21l, HTTPBIN is awesome",
- "TXIuQ2hlY2tlcg==, Mr.Checker",
- "WmHFvMOzxYLEhyBnxJnFm2zEhSBqYcW6xYQ= , Zażółć gęślą jaźń"
- })
- public void sendGetWithBase64DataAndValidateDecodedResponse(String base64Data, String expectedResult) {
- BFLogger.logInfo(MessageFormat.format("Step 1 - Sending GET query to {0} with valid base 64 data: {1}", base64Page.getEndpoint(), base64Data));
- String response = base64Page.getDecodedValue(base64Data);
-
- BFLogger.logInfo(MessageFormat.format("Step 2 - Validate response body (should be {0}): ", expectedResult));
- assertThat(response, is(expectedResult));
- }
-}
\ No newline at end of file
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/BasicAuthTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/BasicAuthTest.java
deleted file mode 100644
index d8abfa7e..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/BasicAuthTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.capgemini.mrchecker.webapi.httpbin;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.httbin.BasicAuthPage;
-
-import io.restassured.response.Response;
-
-public class BasicAuthTest extends BasePageWebApiTest {
-
- private final String validUsername = "user";
- private final String validPassword = "passwd";
-
- private final String invalidUsername = "invalidUser";
- private final String invalidPassword = "invalidPassword";
-
- private BasicAuthPage basicAuthPage = new BasicAuthPage();
-
- @Test
- public void basicAuthSuccessfulLogin() {
-
- BFLogger.logInfo("Step 1 - Sending GET query to " + basicAuthPage.getEndpoint() +
- " with valid credentials: " + validUsername + ", " + validPassword);
- Response response = basicAuthPage.sendBasicAuthGETQuery(validUsername, validPassword);
-
- BFLogger.logInfo("Step 2 - Validate response status code (should be 200): ");
- assertThat(response.statusCode(), is(200));
- }
-
- @Test
- public void basicAuthFailedLogin() {
-
- BFLogger.logInfo("Step 1 - Sending GET query to " + basicAuthPage.getEndpoint() +
- " with invalid credentials: " + invalidUsername + ", " + invalidPassword);
- Response response = basicAuthPage.sendBasicAuthGETQuery(invalidUsername, invalidPassword);
-
- BFLogger.logInfo("Step 2 - Validate response status code (should be 401): ");
- assertThat(response.statusCode(), is(401));
- }
-
-}
diff --git a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/CookiesTest.java b/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/CookiesTest.java
deleted file mode 100644
index d3d90a6b..00000000
--- a/mrchecker-framework-modules/mrchecker-webapi-module/src/test/java/com/capgemini/mrchecker/webapi/httpbin/CookiesTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.capgemini.mrchecker.webapi.httpbin;
-
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.capgemini.mrchecker.test.core.logger.BFLogger;
-import com.capgemini.mrchecker.webapi.BasePageWebApiTest;
-import com.capgemini.mrchecker.webapi.pages.httbin.cookies.CookieSession;
-import com.capgemini.mrchecker.webapi.pages.httbin.cookies.DeleteCookiesPage;
-import com.capgemini.mrchecker.webapi.pages.httbin.cookies.GetCookiesPage;
-import com.capgemini.mrchecker.webapi.pages.httbin.cookies.SetCookiesPage;
-
-import io.restassured.response.Response;
-
-public class CookiesTest extends BasePageWebApiTest {
-
- private GetCookiesPage getCookiesPage = new GetCookiesPage();
- private SetCookiesPage setCookiesPage = new SetCookiesPage();
- private DeleteCookiesPage deleteCookiesPage = new DeleteCookiesPage();
-
- @Before
- public void testSetUp() {
- BFLogger.logInfo("Step 1 - Create new cookie session");
- CookieSession.createNewSession();
- BFLogger.logInfo("Created session id: " + CookieSession.getSession()
- .hashCode());
- }
-
- @Test
- public void getCookiesTestStatusCode() {
- int expectedStatusCode = 200;
-
- BFLogger.logInfo("Step 2 - GET Cookies. Send GET to " + getCookiesPage.getEndpoint());
- Response response = getCookiesPage.getCookies();
- BFLogger.logInfo("Step 3 - Validate response status code. Expected was " + expectedStatusCode + ".");
- assertThat(response.statusCode(), is(expectedStatusCode));
- }
-
- @Test
- public void setCookiesTestStatusCode() {
- // After set some cookie httpbin.org trying to redirect for /cookies endpoint.
- // To keep same cookie session redirect must be turned off.
- // That's why 302(REDIRECT) is expected.
- int expectedStatusCode = 302;
-
- BFLogger.logInfo("Step 2 - SET Cookies. Send GET to " + setCookiesPage.getEndpoint());
- Response response = setCookiesPage.setCookie("cookiesOne", "1");
- BFLogger.logInfo("Step 3 - Validate response status code. Expected was " + expectedStatusCode + ".");
- assertThat(response.statusCode(), is(expectedStatusCode));
- }
-
- @Test
- public void deleteCookiesTestStatusCode() {
- // After delete some cookie httpbin.org trying to redirect for /cookies endpoint.
- // To keep same cookie session redirect must be turned off.
- // That's why 302(REDIRECT) is expected.
- int expectedStatusCode = 302;
-
- BFLogger.logInfo("Step 2 - DELETE Cookies. Send GET to " + deleteCookiesPage.getEndpoint());
- Response response = deleteCookiesPage.deleteCookie("cookiesTwo", "2");
-
- BFLogger.logInfo("Step 3 - Validate response status code. Expected was " + expectedStatusCode + ".");
- assertThat(response.statusCode(), is(expectedStatusCode));
- }
-
- @Test
- public void setTwoCookies() {
- String firstCookieKey = "firstCookie";
- String firstCookieValue = "1";
-
- String secondCookieKey = "secondCookie";
- String secondCookieValue = "2";
-
- int expectedSizeOfCookiesResponseMap = 2;
-
- BFLogger.logInfo("Step 2 - SET Cookies. Send GET to " + setCookiesPage.getEndpoint());
- setCookiesPage.setCookie(firstCookieKey, firstCookieValue);
- setCookiesPage.setCookie(secondCookieKey, secondCookieValue);
-
- BFLogger.logInfo("Step 3 - GET Cookies. Send GET to " + getCookiesPage.getEndpoint());
- Map cookies = getCookiesPage.getCookies()
- .jsonPath()
- .getMap("cookies");
-
- BFLogger.logInfo("Step 4 - Validate 'cookies' response");
- assertThat(cookies.size(), equalTo(expectedSizeOfCookiesResponseMap));
- assertTrue(cookies.keySet()
- .contains(firstCookieKey));
- assertEquals(firstCookieValue, cookies.get(firstCookieKey));
- assertTrue(cookies.keySet()
- .contains(secondCookieKey));
- assertEquals(secondCookieValue, cookies.get(secondCookieKey));
- }
-
- @Test
- public void deleteCookie() {
- String firstCookieKey = "firstCookie";
- String firstCookieValue = "1";
-
- int expectedSizeOfCookiesResponseMap = 1;
- String expectedValueAfterDelete = "";
-
- BFLogger.logInfo("Step 2 - SET Cookies. Send GET to " + setCookiesPage.getEndpoint());
- setCookiesPage.setCookie(firstCookieKey, firstCookieValue);
-
- BFLogger.logInfo("Step 3 - GET Cookies. Send GET to " + getCookiesPage.getEndpoint());
- Map