-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCat_BusinessIntelligence.java
More file actions
149 lines (126 loc) · 6.17 KB
/
Copy pathCat_BusinessIntelligence.java
File metadata and controls
149 lines (126 loc) · 6.17 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
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
145
146
147
148
149
package UCSD;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class Cat_BusinessIntelligence {
WebDriver driver;
String baseUrl = "http://cmsdevmerge.ucsd.edu/courses-and-programs/business-intelligence-courses";
@Test
public void PageTitle() {
String expectedTitle = "Business Intelligence Courses | UCSD Extension";
String actualTitle = "";
actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}
@Test
public void Hero_size() {
int height = driver.findElement(By.xpath("html/body/form/main/section[1]/div/div/div/div[1]")).getSize().getHeight();
int width = driver.findElement(By.xpath("html/body/form/main/section[1]/div/div/div/div[1]")).getSize().getWidth();
System.out.print("height: "+height);
System.out.println(", width: "+width);
if(height >= 449 && width >=1291){
System.out.println("Test - 2 : Passed \n");
} else {
System.out.println("Test - 2 : Failed \n");
}
}
@Test
public void Hero_Label() {
String expectedLabel = "Business Intelligence";
String Label = driver.findElement(By.xpath("html/body/form/main/section/div/div/div/div/div/h1")).getText();
System.out.println("Hero label: "+Label);
Assert.assertEquals(Label, expectedLabel);
}
@Test
public void Breadcrumb() {
String expectedBreadCrumb = "Home / Courses and Programs / Business Intelligence";
String BreadCrumb = driver.findElement(By.xpath("html/body/form/main/div[2]/div/div/section/div[1]")).getText();
System.out.println("BreadCrumb on AOI - Writing: "+BreadCrumb);
Assert.assertEquals(BreadCrumb, expectedBreadCrumb);
}
@Test
public void CertificateList() {
String Certificate[] = new String[20];
String ExpectedCertificate[] = new String[20];
ExpectedCertificate[1] = "Business Intelligence Analysis certificate";
ExpectedCertificate[2] = "Community Research and Program Evaluation certificate";
ExpectedCertificate[3] = "Finance certificate";
for(int i=1; i<4; i++){
Certificate[i] = driver.findElement(By.xpath("html/body/form/main/section[3]/div/div/div/div/div[1]/div[2]/ul[1]/li[" + i + "]/a/div/h4")).getText();
System.out.println("Certificate -" + i + " : " + Certificate[i]);
}
Assert.assertEquals(Certificate, ExpectedCertificate);
}
@Test
public void CertificateURL() {
String CertificateURL[] = new String[20];
String ExpectedCertificateURL[] = new String[20];
ExpectedCertificateURL[1] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/business-intelligence-analysis";
ExpectedCertificateURL[2] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/community-research-and-program-evaluation";
ExpectedCertificateURL[3] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/finance";
for(int i=1; i<4; i++){
CertificateURL[i] = driver.findElement(By.xpath("html/body/form/main/section[3]/div/div/div/div/div[1]/div[2]/ul[1]/li[" + i + "]/a")).getAttribute("href");
System.out.println("Certificate -" + i + " : " + CertificateURL[i]);
}
Assert.assertEquals(CertificateURL, ExpectedCertificateURL);
}
@Test
public void CourseList() {
String Course[] = new String[20];
String ExpectedCourse[] = new String[20];
ExpectedCourse[1] = "Advanced Excel for Analysis and Business Intelligence (CSE-41161)";
//ExpectedCourse[2] = "Community Data Sources (BUSA-40897)";
ExpectedCourse[2] = "Dashboards and Data Visualization for Data Analysis (CSE-41222)";
// ExpectedCourse[4] = "Introduction to SPSS (CSE-41254)";
ExpectedCourse[3] = "Introduction to Statistics (CSE-41069)";
ExpectedCourse[4] = "Mixed Methods Research (BUSA-40898)";
ExpectedCourse[5] = "Overview of BI and Data Analysis (CSE-41221)";
ExpectedCourse[6] = "Quantitative Financial Methods, Theory and Application (BUSA-40827)";
for(int i=1; i<7; i++){
Course[i] = driver.findElement(By.xpath("html/body/form/main/section[3]/div/div/div/div/div[1]/div[2]/ul[2]/li[" + i + "]/a/div/h4")).getText();
System.out.println("Course -" + i + " : " + Course[i]);
}
Assert.assertEquals(Course, ExpectedCourse);
}
@Test
public void CourseURL() {
String CourseURL[] = new String[20];
String ExpectedCourseURL[] = new String[20];
ExpectedCourseURL[1] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/advanced-excel-analysis-bi";
// ExpectedCourseURL[2] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/community-data-sources";
ExpectedCourseURL[2] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/dashboards-and-data-visualization";
//ExpectedCourseURL[4] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/introduction-to-spss";
ExpectedCourseURL[3] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/introduction-to-statistics";
ExpectedCourseURL[4] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/mixed-methods-research";
ExpectedCourseURL[5] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/overview-of-bi-and-data-analysis";
ExpectedCourseURL[6] = "http://cmsdevmerge.ucsd.edu/courses-and-programs/quantitative-financial-methods-theory-and-application";
for(int i=1; i<7; i++){
CourseURL[i] = driver.findElement(By.xpath("html/body/form/main/section[3]/div/div/div/div/div[1]/div[2]/ul[2]/li[" + i + "]/a")).getAttribute("href");
System.out.println("CategoryURL -" + i + " : " + CourseURL[i]);
}
Assert.assertEquals(CourseURL, ExpectedCourseURL);
}
@Test
public void BlogLabel() {
String expectedBlogLabel ="From the Blog";
String BlogLabel = driver.findElement(By.xpath("//*[@id='coursesPrograms']/div/div/div/div/div[2]/h3")).getText();
Assert.assertEquals(BlogLabel, expectedBlogLabel);
}
@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();
}
}