diff --git a/src/main/java/com/orasi/bluesource/Header.java b/src/main/java/com/orasi/bluesource/Header.java
index 3522250..0568db8 100644
--- a/src/main/java/com/orasi/bluesource/Header.java
+++ b/src/main/java/com/orasi/bluesource/Header.java
@@ -1,13 +1,10 @@
package com.orasi.bluesource;
-import javax.wsdl.Message;
-
-import org.openqa.selenium.NoSuchElementException;
-import org.openqa.selenium.support.FindBy;
-
import com.orasi.web.OrasiDriver;
import com.orasi.web.webelements.Link;
import com.orasi.web.webelements.impl.internal.ElementFactory;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.support.FindBy;
public class Header {
private OrasiDriver driver = null;
@@ -27,6 +24,16 @@ public Header(OrasiDriver driver){
/**Page Interactions**/
+ /**
+ * This method navigates to the Reporting login page
+ * @author David Grayson
+ */
+ public void navigateReporting(){
+ MessageCenter messageCenter = new MessageCenter(driver);
+ messageCenter.closeMessageCenter();
+ driver.get("http://10.238.243.127:8080/reporting/login");
+ }
+
/**
* This method navigates to Accounts page
* @author Paul
diff --git a/src/main/java/com/orasi/bluesource/ProjectTimeByTimeSheetForm.java b/src/main/java/com/orasi/bluesource/ProjectTimeByTimeSheetForm.java
new file mode 100644
index 0000000..43e5ed4
--- /dev/null
+++ b/src/main/java/com/orasi/bluesource/ProjectTimeByTimeSheetForm.java
@@ -0,0 +1,101 @@
+package com.orasi.bluesource;
+
+import com.orasi.web.OrasiDriver;
+import com.orasi.web.PageLoaded;
+import com.orasi.web.webelements.Element;
+import com.orasi.web.webelements.Listbox;
+import com.orasi.web.webelements.Textbox;
+import com.orasi.web.webelements.Webtable;
+import com.orasi.web.webelements.impl.internal.ElementFactory;
+import org.openqa.selenium.support.FindBy;
+
+public class ProjectTimeByTimeSheetForm {
+ private OrasiDriver driver = null;
+
+ /**Page Elements**/
+ @FindBy(xpath = "//select[@id='project_']") private Listbox lstProjectSelect;
+ @FindBy(xpath = "//input[@id='start_date']") private Textbox txtStartDate;
+ @FindBy(xpath = "//input[@id='end_date']") private Textbox txtEndDate;
+ @FindBy(xpath = "//input[@name='commit']") private Element elmGenerateReport;
+ @FindBy(xpath = "//table[@class='ui-datepicker-calendar']") private Webtable tblCalendarPopup;
+ @FindBy(xpath = "//h4[@id='report-title']") private Element elmFormTitle;
+
+ /**Constructor**/
+ public ProjectTimeByTimeSheetForm(OrasiDriver driver) {
+ this.driver = driver;
+ ElementFactory.initElements(driver,this);
+ }
+
+ /**Page Interactions**/
+
+ /**
+ * @author David Grayson
+ * @return {@link Boolean} Returns true if the form is loaded, false otherwise.
+ */
+ public boolean verifyFormIsLoaded(){
+ return checkLoaded(lstProjectSelect) &&
+ checkLoaded(txtStartDate) &&
+ checkLoaded(txtEndDate) &&
+ checkLoaded(elmGenerateReport);
+ }
+
+ private boolean checkLoaded(Element elm) {
+ return PageLoaded.isElementLoaded(this.getClass(),driver,elm,5);
+ }
+
+ /**
+ * This method selects an employee from the list that appears
+ * @author David Grayson
+ * @param project {@link String} full name of the Project to select
+ */
+ public void selectProject(String project){
+ if (canInteract(lstProjectSelect)){
+ lstProjectSelect.select(project);
+ }
+ }
+
+ /**
+ * This method clicks the Generate Report element
+ * @author David Grayson
+ */
+ public void clickGenerateReport(){
+ if (canInteract(elmGenerateReport) && tblCalendarPopup.syncHidden(5)){
+ elmGenerateReport.click();
+ }
+ }
+
+ /**
+ * This method sets the End Date field
+ * @author David Grayson
+ * @param endDate {@link String} mm/dd/yyyy format
+ */
+ public void setEndDate(String endDate){
+ if (canInteract(txtEndDate)){
+ txtEndDate.clear();
+ txtEndDate.sendKeys(endDate);
+ }
+ }
+
+ /**
+ * This method sets the Start Date field
+ * @author David Grayson
+ * @param startDate {@link String} mm/dd/yyyy format
+ */
+ public void setStartDate(String startDate){
+ if (canInteract(txtStartDate)){
+ txtStartDate.clear();
+ txtStartDate.sendKeys(startDate);
+ }
+ }
+
+ /**
+ * This method provides standard checks that an element can be interacted with
+ * @author David Grayson
+ * @param elm {@link Element} Element to check
+ * @return {@link Boolean} Returns true if the element is enabled and visible, false otherwise
+ */
+ private boolean canInteract(Element elm){
+ elmFormTitle.click(); //to clear any popups
+ return elm.syncEnabled(5) && elm.syncVisible(5);
+ }
+}
diff --git a/src/main/java/com/orasi/bluesource/Report.java b/src/main/java/com/orasi/bluesource/Report.java
new file mode 100644
index 0000000..8e6ab0d
--- /dev/null
+++ b/src/main/java/com/orasi/bluesource/Report.java
@@ -0,0 +1,95 @@
+package com.orasi.bluesource;
+
+import com.orasi.utils.TestReporter;
+import com.orasi.web.OrasiDriver;
+import com.orasi.web.PageLoaded;
+import com.orasi.web.webelements.Element;
+import com.orasi.web.webelements.Webtable;
+import com.orasi.web.webelements.impl.internal.ElementFactory;
+import org.openqa.selenium.support.FindBy;
+
+public class Report {
+ private OrasiDriver driver = null;
+
+ /**Page Elements**/
+ @FindBy(xpath = "//h3[@class='report-title']") private Element elmReportTitle;
+ @FindBy(xpath = "//table") private Webtable tblReport;
+
+ /**Constructor**/
+ public Report(OrasiDriver driver) {
+ this.driver = driver;
+ ElementFactory.initElements(driver, this);
+ }
+
+ /**Page Interactions**/
+
+ /**
+ * @author David Grayson
+ * @return {@link Boolean} Returns true if the report is loaded, false otherwise.
+ */
+ public boolean verifyReportIsLoaded(){
+ return PageLoaded.isElementLoaded(this.getClass(),driver,elmReportTitle,5) &&
+ PageLoaded.isElementLoaded(this.getClass(),driver,tblReport,5);
+ }
+
+ /**
+ * @author David Grayson
+ * @return {@link String} Returns the title of the report
+ */
+ public String getTitle(){
+ return elmReportTitle.getText();
+ }
+
+ /**
+ * @author David Grayson
+ * @return {@link Boolean} Returns true if all the sub totals and the grand total are correct, false otherwise.
+ */
+ public boolean checkTotals(){
+ int runningTotal = 0;
+ int sectionTotal = 0;
+ int rowBeginSection = 1;
+ int rowOfSectionTotal = 1;
+
+ /*
+ The do while loop iterates over a report of any size and checks all the sub totals and the grand total
+ to make sure they add up correctly.
+ */
+ do {
+ /*
+ This for loop find the row with the "Total:" line to set the ned point for the next section
+ */
+ for (int i=rowBeginSection; itrue if the element is enabled and visible, false otherwise
+ */
+ private boolean canInteract(Element elm){
+ return elm.syncEnabled(5) && elm.syncVisible(5);
+ }
+
+ /**
+ * @author David Grayson
+ * @return {@link Boolean} Returns true if on the Reporting Home page.
+ */
+ public boolean verifyHomePageIsDisplayed(){
+ return elmWelcome.syncVisible(5,false);
+ }
+}
diff --git a/src/test/java/com/bluesource/reports/ProjectReportsTimeByTimeSheet.java b/src/test/java/com/bluesource/reports/ProjectReportsTimeByTimeSheet.java
new file mode 100644
index 0000000..f40fbca
--- /dev/null
+++ b/src/test/java/com/bluesource/reports/ProjectReportsTimeByTimeSheet.java
@@ -0,0 +1,81 @@
+package com.bluesource.reports;
+
+import com.orasi.bluesource.*;
+import com.orasi.utils.TestReporter;
+import com.orasi.web.WebBaseTest;
+import org.testng.ITestContext;
+import org.testng.annotations.*;
+
+public class ProjectReportsTimeByTimeSheet extends WebBaseTest {
+ @BeforeMethod
+ @Parameters({"runLocation", "browserUnderTest", "browserVersion",
+ "operatingSystem", "environment"})
+ public void setup(@Optional String runLocation, String browserUnderTest,
+ String browserVersion, String operatingSystem, String environment) {
+ setApplicationUnderTest("BLUESOURCE");
+ setBrowserUnderTest(browserUnderTest);
+ setBrowserVersion(browserVersion);
+ setOperatingSystem(operatingSystem);
+ setRunLocation(runLocation);
+ setEnvironment(environment);
+ setThreadDriver(true);
+ testStart("");
+ }
+
+ @AfterMethod
+ public void close(ITestContext testResults) {
+ endTest("TestAlert", testResults);
+ }
+
+ @Test
+ public void projectReportsTimeByTimeSheet() {
+ //Test Variables
+ String strProject = "Project1";
+ String strStartDate = "10/01/2017";
+ String strEndDate = "03/07/2018";
+ String reportTitle = "Time by Time Sheet: " + strStartDate + "-" + strEndDate;
+
+ //Page Models
+ LoginPage loginPage = new LoginPage(getDriver());
+ Header header = new Header(getDriver());
+ ReportingNavBar reportingNavBar = new ReportingNavBar(getDriver());
+ ProjectTimeByTimeSheetForm projectTimeByTimeSheetForm = new ProjectTimeByTimeSheetForm(getDriver());
+ Report report = new Report(getDriver());
+
+ TestReporter.logStep("Navigating to BlueSourceReport");
+ header.navigateReporting();
+
+ TestReporter.assertTrue(loginPage.verifyPageIsLoaded(),"Verifying login page has loaded");
+
+ TestReporter.logStep("Logging in as Admin");
+ loginPage.AdminLogin();
+
+ TestReporter.assertTrue(reportingNavBar.verifyHomePageIsDisplayed(),"Verifying Reporting Home Page is displayed");
+
+ TestReporter.logStep("Clicking Projects Reports");
+ reportingNavBar.clickProjectsReport();
+
+ TestReporter.logStep("Clicking 'Time by Time Sheet' under Projects Reports");
+ reportingNavBar.clickProjectsReportTimeByTimeSheet();
+
+ TestReporter.assertTrue(projectTimeByTimeSheetForm.verifyFormIsLoaded(),"Verifying form has loaded");
+
+ TestReporter.logStep("Selecting Project");
+ projectTimeByTimeSheetForm.selectProject(strProject);
+
+ TestReporter.logStep("Setting Start Date");
+ projectTimeByTimeSheetForm.setStartDate(strStartDate);
+
+ TestReporter.logStep("Setting End Date");
+ projectTimeByTimeSheetForm.setEndDate(strEndDate);
+
+ TestReporter.logStep("Clicking Generate Report");
+ projectTimeByTimeSheetForm.clickGenerateReport();
+
+ TestReporter.assertTrue(report.verifyReportIsLoaded(),"Verifying report has loaded");
+
+ TestReporter.assertEquals(reportTitle,report.getTitle(),"Verifying report title");
+
+ TestReporter.assertTrue(report.checkTotals(), "Verifying totals are correct");
+ }
+}
\ No newline at end of file