From 20a60bf02556bb15fc610b054c9af03bf1a155cc Mon Sep 17 00:00:00 2001 From: Roman Iovlev Date: Mon, 1 Mar 2021 18:35:07 +0100 Subject: [PATCH] Parallel methods (#2809) * small corrections * swithc all parallel classes to methods * move Soft asserts to single thread tests * move Soft asserts to single thread tests * another ci run * another ci run * set retry to 2 ans switch on nextMethodTest * move SoftAsserts back to parallel execution * correct validateLocators for Grid * fix actions issue while close driver * add show for actions --- CHANGELOG.md | 6 +- jdi-bdd-tests/pom.xml | 4 +- jdi-bdd/pom.xml | 4 +- jdi-eyes-demo/pom.xml | 6 +- jdi-light-angular-tests-with-mocks/pom.xml | 4 +- jdi-light-angular-tests/pom.xml | 4 +- .../src/test/resources/common.xml | 2 +- jdi-light-angular/pom.xml | 4 +- jdi-light-applitools-tests/pom.xml | 6 +- .../src/test/resources/general.xml | 2 +- jdi-light-bootstrap-tests/pom.xml | 4 +- jdi-light-bootstrap/pom.xml | 4 +- jdi-light-eyes/pom.xml | 4 +- jdi-light-html-tests/pom.xml | 4 +- .../tests/performance/ActionsCloseTests.java | 57 +++++++++++++++++++ .../{issues/issue67 => site}/SoftAsserts.java | 2 +- .../epam/testng/RetryFailedTestCases.java | 2 +- .../src/test/resources/common.properties | 2 +- .../src/test/resources/functional.xml | 2 +- jdi-light-html/pom.xml | 4 +- jdi-light-mobile-bootstrap-web-tests/pom.xml | 4 +- jdi-light-mobile-html-web-tests/pom.xml | 4 +- jdi-light-mobile-tests/pom.xml | 6 +- jdi-light-mobile/pom.xml | 4 +- jdi-light/pom.xml | 2 +- .../jdi/light/asserts/core/SoftAssert.java | 8 +-- .../epam/jdi/light/elements/base/JDIBase.java | 28 +++------ .../jdi/light/elements/common/UIElement.java | 24 ++++++++ .../light/elements/complex/table/Grid.java | 11 +++- pom.xml | 2 +- test-examples/jdi-bdd-no-po-tests/pom.xml | 4 +- test-examples/jdi-light-examples/pom.xml | 4 +- test-examples/jdi-performance/pom.xml | 4 +- .../src/test/resources/general.xml | 2 +- .../jdi-light-junit-template/pom.xml | 2 +- .../jdi-light-testng-template/pom.xml | 2 +- .../src/test/resources/general.xml | 2 +- 37 files changed, 159 insertions(+), 81 deletions(-) create mode 100644 jdi-light-html-tests/src/test/java/io/github/epam/html/tests/performance/ActionsCloseTests.java rename jdi-light-html-tests/src/test/java/io/github/epam/html/tests/{issues/issue67 => site}/SoftAsserts.java (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0108e168e2..303ca4342c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # Changelog -## 1.3.10 (planed March 2021) +## 1.3.12 (planed March 2021) * Support [Angular materials](https://material.angular.io/components/categories) elements * All tasks [angular](https://github.com/jdi-testing/jdi-light/issues?q=is%3Aissue+label%3AAngular+) +##1.3.10 (01.03.2021) +* Fix issue with actions +* Fix Grid header locators validation + ##1.3.9 (28.02.2021) * Fix beforeNewPage issue * Fix issues with getting private fields by forms and other elements diff --git a/jdi-bdd-tests/pom.xml b/jdi-bdd-tests/pom.xml index 28c40aa09e..8c19d06269 100644 --- a/jdi-bdd-tests/pom.xml +++ b/jdi-bdd-tests/pom.xml @@ -6,7 +6,7 @@ com.epam.jdi jdi-bdd-tests - 1.3.9 + 1.3.10 Tests: JDI BDD @@ -22,7 +22,7 @@ com.epam.jdi jdi-bdd - 1.3.9 + 1.3.10 info.cukes diff --git a/jdi-bdd/pom.xml b/jdi-bdd/pom.xml index 1cd687e8e4..a70c5b4b6c 100644 --- a/jdi-bdd/pom.xml +++ b/jdi-bdd/pom.xml @@ -6,7 +6,7 @@ com.epam.jdi jdi-bdd - 1.3.9 + 1.3.10 JDI BDD @@ -18,7 +18,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 info.cukes diff --git a/jdi-eyes-demo/pom.xml b/jdi-eyes-demo/pom.xml index 68d5a4d050..099242b081 100644 --- a/jdi-eyes-demo/pom.xml +++ b/jdi-eyes-demo/pom.xml @@ -6,7 +6,7 @@ com.epam.jdi jdi-eyes-demo - 1.3.9 + 1.3.10 Selenium to JDI Example with Eyes jar @@ -23,12 +23,12 @@ com.epam.jdi jdi-light-eyes - 1.3.9 + 1.3.10 com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/jdi-light-angular-tests-with-mocks/pom.xml b/jdi-light-angular-tests-with-mocks/pom.xml index ba10fadbe5..130b9038b1 100644 --- a/jdi-light-angular-tests-with-mocks/pom.xml +++ b/jdi-light-angular-tests-with-mocks/pom.xml @@ -6,7 +6,7 @@ jdi-light-angular-tests-with-mocks Tests: JDI Angular unit tests with mocks - 1.3.9 + 1.3.10 com.epam.jdi @@ -28,7 +28,7 @@ com.epam.jdi jdi-light-angular - 1.3.9 + 1.3.10 diff --git a/jdi-light-angular-tests/pom.xml b/jdi-light-angular-tests/pom.xml index 10dbcb1011..771b250f67 100644 --- a/jdi-light-angular-tests/pom.xml +++ b/jdi-light-angular-tests/pom.xml @@ -6,7 +6,7 @@ jdi-light-angular-tests Tests: JDI Angular - 1.3.9 + 1.3.10 com.epam.jdi @@ -23,7 +23,7 @@ com.epam.jdi jdi-light-angular - 1.3.9 + 1.3.10 io.qameta.allure diff --git a/jdi-light-angular-tests/src/test/resources/common.xml b/jdi-light-angular-tests/src/test/resources/common.xml index da72b78c8f..9d4f077af0 100644 --- a/jdi-light-angular-tests/src/test/resources/common.xml +++ b/jdi-light-angular-tests/src/test/resources/common.xml @@ -1,6 +1,6 @@ - + diff --git a/jdi-light-angular/pom.xml b/jdi-light-angular/pom.xml index a2c19050b2..7aafe5a998 100644 --- a/jdi-light-angular/pom.xml +++ b/jdi-light-angular/pom.xml @@ -7,7 +7,7 @@ jdi-light-angular jar JDI Angular - 1.3.9 + 1.3.10 com.epam.jdi @@ -23,7 +23,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/jdi-light-applitools-tests/pom.xml b/jdi-light-applitools-tests/pom.xml index 2b65fed124..86f673f1c5 100644 --- a/jdi-light-applitools-tests/pom.xml +++ b/jdi-light-applitools-tests/pom.xml @@ -7,7 +7,7 @@ jdi-light-applitools-tests Tests: JDI Light Applitools Eyes jar - 1.3.9 + 1.3.10 com.epam.jdi @@ -33,12 +33,12 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 com.epam.jdi jdi-light-eyes - 1.3.9 + 1.3.10 io.qameta.allure diff --git a/jdi-light-applitools-tests/src/test/resources/general.xml b/jdi-light-applitools-tests/src/test/resources/general.xml index 59a2bb7351..6f68bc59bb 100644 --- a/jdi-light-applitools-tests/src/test/resources/general.xml +++ b/jdi-light-applitools-tests/src/test/resources/general.xml @@ -1,6 +1,6 @@ - + diff --git a/jdi-light-bootstrap-tests/pom.xml b/jdi-light-bootstrap-tests/pom.xml index b7b61dbfb4..3d46b7c664 100644 --- a/jdi-light-bootstrap-tests/pom.xml +++ b/jdi-light-bootstrap-tests/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 1.3.9 + 1.3.10 jdi-light-bootstrap-tests Tests: JDI Bootstrap com.epam.jdi @@ -23,7 +23,7 @@ com.epam.jdi jdi-light-bootstrap - 1.3.9 + 1.3.10 diff --git a/jdi-light-bootstrap/pom.xml b/jdi-light-bootstrap/pom.xml index 4f24509ba2..11f460b3ec 100644 --- a/jdi-light-bootstrap/pom.xml +++ b/jdi-light-bootstrap/pom.xml @@ -7,7 +7,7 @@ jdi-light-bootstrap JDI Light Bootstrap Elements jar - 1.3.9 + 1.3.10 com.epam.jdi @@ -20,7 +20,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/jdi-light-eyes/pom.xml b/jdi-light-eyes/pom.xml index 5ce389dc1f..7900f02b0a 100644 --- a/jdi-light-eyes/pom.xml +++ b/jdi-light-eyes/pom.xml @@ -7,7 +7,7 @@ jdi-light-eyes JDI Light Applitools Eyes jar - 1.3.9 + 1.3.10 com.epam.jdi @@ -19,7 +19,7 @@ com.epam.jdi jdi-light - 1.3.9 + 1.3.10 diff --git a/jdi-light-html-tests/pom.xml b/jdi-light-html-tests/pom.xml index 84b941d733..d0c43b99a7 100644 --- a/jdi-light-html-tests/pom.xml +++ b/jdi-light-html-tests/pom.xml @@ -3,7 +3,7 @@ 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 - 1.3.9 + 1.3.10 jdi-light-html-tests Tests: JDI Html com.epam.jdi @@ -25,7 +25,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/performance/ActionsCloseTests.java b/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/performance/ActionsCloseTests.java new file mode 100644 index 0000000000..ae81ed03e8 --- /dev/null +++ b/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/performance/ActionsCloseTests.java @@ -0,0 +1,57 @@ +package io.github.epam.html.tests.performance; + +import com.epam.jdi.light.driver.WebDriverFactory; +import com.epam.jdi.tools.Timer; +import io.github.epam.TestsInit; +import org.openqa.selenium.Keys; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import static io.github.com.StaticSite.html5Page; +import static io.github.com.pages.HtmlElementsPage.yourName; +import static io.github.epam.html.tests.site.steps.States.shouldBeLoggedIn; +import static org.testng.Assert.assertEquals; + +/** + * Created by Roman Iovlev on 01.03.2019 + * Email: roman.iovlev.jdi@gmail.com; Skype: roman.iovlev + */ + +public class ActionsCloseTests implements TestsInit { + + @BeforeMethod + public void before() { + shouldBeLoggedIn(); + html5Page.shouldBeOpened(); + yourName.setText(text); + } + String text = "TextField"; + + @Test + public void getValueTest() { + yourName.core().actionsWithElement(a -> a. + click(). + keyDown(Keys.CONTROL). + sendKeys("a"). + keyUp(Keys.CONTROL)); + yourName.sendKeys("Test"); + assertEquals(yourName.getValue(), "Test"); + } + + @Test + public void sendKeysTest() { + yourName.core().actionsWithElement(a -> a. + click(). + keyDown(Keys.CONTROL). + sendKeys("a"). + keyUp(Keys.CONTROL)); + yourName.sendKeys("Test"); + assertEquals(yourName.getValue(), "Test"); + } + @AfterMethod(alwaysRun = true) + public void tearDown() { + WebDriverFactory.close(); + } + +} diff --git a/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/issues/issue67/SoftAsserts.java b/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/site/SoftAsserts.java similarity index 99% rename from jdi-light-html-tests/src/test/java/io/github/epam/html/tests/issues/issue67/SoftAsserts.java rename to jdi-light-html-tests/src/test/java/io/github/epam/html/tests/site/SoftAsserts.java index b20243dcd3..794d1498bb 100644 --- a/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/issues/issue67/SoftAsserts.java +++ b/jdi-light-html-tests/src/test/java/io/github/epam/html/tests/site/SoftAsserts.java @@ -1,4 +1,4 @@ -package io.github.epam.html.tests.issues.issue67; +package io.github.epam.html.tests.site; import com.epam.jdi.light.asserts.core.SoftAssert; import io.github.epam.TestsInit; diff --git a/jdi-light-html-tests/src/test/java/io/github/epam/testng/RetryFailedTestCases.java b/jdi-light-html-tests/src/test/java/io/github/epam/testng/RetryFailedTestCases.java index c2e5b7a909..4e5176690e 100644 --- a/jdi-light-html-tests/src/test/java/io/github/epam/testng/RetryFailedTestCases.java +++ b/jdi-light-html-tests/src/test/java/io/github/epam/testng/RetryFailedTestCases.java @@ -7,11 +7,11 @@ public class RetryFailedTestCases implements IRetryAnalyzer { private int retryCnt = 0; + final int maxRetryCnt = 2; //This method will be called everytime a test fails. It will return TRUE if a test fails and need to be retried, else it returns FALSE public boolean retry(ITestResult result) { //You could mentioned maxRetryCnt (Maximiun Retry Count) as per your requirement. Here I took 2, If any failed testcases then it runs two times - int maxRetryCnt = 0; if (retryCnt < maxRetryCnt) { logger.trace("Retrying " + result.getName() + " again and the count is " + (retryCnt+1)); retryCnt++; diff --git a/jdi-light-html-tests/src/test/resources/common.properties b/jdi-light-html-tests/src/test/resources/common.properties index c31a28a764..e45339074f 100644 --- a/jdi-light-html-tests/src/test/resources/common.properties +++ b/jdi-light-html-tests/src/test/resources/common.properties @@ -1 +1 @@ -arguments=--headless +# arguments=--headless diff --git a/jdi-light-html-tests/src/test/resources/functional.xml b/jdi-light-html-tests/src/test/resources/functional.xml index db51c9d91a..c3c72a13f8 100644 --- a/jdi-light-html-tests/src/test/resources/functional.xml +++ b/jdi-light-html-tests/src/test/resources/functional.xml @@ -1,6 +1,6 @@ - + diff --git a/jdi-light-html/pom.xml b/jdi-light-html/pom.xml index 14e73e5703..1f79fc9b2f 100644 --- a/jdi-light-html/pom.xml +++ b/jdi-light-html/pom.xml @@ -7,7 +7,7 @@ jdi-light-html JDI Light Html Elements jar - 1.3.9 + 1.3.10 com.epam.jdi @@ -20,7 +20,7 @@ com.epam.jdi jdi-light - 1.3.9 + 1.3.10 diff --git a/jdi-light-mobile-bootstrap-web-tests/pom.xml b/jdi-light-mobile-bootstrap-web-tests/pom.xml index 2b2b5dc621..a62063e18f 100644 --- a/jdi-light-mobile-bootstrap-web-tests/pom.xml +++ b/jdi-light-mobile-bootstrap-web-tests/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 1.3.9 + 1.3.10 jdi-light-mobile-bootstrap-web-tests Tests: JDI Mobile Bootstrap Web tests com.epam.jdi @@ -17,7 +17,7 @@ 2.10.0 9.4.12.RC2 1.9.6 - 1.3.9 + 1.3.10 src/test/resources/demoRun.xml src/test/resources/general.xml diff --git a/jdi-light-mobile-html-web-tests/pom.xml b/jdi-light-mobile-html-web-tests/pom.xml index 0eb939eb73..de096ac234 100644 --- a/jdi-light-mobile-html-web-tests/pom.xml +++ b/jdi-light-mobile-html-web-tests/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 1.3.9 + 1.3.10 jdi-light-mobile-html-web-tests Tests: JDI Mobile HTML Web com.epam.jdi @@ -17,7 +17,7 @@ 2.10.0 9.4.12.RC2 1.9.6 - 1.3.9 + 1.3.10 src/test/resources/demoRun.xml src/test/resources/general.xml diff --git a/jdi-light-mobile-tests/pom.xml b/jdi-light-mobile-tests/pom.xml index 12aab5dfd2..2dbe5c99cc 100644 --- a/jdi-light-mobile-tests/pom.xml +++ b/jdi-light-mobile-tests/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 1.3.9 + 1.3.10 jdi-light-mobile-tests Tests: JDI Mobile com.epam.jdi @@ -30,12 +30,12 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 com.epam.jdi jdi-light-mobile - 1.3.9 + 1.3.10 diff --git a/jdi-light-mobile/pom.xml b/jdi-light-mobile/pom.xml index 93b3a1aa62..df6a679ca9 100644 --- a/jdi-light-mobile/pom.xml +++ b/jdi-light-mobile/pom.xml @@ -7,7 +7,7 @@ jdi-light-mobile JDI Light Mobile jar - 1.3.9 + 1.3.10 com.epam.jdi @@ -20,7 +20,7 @@ com.epam.jdi jdi-light - 1.3.9 + 1.3.10 diff --git a/jdi-light/pom.xml b/jdi-light/pom.xml index ff9093d37f..9f49292eaf 100644 --- a/jdi-light/pom.xml +++ b/jdi-light/pom.xml @@ -7,7 +7,7 @@ jdi-light JDI Light jar - 1.3.9 + 1.3.10 com.epam.jdi diff --git a/jdi-light/src/main/java/com/epam/jdi/light/asserts/core/SoftAssert.java b/jdi-light/src/main/java/com/epam/jdi/light/asserts/core/SoftAssert.java index a265b9bab7..c58bc175e5 100644 --- a/jdi-light/src/main/java/com/epam/jdi/light/asserts/core/SoftAssert.java +++ b/jdi-light/src/main/java/com/epam/jdi/light/asserts/core/SoftAssert.java @@ -17,10 +17,10 @@ */ public class SoftAssert { private static Safe> listOfErrors = new Safe<>(new ArrayList<>()); - private static boolean IS_SOFT_ASSERT = false; + private static Safe IS_SOFT_ASSERT = new Safe<>(() -> false); public static void setAssertType(String type) { - IS_SOFT_ASSERT = type.equalsIgnoreCase("soft"); + IS_SOFT_ASSERT.set(type.equalsIgnoreCase("soft")); clearResults(); } public static void assertSoft() { @@ -33,7 +33,7 @@ public static void jdiAssert(List actual, Matcher> matche try { assertThat(actual, matcher); } catch (Throwable error) { - if (IS_SOFT_ASSERT) { + if (IS_SOFT_ASSERT.get()) { addError(error); } else throw new AssertionError(error); @@ -46,7 +46,7 @@ public static void jdiAssert(T actual, Matcher matcher, String er } catch (Throwable error) { String errorMessage = nowTimeShort() + " " + getErrorMsg(errorMsg, error); AssertionError failError = new AssertionError(errorMessage); - if (IS_SOFT_ASSERT) { + if (IS_SOFT_ASSERT.get()) { addError(failError); } else throw failError; diff --git a/jdi-light/src/main/java/com/epam/jdi/light/elements/base/JDIBase.java b/jdi-light/src/main/java/com/epam/jdi/light/elements/base/JDIBase.java index 3bbf6f1929..e7b57e518f 100644 --- a/jdi-light/src/main/java/com/epam/jdi/light/elements/base/JDIBase.java +++ b/jdi-light/src/main/java/com/epam/jdi/light/elements/base/JDIBase.java @@ -63,7 +63,6 @@ public abstract class JDIBase extends DriverBase implements IBaseElement, HasCac protected Safe timeout = new Safe<>(() -> -1); protected Safe waitAfterTimeout = new Safe<>(() -> -1); protected String waitAfterMethod = ""; - private Safe actions = new Safe<>(() -> new Actions(driver())); public ElementArea clickAreaType = ELEMENT.clickType; public TextTypes textType = ELEMENT.getTextType; public SetTextTypes setTextType = ELEMENT.setTextType; @@ -451,29 +450,16 @@ public String printWebElement() { if (isBlank(element.varName)) return element.context; return Switch(LOGS.logLevel).get( - Case(l -> l == STEP, - l -> msgFormat(PRINT_ELEMENT_STEP, element)), - Case(l -> l == INFO, - l -> msgFormat(PRINT_ELEMENT_INFO, element)), - Case(l -> l == ERROR, - l -> msgFormat(PRINT_ERROR_STEP, element)), - Default(l -> msgFormat(PRINT_ELEMENT_DEBUG, element)) + Case(l -> l == STEP, + l -> msgFormat(PRINT_ELEMENT_STEP, element)), + Case(l -> l == INFO, + l -> msgFormat(PRINT_ELEMENT_INFO, element)), + Case(l -> l == ERROR, + l -> msgFormat(PRINT_ERROR_STEP, element)), + Default(l -> msgFormat(PRINT_ELEMENT_DEBUG, element)) ); }; - public void actions(JFunc2 action) { - action.execute(actions.get(), get()).build().perform(); - } - public void actions(JFunc1 action) { - action.execute(actions.get()).build().perform(); - } - public void actionsWithElement(JFunc2 action) { - action.execute(actions.get().moveToElement(get()), get()).build().perform(); - } - public void actionsWithElement(JFunc1 action) { - action.execute(actions.get().moveToElement(get())).build().perform(); - } - @Override public void offCache() { webElement.useCache(false); diff --git a/jdi-light/src/main/java/com/epam/jdi/light/elements/common/UIElement.java b/jdi-light/src/main/java/com/epam/jdi/light/elements/common/UIElement.java index 1af5e0aeb0..7cb105ad04 100644 --- a/jdi-light/src/main/java/com/epam/jdi/light/elements/common/UIElement.java +++ b/jdi-light/src/main/java/com/epam/jdi/light/elements/common/UIElement.java @@ -16,6 +16,7 @@ import com.epam.jdi.tools.func.JAction1; import com.epam.jdi.tools.func.JFunc; import com.epam.jdi.tools.func.JFunc1; +import com.epam.jdi.tools.func.JFunc2; import com.epam.jdi.tools.map.MapArray; import org.hamcrest.Matchers; import org.openqa.selenium.*; @@ -553,6 +554,29 @@ public void show() { } } + private Actions getActions() { + return new Actions(driver()); + } + private WebElement showElement() { + show(); + return getWebElement(); + } + public void actions(JFunc2 action) { + WebElement webElement = showElement(); + action.execute(getActions(), webElement).build().perform(); + } + public void actions(JFunc1 action) { + show(); + action.execute(getActions()).build().perform(); + } + public void actionsWithElement(JFunc2 action) { + WebElement webElement = showElement(); + action.execute(getActions().moveToElement(webElement), webElement).build().perform(); + } + public void actionsWithElement(JFunc1 action) { + WebElement webElement = showElement(); + action.execute(getActions().moveToElement(webElement)).build().perform(); + } /** * Scroll view to element and make a border around with specified color * @param color diff --git a/jdi-light/src/main/java/com/epam/jdi/light/elements/complex/table/Grid.java b/jdi-light/src/main/java/com/epam/jdi/light/elements/complex/table/Grid.java index 887220e040..5ac861dcae 100644 --- a/jdi-light/src/main/java/com/epam/jdi/light/elements/complex/table/Grid.java +++ b/jdi-light/src/main/java/com/epam/jdi/light/elements/complex/table/Grid.java @@ -7,6 +7,7 @@ import com.epam.jdi.light.elements.complex.WebList; import com.epam.jdi.light.elements.pageobjects.annotations.locators.JTable; import org.apache.commons.lang3.ObjectUtils; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import java.lang.reflect.Field; @@ -16,6 +17,7 @@ import static com.epam.jdi.light.common.Exceptions.exception; import static com.epam.jdi.light.driver.WebDriverByUtils.NAME_TO_LOCATOR; +import static com.epam.jdi.light.driver.WebDriverByUtils.getByLocator; import static com.epam.jdi.light.driver.WebDriverFactory.hasRunDrivers; import static com.epam.jdi.light.elements.pageobjects.annotations.objects.FillFromAnnotationRules.fieldHasAnnotation; import static com.epam.jdi.light.settings.JDISettings.ELEMENT; @@ -66,8 +68,13 @@ public UIElement core() { } protected void validateLocators(UIElement core) { if (headerLocator.equals("th") && core.finds("th").isEmpty()) { - headerLocator = core.finds("thead td").isNotEmpty() - ? "thead td" : "//tr[1]//td"; + if (core.finds("thead td").isNotEmpty()) { + headerLocator = "thead td"; + } else { + if (core.finds("//tr[1]//td").isNotEmpty()) { + headerLocator = "//tr[1]//td"; + } + } } } diff --git a/pom.xml b/pom.xml index b4861b0655..8c232f25f7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.epam.jdi - 1.3.9 + 1.3.10 jdi-2 JDI UI 2.0 pom diff --git a/test-examples/jdi-bdd-no-po-tests/pom.xml b/test-examples/jdi-bdd-no-po-tests/pom.xml index 3d36019c30..8600966626 100644 --- a/test-examples/jdi-bdd-no-po-tests/pom.xml +++ b/test-examples/jdi-bdd-no-po-tests/pom.xml @@ -6,7 +6,7 @@ com.epam.jdi jdi-bdd-no-po-tests - 1.3.9 + 1.3.10 Examples: JDI BDD no Page Objects @@ -22,7 +22,7 @@ com.epam.jdi jdi-bdd - 1.3.9 + 1.3.10 info.cukes diff --git a/test-examples/jdi-light-examples/pom.xml b/test-examples/jdi-light-examples/pom.xml index eed2a52c91..3dd8780542 100644 --- a/test-examples/jdi-light-examples/pom.xml +++ b/test-examples/jdi-light-examples/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 1.3.9 + 1.3.10 jdi-light-examples Examples: JDI Web Tests com.epam.jdi @@ -22,7 +22,7 @@ com.epam.jdi jdi-light - 1.3.9 + 1.3.10 diff --git a/test-examples/jdi-performance/pom.xml b/test-examples/jdi-performance/pom.xml index 16a6f6bf1f..81e1c867e9 100644 --- a/test-examples/jdi-performance/pom.xml +++ b/test-examples/jdi-performance/pom.xml @@ -6,7 +6,7 @@ com.epam.jdi jdi-performance - 1.3.9 + 1.3.10 Examples: JDI Performance @@ -25,7 +25,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/test-examples/jdi-performance/src/test/resources/general.xml b/test-examples/jdi-performance/src/test/resources/general.xml index 101c62322a..e7f5ef9d8e 100644 --- a/test-examples/jdi-performance/src/test/resources/general.xml +++ b/test-examples/jdi-performance/src/test/resources/general.xml @@ -1,6 +1,6 @@ - + diff --git a/test-templates/jdi-light-junit-template/pom.xml b/test-templates/jdi-light-junit-template/pom.xml index 2d116baf77..c1b5d0609b 100644 --- a/test-templates/jdi-light-junit-template/pom.xml +++ b/test-templates/jdi-light-junit-template/pom.xml @@ -24,7 +24,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/test-templates/jdi-light-testng-template/pom.xml b/test-templates/jdi-light-testng-template/pom.xml index b5bbdbb392..a999a0e095 100644 --- a/test-templates/jdi-light-testng-template/pom.xml +++ b/test-templates/jdi-light-testng-template/pom.xml @@ -26,7 +26,7 @@ com.epam.jdi jdi-light-html - 1.3.9 + 1.3.10 diff --git a/test-templates/jdi-light-testng-template/src/test/resources/general.xml b/test-templates/jdi-light-testng-template/src/test/resources/general.xml index 101c62322a..e7f5ef9d8e 100644 --- a/test-templates/jdi-light-testng-template/src/test/resources/general.xml +++ b/test-templates/jdi-light-testng-template/src/test/resources/general.xml @@ -1,6 +1,6 @@ - +