-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFindTest.java
More file actions
51 lines (38 loc) · 1.5 KB
/
Copy pathFindTest.java
File metadata and controls
51 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package tests;
import base.BaseTest;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.FindPage;
import pages.MainPage;
import utils.TestUtils;
import java.util.List;
public class FindTest extends BaseTest {
@Test
public void testNavigationToFindPage_WithTheSameCityName() {
final String cityName = "Rome";
final String attributeName = "value";
String enteredCityName = openBaseURL()
.inputSearchCriteriaIntoSearchField(cityName)
.getEnteredValue();
Assert.assertEquals(enteredCityName, cityName);
String findPageSearchFieldValue = new MainPage(getDriver())
.clickEnter()
.getSearchFieldValue(attributeName);
Assert.assertEquals(findPageSearchFieldValue, enteredCityName);
Assert.assertEquals(findPageSearchFieldValue, cityName);
}
@Test
public void testCityInSearchFieldContainsCity() {
final String expectedCityName = "Rome";
List<WebElement> actualResultList = openBaseURL()
.inputSearchCriteriaIntoSearchField(expectedCityName)
.clickEnter()
.getResultRows();
Assert.assertTrue(actualResultList.size() > 0);
List<String> cityNames = new FindPage(getDriver()).getCityCountryNames();
for (String cityName : cityNames) {
Assert.assertEquals(TestUtils.getSubstring(cityName, ","), expectedCityName);
}
}
}