diff --git a/src/main/java/com/orasi/bluesource/AccountTimeByTimeSheetForm.java b/src/main/java/com/orasi/bluesource/AccountTimeByTimeSheetForm.java
new file mode 100644
index 0000000..94e7452
--- /dev/null
+++ b/src/main/java/com/orasi/bluesource/AccountTimeByTimeSheetForm.java
@@ -0,0 +1,91 @@
+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.impl.internal.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.FindBy;
+
+public class AccountTimeByTimeSheetForm {
+ private OrasiDriver driver = null;
+
+ /**Page Elements**/
+ @FindBy(xpath = "//select[@id='account_select']") private Listbox lstAccountSelect;
+ @FindBy(xpath = "//input[@name='start_date']") private Textbox txtStartDate;
+ @FindBy(xpath = "//input[@name='end_date']") private Textbox txtEndDate;
+ @FindBy(xpath = "//input[@name='commit']") private Element elmGenerateReport;
+ @FindBy(xpath = "//h4[@id='report-title']") private Element elmFormTitle;
+
+ /**Constructor**/
+ public AccountTimeByTimeSheetForm(OrasiDriver driver){
+ this.driver = driver;
+ ElementFactory.initElements(driver,this);
+ }
+
+ /**Page Interactions**/
+
+ /**
+ * This method checks that the Time by Time Sheet form is loaded
+ * @author David Grayson
+ * @return {@link Boolean} Returns true if the Form is loaded, false otherwise
+ */
+ public boolean verifyAccountTimeByTimeSheetFormLoaded(){
+ return PageLoaded.isElementLoaded(this.getClass(),driver,lstAccountSelect,5) &&
+ PageLoaded.isElementLoaded(this.getClass(),driver,txtStartDate,5) &&
+ PageLoaded.isElementLoaded(this.getClass(),driver,txtEndDate,5) &&
+ PageLoaded.isElementLoaded(this.getClass(),driver,elmGenerateReport);
+ }
+
+ /**
+ * This method selects an account by the name passed to it
+ * @author David Grayson
+ * @param strAccount {@link String} name of the account
+ */
+ public void selectAccount(String strAccount){
+ if (lstAccountSelect.syncEnabled(5) && lstAccountSelect.syncVisible(5)) {
+ lstAccountSelect.select(strAccount);
+ }
+ }
+
+ /**
+ * This method sets the Start Date field
+ * @author David Grayson
+ * @param strStartDate {@link String} mm/dd/yyyy format
+ */
+ public void setStartDate(String strStartDate){
+ if (txtStartDate.syncEnabled(5) && txtStartDate.syncVisible(5)){
+ txtStartDate.clear();
+ txtStartDate.sendKeys(strStartDate);
+ elmFormTitle.click(); //to get rid of the calendar popup
+ }
+ }
+
+ /**
+ * This method sets the End Date field
+ * @author David Grayson
+ * @param strEndDate {@link String} mm/dd/yyyy format
+ */
+ public void setEndDate(String strEndDate){
+ if (txtEndDate.syncEnabled(5) && txtEndDate.syncVisible(5)){
+ txtEndDate.clear();
+ txtEndDate.sendKeys(strEndDate);
+ elmFormTitle.click(); //to get rid of the calendar popup
+ }
+ }
+
+ /**
+ * This method clicks the Generate Report element
+ * @author David Grayson
+ */
+ public void clickGenerateReport(){
+ elmFormTitle.click();
+ if (driver.findElement(By.xpath("//th[@scope='col']")).syncHidden(5) &&
+ elmGenerateReport.syncEnabled(5) &&
+ elmGenerateReport.syncVisible(5)){
+ elmGenerateReport.click();
+ }
+ }
+}
diff --git a/src/main/java/com/orasi/bluesource/Header.java b/src/main/java/com/orasi/bluesource/Header.java
index 1c09b5a..bda1a61 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;
@@ -20,6 +17,7 @@ public class Header {
@FindBy(xpath = "//a[contains(text(),'Project')]//..//..//..//following-sibling::a") private Link lnkEmployeeSelector;
@FindBy(linkText = "Admin") private Link lnkAdmin;
@FindBy(linkText = "Timesheet Locks") private Link lnkTimesheetLocks;
+
/**Constructor**/
public Header(OrasiDriver driver){
@@ -29,6 +27,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/LoginPage.java b/src/main/java/com/orasi/bluesource/LoginPage.java
index 3d71ad5..5ad057b 100644
--- a/src/main/java/com/orasi/bluesource/LoginPage.java
+++ b/src/main/java/com/orasi/bluesource/LoginPage.java
@@ -1,19 +1,14 @@
package com.orasi.bluesource;
-import java.util.ResourceBundle;
-
-import org.openqa.selenium.support.FindBy;
-
import com.orasi.utils.Constants;
import com.orasi.utils.TestReporter;
import com.orasi.web.OrasiDriver;
import com.orasi.web.PageLoaded;
-import com.orasi.web.webelements.Button;
-import com.orasi.web.webelements.Element;
-import com.orasi.web.webelements.Label;
-import com.orasi.web.webelements.Textbox;
-import com.orasi.web.webelements.Webtable;
+import com.orasi.web.webelements.*;
import com.orasi.web.webelements.impl.internal.ElementFactory;
+import org.openqa.selenium.support.FindBy;
+
+import java.util.ResourceBundle;
public class LoginPage {
@@ -46,8 +41,7 @@ public boolean verifyPageIsLoaded(){
/**
* This method logins to the application with provided credentials
* @author
- * @param username
- * @param password
+ * @param role {@link String}
*/
public boolean Login(String role){
txtUsername.set(userCredentialRepo.getString(role));
@@ -75,7 +69,7 @@ public void LoginWithCredentials(String username, String password) {
btnLogin.jsClick();
}
- /*
+ /**
* Method checks that the label welcome is present on the screen
* @author: Daniel Smith
*/
@@ -92,7 +86,7 @@ public void check_login(String username)
}
}
- /*
+ /**
* Method checks that invalid login name and password is handled
* @author: Daniel Smith
*/
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..207ab70
--- /dev/null
+++ b/src/main/java/com/orasi/bluesource/Report.java
@@ -0,0 +1,69 @@
+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**/
+
+ public boolean verifyReportIsLoaded(){
+ return PageLoaded.isElementLoaded(this.getClass(),driver,elmReportTitle,5) &&
+ PageLoaded.isElementLoaded(this.getClass(),driver,tblReport,5);
+ }
+
+ public String getTitle(){
+ return elmReportTitle.getText();
+ }
+
+ public boolean checkTotals(){
+ int runningTotal = 0;
+ int sectionTotal = 0;
+ int rowBeginSection = 1;
+ int rowOfSectionTotal = 1;
+
+ do {
+ for (int i=rowBeginSection; itrue if on the Reporting Home page.
+ */
+ public boolean verifyHomePageIsDisplayed(){
+ return elmWelcome.syncVisible(5,false);
+ }
+}
diff --git a/src/test/java/com/bluesource/reports/AccountReportsTimeByTimeSheet.java b/src/test/java/com/bluesource/reports/AccountReportsTimeByTimeSheet.java
new file mode 100644
index 0000000..cf374b9
--- /dev/null
+++ b/src/test/java/com/bluesource/reports/AccountReportsTimeByTimeSheet.java
@@ -0,0 +1,80 @@
+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 AccountReportsTimeByTimeSheet 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 accountReportsTimeByTimeSheet() {
+ //Test Variables
+ String strAccount = "Account1";
+ String strStartDate = "12/01/2017";
+ String strEndDate = "03/07/2018";
+
+ //Page Models
+ LoginPage loginPage = new LoginPage(getDriver());
+ Header header = new Header(getDriver());
+ ReportingNavBar reportingNavBar = new ReportingNavBar(getDriver());
+ AccountTimeByTimeSheetForm accountTimeByTimeSheetForm = new AccountTimeByTimeSheetForm(getDriver());
+ Report report = new Report(getDriver());
+
+ TestReporter.logStep("Navigating to reports login page");
+ header.navigateReporting();
+
+ TestReporter.assertTrue(loginPage.verifyPageIsLoaded(),"Verifying reporting login page is displayed");
+
+ TestReporter.logStep("Logging in as Admin");
+ loginPage.AdminLogin();
+
+ TestReporter.assertTrue(reportingNavBar.verifyHomePageIsDisplayed(),"Verifying Reporting Home page is Displayed");
+
+ TestReporter.logStep("Expanding Account Reports");
+ reportingNavBar.clickAccountReportsDropdown();
+
+ TestReporter.logStep("Clicking Time by Time Sheet");
+ reportingNavBar.clickAccountTimeByTimeSheet();
+
+ TestReporter.assertTrue(accountTimeByTimeSheetForm.verifyAccountTimeByTimeSheetFormLoaded(),"Verifying Time by Time Sheet form loaded");
+
+ TestReporter.logStep("Selecting Account [" + strAccount + "]");
+ accountTimeByTimeSheetForm.selectAccount(strAccount);
+
+ TestReporter.logStep("Setting Start Date");
+ accountTimeByTimeSheetForm.setStartDate(strStartDate);
+
+ TestReporter.logStep("Setting End Date");
+ accountTimeByTimeSheetForm.setEndDate(strEndDate);
+
+ TestReporter.logStep("Clicking Generate Report");
+ accountTimeByTimeSheetForm.clickGenerateReport();
+
+ TestReporter.assertTrue(report.verifyReportIsLoaded(),"Verifying Report page is loaded");
+
+ TestReporter.assertTrue(report.checkTotals(),"Verifying Report totals are correct");
+
+ TestReporter.assertEquals(report.getTitle(),"Time by Time Sheet: "+strStartDate+"-"+strEndDate,"Verifying Report Title");
+ }
+}
\ No newline at end of file