Skip to content

Commit 469f454

Browse files
committed
[Feature/Add_Relative_Locators] Refactor code
1 parent 8107209 commit 469f454

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/aquality/selenium/locators/RelativeBy.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.openqa.selenium.SearchContext;
66
import org.openqa.selenium.WebElement;
77
import org.openqa.selenium.support.locators.RelativeLocator;
8-
98
import java.util.List;
109

1110
public class RelativeBy extends By implements IRelativeByAqualityElement, IRelativeByWebElement, IRelativeBy {

src/test/java/tests/integration/LocatorTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void testToRightOfLocatorWithDifferentToRightOfParametersType() {
143143
}
144144

145145
@Test
146-
public void testAboveBelowLeftRight() {
146+
public void testAboveBelowLeftRightWithDifferentParametersType() {
147147
ILabel cellInRow3Column5 = challengingDomForm.getCellInRow3Column5();
148148
ILabel cellInRow5Column7 = challengingDomForm.getCellInRow5Column7();
149149
ILabel cellInRow5Column5 = challengingDomForm.getCellInRow5Column5();
@@ -194,7 +194,7 @@ public void testAboveBelowLeftRight() {
194194
}
195195

196196
@Test
197-
public void testNear() {
197+
public void testNearWithDifferentNearParameterType() {
198198
ILabel actualCellRaw2Column1GotWithAqualityElement =
199199
elementFactory.getLabel(with(By.xpath(labelLocatorCell)).near(challengingDomForm.getCellInRow1Column1()),
200200
ChallengingDomForm.ELEMENT_NAME_ROW2_COLUMN1);
@@ -221,7 +221,7 @@ public void testNear() {
221221
}
222222

223223
@Test
224-
public void testNearWithDistance() {
224+
public void testNearWithDistanceWithDifferentParametersType() {
225225
ILabel actualHeaderNameGotWithAqualityElement =
226226
elementFactory.getLabel(with(By.xpath(ChallengingDomForm.LOCATOR_CHALLENGING_DOM_FORM))
227227
.near(challengingDomForm.getCellInRow1Column1(), distanceToFindElementWithPositiveResult),
@@ -251,7 +251,7 @@ public void testNearWithDistance() {
251251
}
252252

253253
@Test
254-
public void testNearWithDistanceNegative() {
254+
public void testNearWithDistanceNegativeWithDifferentParametersType() {
255255
ILabel actualHeaderNameGotWithAqualityElement =
256256
elementFactory.getLabel(with(By.xpath(ChallengingDomForm.LOCATOR_CHALLENGING_DOM_FORM))
257257
.near(challengingDomForm.getCellInRow1Column1(), distanceToFindElementWithNegativeResult),
@@ -268,19 +268,19 @@ public void testNearWithDistanceNegative() {
268268
ChallengingDomForm.ELEMENT_NAME_HEADER_CHALLENGING_DOM);
269269

270270

271-
List<WebElement> actualsWebElementsHeaderNameGotBySeleniumRelative =
271+
List<WebElement> actualWebElementsHeaderNameGotBySeleniumRelative =
272272
getBrowser().getDriver().findElements(RelativeLocator.with(By.xpath(ChallengingDomForm.LOCATOR_CHALLENGING_DOM_FORM))
273273
.near(getBrowser().getDriver().findElement(By.xpath(challengingDomForm.getLocatorCellRow1Column1())), distanceToFindElementWithNegativeResult));
274274

275275
SoftAssert softAssert = new SoftAssert();
276276
softAssert.assertFalse(actualHeaderNameGotWithAqualityElement.state().isExist(), friendlyMessageElementFound);
277277
softAssert.assertFalse(actualHeaderNameGotWithWebElement.state().isExist(), friendlyMessageElementFound);
278278
softAssert.assertFalse(actualHeaderNameGotWithXpath.state().isExist(), friendlyMessageElementFound);
279-
softAssert.assertEquals(actualsWebElementsHeaderNameGotBySeleniumRelative.size(), 0, friendlyMessageElementFound);
279+
softAssert.assertEquals(actualWebElementsHeaderNameGotBySeleniumRelative.size(), 0, friendlyMessageElementFound);
280280
softAssert.assertAll();
281281
}
282282

283-
public void checkDifferentTypesWithSoftAssert(String textAquality, String textWebElement, String textByXpath, String textSelenium, String expectedText) {
283+
private void checkDifferentTypesWithSoftAssert(String textAquality, String textWebElement, String textByXpath, String textSelenium, String expectedText) {
284284
SoftAssert softAssert = new SoftAssert();
285285
softAssert.assertEquals(textAquality, expectedText, friendlyMessageEquallingText);
286286
softAssert.assertEquals(textByXpath, expectedText, friendlyMessageEquallingText);

0 commit comments

Comments
 (0)