-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGuideTest.java
More file actions
89 lines (67 loc) · 2.87 KB
/
Copy pathGuideTest.java
File metadata and controls
89 lines (67 loc) · 2.87 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package tests;
import base.BaseTest;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.MainPage;
import pages.RoadRiskAPIPage;
import pages.SolarRadiationAPIPage;
import pages.top_menu.GuidePage;
public class GuideTest extends BaseTest {
@Test
public void testHomeLinkNavigatesToBaseURL() {
final String expectedBaseURL = "https://openweathermap.org/";
final String expectedGuideURL = "https://openweathermap.org/guide";
String baseURL = openBaseURL().getCurrentURL();
String guideURL = new MainPage(getDriver())
.clickGuideMenu()
.getCurrentURL();
Assert.assertNotEquals(guideURL, baseURL);
Assert.assertEquals(guideURL, expectedGuideURL);
String actualURL = new GuidePage(getDriver())
.clickHomeLink()
.waitForGreyContainerDisappeared()
.getCurrentURL();
Assert.assertNotEquals(actualURL, guideURL);
Assert.assertEquals(actualURL, baseURL);
Assert.assertEquals(actualURL, expectedBaseURL);
}
@Test
public void testSolarRadiationApiLink_NavigatesTo_SolarRadiationApiPage() {
final String expectedUrl = "https://openweathermap.org/api/solar-radiation";
final String expectedTitle = "Solar radiation API - OpenWeatherMap";
String oldURL = openBaseURL()
.clickGuideMenu()
.getCurrentURL();
String actualURL = new GuidePage(getDriver()).scrollToDedicatedWeatherProducts()
.clickSolarRadiationLink()
.getCurrentURL();
SolarRadiationAPIPage solarRadiationAPIPage = new SolarRadiationAPIPage(getDriver());
String actualTitle = solarRadiationAPIPage.getTitle();
Assert.assertNotEquals(oldURL, actualURL);
Assert.assertEquals(actualURL, expectedUrl);
Assert.assertEquals(actualTitle, expectedTitle);
}
@Test
public void testRoadRiskAPILink_NavigatesTo_RoadRiskAPIPage() {
final String expectedURL = "https://openweathermap.org/api/road-risk";
final String expectedTitle = "Road Risk - OpenWeatherMap";
String oldURL = openBaseURL()
.clickGuideMenu()
.getCurrentURL();
String actualURL = new GuidePage(getDriver())
.clickRoadRiskAPILink()
.getCurrentURL();
String actualTitle = new RoadRiskAPIPage(getDriver()).getTitle();
Assert.assertNotEquals(oldURL, actualURL);
Assert.assertEquals(actualURL, expectedURL);
Assert.assertEquals(actualTitle, expectedTitle);
}
@Test
public void testLearnMoreButtonsAmount() {
final int expectedAmount = 5;
int actualAmount = openBaseURL()
.clickGuideMenu()
.countLearnMoreButtons();
Assert.assertEquals(actualAmount, expectedAmount);
}
}