-
Notifications
You must be signed in to change notification settings - Fork 0
/
AOI_Education_Navigation.java
144 lines (120 loc) · 5.69 KB
/
AOI_Education_Navigation.java
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package UCSD;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
public class AOI_Education_Navigation {
WebDriver driver;
String baseUrl = "http://cmsdevmerge.ucsd.edu";
@Test
public void Cat_CommissionApprovedPrograms() throws InterruptedException {
driver.findElement(By.xpath("//ul[@id='main-menu']/li/a")).click();
Actions builder = new Actions(driver);
try {
Thread.sleep(2000);
WebElement AOIMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/education-programs')]"));
builder.moveToElement(AOIMenu).click().build().perform();
Thread.sleep(1000);
WebElement SubMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/commission-approved-programs')]"));
builder.moveToElement(SubMenu).build().perform();
SubMenu.click();
SubMenu.click();
}catch(StaleElementReferenceException e){};
String CurrentURL = driver.getCurrentUrl();
String ExpectedCurrentURL = "http://cmsdevmerge.ucsd.edu/courses-and-programs/commission-approved-programs";
Assert.assertEquals(CurrentURL, ExpectedCurrentURL);
}
@Test
public void Cat_ProfessionalDevelopment() throws InterruptedException {
driver.findElement(By.xpath("//ul[@id='main-menu']/li/a")).click();
Actions builder = new Actions(driver);
try {
Thread.sleep(2000);
WebElement AOIMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/education-programs')]"));
builder.moveToElement(AOIMenu).click().build().perform();
Thread.sleep(1000);
WebElement SubMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/professional-development')]"));
builder.moveToElement(SubMenu).build().perform();
SubMenu.click();
SubMenu.click();
}catch(StaleElementReferenceException e){};
String CurrentURL = driver.getCurrentUrl();
String ExpectedCurrentURL = "http://cmsdevmerge.ucsd.edu/courses-and-programs/professional-development";
Assert.assertEquals(CurrentURL, ExpectedCurrentURL);
}
@Test
public void Cat_SupportingK12Students() throws InterruptedException {
driver.findElement(By.xpath("//ul[@id='main-menu']/li/a")).click();
Actions builder = new Actions(driver);
try {
Thread.sleep(2000);
WebElement AOIMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/education-programs')]"));
builder.moveToElement(AOIMenu).click().build().perform();
Thread.sleep(1000);
WebElement SubMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/supporting-k-12-students')]"));
builder.moveToElement(SubMenu).build().perform();
SubMenu.click();
SubMenu.click();
}catch(StaleElementReferenceException e){};
String CurrentURL = driver.getCurrentUrl();
String ExpectedCurrentURL = "http://cmsdevmerge.ucsd.edu/courses-and-programs/supporting-k-12-students";
Assert.assertEquals(CurrentURL, ExpectedCurrentURL);
}
@Test
public void Cat_TEFL() throws InterruptedException {
driver.findElement(By.xpath("//ul[@id='main-menu']/li/a")).click();
Actions builder = new Actions(driver);
try {
Thread.sleep(2000);
WebElement AOIMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/education-programs')]"));
builder.moveToElement(AOIMenu).click().build().perform();
Thread.sleep(1000);
WebElement SubMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/teaching-english-as-a-foreign-language-tefl')]"));
builder.moveToElement(SubMenu).build().perform();
SubMenu.click();
SubMenu.click();
}catch(StaleElementReferenceException e){};
String CurrentURL = driver.getCurrentUrl();
String ExpectedCurrentURL = "http://cmsdevmerge.ucsd.edu/courses-and-programs/teaching-english-as-a-foreign-language-tefl";
Assert.assertEquals(CurrentURL, ExpectedCurrentURL);
}
@Test
public void Cat_TeachingStrategiesForAdults() throws InterruptedException {
driver.findElement(By.xpath("//ul[@id='main-menu']/li/a")).click();
Actions builder = new Actions(driver);
try {
Thread.sleep(2000);
WebElement AOIMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/education-programs')]"));
builder.moveToElement(AOIMenu).click().build().perform();
Thread.sleep(1000);
WebElement SubMenu = driver.findElement(By.xpath("//a[contains(@href, '/courses-and-programs/teaching-strategies-for-adults')]"));
builder.moveToElement(SubMenu).build().perform();
SubMenu.click();
SubMenu.click();
}catch(StaleElementReferenceException e){};
String CurrentURL = driver.getCurrentUrl();
String ExpectedCurrentURL = "http://cmsdevmerge.ucsd.edu/courses-and-programs/teaching-strategies-for-adults";
Assert.assertEquals(CurrentURL, ExpectedCurrentURL);
}
@BeforeClass
public void beforeMethod() {
System.setProperty("webdriver.chrome.driver", "/home/opendatalabs/tools/selenium/chromedriver");
driver =new ChromeDriver();
driver.get(baseUrl);
}
@AfterClass
public void afterMethod() {
driver.quit();
}
}