Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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.impl.internal.ElementFactory;
import org.openqa.selenium.support.FindBy;

public class AccountBurnDownDataReportForm {
private OrasiDriver driver = null;

/**Page Elements**/
@FindBy(xpath = "//input[@name='commit']") private Element elmGenerateReport;
@FindBy(xpath = "//select[@id='account_select']") private Listbox lstAccountSelect;

/**
* Constructor
**/
public AccountBurnDownDataReportForm(OrasiDriver driver) {
this.driver = driver;
ElementFactory.initElements(driver, this);
}

/**Page Interactions**/

public boolean verifyFormLoaded(){
return PageLoaded.isElementLoaded(this.getClass(),driver,elmGenerateReport,5) &&
PageLoaded.isElementLoaded(this.getClass(),driver,lstAccountSelect,5);
}

public void clickGenerateReport(){
if (canInteract(elmGenerateReport))
elmGenerateReport.click();
}

public void selectAccount(String strAccount){
if (canInteract(lstAccountSelect)){
lstAccountSelect.select(strAccount);
}
}

private boolean canInteract(Element elm){
return elm.syncEnabled(5) && elm.syncVisible(5);
}
}
119 changes: 117 additions & 2 deletions src/main/java/com/orasi/bluesource/Accounts.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.orasi.bluesource;

import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
import java.util.List;

import javax.lang.model.util.Elements;

import org.bouncycastle.jce.provider.symmetric.TEA;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
Expand All @@ -28,8 +30,7 @@

public class Accounts {
private OrasiDriver driver = null;



/**Page Elements**/
@FindBy(xpath = "//*[@id='resource-content']/div[2]/p") private Element elmNumberPages;
@FindBy(xpath = "//*[@id=\"resource-content\"]/div[1]/table/tbody") private Webtable tblAccounts;
Expand All @@ -46,6 +47,10 @@ public class Accounts {
@FindBy(css = "div.btn.btn-secondary.btn-xs.quick-nav") private Button btnQuickNav;
@FindBy(xpath = "//a[contains(@ng-bind, 'n + 1')]") private List<Button> btnPages;
@FindBy(xpath = "//*[@id=\"project-list\"]/div/div[1]/div") private Button btnCloseQuickNav;
@FindBy(xpath = "//h3[contains(text(),'Hours')]/../table") private Webtable tblProjectHours;
@FindBy(xpath = "//h3[contains(text(),'Budget')]/../table") private Webtable tblProjectBudget;
@FindBy(xpath = "//th[contains(text(),'Project')]/../../..") private Webtable tblSubProjects;
@FindBy(xpath = "//span[@class='sow_info']") private Element elmSOW;

/**Constructor**/
public Accounts(OrasiDriver driver){
Expand All @@ -55,6 +60,116 @@ public Accounts(OrasiDriver driver){

/**Page Interactions**/

/**
* @author David Grayson
* @return {@link Boolean} Returns <code>true</code> if the page has a SOW, <code>false</code> otherwise
*/
public boolean hasSOW(){
return driver.findElements(By.xpath("//span[@class='sow_info']")).size() == 1;
}

/**
* @author David Grayson
* @return {@link List<String>} Returns a List of a Projects Sub Projects
*/
public List<String> getAllSubProjects(){
ArrayList<String> subProjects = new ArrayList<>(tblSubProjects.getRowCount());
for (int i=1;i<=tblSubProjects.getRowCount();i++){
subProjects.add(tblSubProjects.getCell(i,1).getText());
}
return subProjects;
}

/**
* This method should only be called when on a Project or Sub Project page
* @author David Grayson
* @return {@link String} Returns the Budget submitted by a Project or Sub Project
*/
public String getSubmittedBudget(){
int row = tblProjectBudget.getRowWithCellText("Submitted");

if(row > 0)
return driver.findElement(By.xpath("//h3[contains(text(),'Budget')]/../table/tbody/tr["+row+"]/td[1]")).getText();
else
return "$0.00";
}

/**
* This method should only be called when on a Project or Sub Project page
* @author David Grayson
* @return {@link String} Returns the Budget allocated to a project or sub project as a whole number string
*/
public String getAllocatedBudget(){
int row = tblProjectBudget.getRowWithCellText("Allocated");

if (row > 0)
return driver.findElement(By.xpath("//h3[contains(text(),'Budget')]/../table/tbody/tr["+row+"]/td[1]")).getText();
else
return "$0.00";
}

/**
* This method should only be called when on a Project or Sub Project page
* @author David Grayson
* @return {@link String} Returns the Hours submitted by a project or sub project as a whole number string
*/
public String getSubmittedHours(){
int row = tblProjectHours.getRowWithCellText("Submitted");

if (row > 0)
return driver.findElement(By.xpath("//h3[contains(text(),'Hours')]/../table/tbody/tr["+row+"]/td[1]")).getText().replace(".00","").trim();
else
return "";
}

/**
* This method should only be called when on a Project or Sub Project page
* @author David Grayson
* @return {@link String} Returns the Hours allocated to a project or sub project as a whole number string
*/
public String getAllocatedHours(){
int row = tblProjectHours.getRowWithCellText("Allocated");

if (row > 0)
return driver.findElement(By.xpath("//h3[contains(text(),'Hours')]/../table/tbody/tr["+row+"]/td[1]")).getText().replace(".00","").trim();
else
return "";
}

/**
* This method should be called when on the Project page, not the account page
* @author David Grayson
* @return {@link String} Returns the SOW if the project has one, an empty String if it doesn't
*/
public String getSOW(){
if (hasSOW())
return elmSOW.getText().replace(" - ","");
else
return "";
}

/**
* This method should only be called from an accounts page
* @author David Grayson
* @return {@link List<String>} Returns a List of all of an accounts projects
*/
public List<String> getAllProject(){
ArrayList<String> projects = new ArrayList<>(tblProjects.getRowCount());
for (int i = 1; i <= tblProjects.getRowCount(); i++) {
if (!tblProjects.getCell(i,1).getText().isEmpty())
projects.add(tblProjects.getCell(i,1).getText());
}
return projects;
}

/**
* @author David Grayson
* @return {@link Boolean} Returns <code>true</code> if the Accounts table is loaded, <code>false</code> otherwise.
*/
public boolean verifyAccountsPageIsLoaded(){
return PageLoaded.isElementLoaded(this.getClass(),driver,tblAccounts,5);
}

/*
* Click on accounts tab
* Make sure that the correct page loads
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/orasi/bluesource/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ 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
Expand Down
79 changes: 79 additions & 0 deletions src/main/java/com/orasi/bluesource/Report.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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.By;
import org.openqa.selenium.support.FindBy;

import java.util.ArrayList;
import java.util.List;

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 <code>true</code> if the report is loaded, <code>false</code> 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
* @param strAccount {@link String} The name of the Account to get the projects for
* @return {@link List<String>} Returns a String List of Projects and their Sub Projects associated with the Account passed
*/
public List<String> getAccountProjects(String strAccount){
ArrayList<String> projects = new ArrayList<>();
for (int i = 1; i <= tblReport.getRowCount(); i++) {
if (tblReport.getCell(i,1).getText().equals(strAccount) && !tblReport.getCell(i,2).getText().isEmpty())
projects.add(tblReport.getCell(i,2).getText());
}
return projects;
}

/**
* @author David Grayson
* @param strProject {@link String} The name of the project to get the data for
* @return {@link String[]} Returns a String array of the reports rows data
*/
public String[] getRowData(String strProject){
int row = tblReport.getRowWithCellText(strProject);
TestReporter.logStep("Getting row "+row+" data");
return new String[]{
tblReport.getCell(row,3).getText().trim(), //SOW ID
tblReport.getCell(row,4).getText().trim(), //Budget Hrs
tblReport.getCell(row,5).getText().trim(), //Reported Hrs
tblReport.getCell(row,6).getText().trim(), //Budget $
tblReport.getCell(row,7).getText().trim() //Reported $
};
}
}
57 changes: 57 additions & 0 deletions src/main/java/com/orasi/bluesource/ReportingNavBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.orasi.bluesource;

import com.orasi.web.OrasiDriver;
import com.orasi.web.webelements.Element;
import com.orasi.web.webelements.Link;
import com.orasi.web.webelements.impl.internal.ElementFactory;
import org.openqa.selenium.support.FindBy;

public class ReportingNavBar {
private OrasiDriver driver = null;

/**Page Elements**/
@FindBy(xpath = "//span[contains(text(),'Account Reports')]/..") private Link lnkAccountReportsDropdown;
@FindBy(xpath = "//h1[text()='Welcome']") private Element elmWelcome;
@FindBy(xpath = "//span[contains(text(),'Account Reports')]/../..//a[contains(text(),'Burn Down Data')]") private Link lnkAccountReportsBurnDownData;


/**Constructor**/
public ReportingNavBar(OrasiDriver driver) {
this.driver = driver;
ElementFactory.initElements(driver, this);
}

/**Page Interactions**/

/**
* @author David Grayson
* @return {@link Boolean} Returns <code>true</code> if on the Reporting Home page.
*/
public boolean verifyHomePageIsDisplayed(){
return elmWelcome.syncVisible(5,false);
}

public void clickBurnDownData(){
if (canInteract(lnkAccountReportsBurnDownData))
lnkAccountReportsBurnDownData.click();
}

/**
* This method expands the Projects Reports drop down
* @author David Grayson
*/
public void clickAccountReports(){
if (canInteract(lnkAccountReportsDropdown))
lnkAccountReportsDropdown.click();
}

/**
* 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 <code>true</code> if the element is enabled and visible, <code>false</code> otherwise
*/
private boolean canInteract(Element elm){
return elm.syncEnabled(5) && elm.syncVisible(5);
}
}
Loading