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,57 @@
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 = "//div[contains(text(),'Select All')]") private Element elmSelectAll;
@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**/

/**
* @author David Grayson
* @return {@link Boolean} Returns true if key elements of the form are loaded
*/
public boolean verifyFormLoaded(){
return PageLoaded.isElementLoaded(this.getClass(),driver,elmGenerateReport,5) &&
PageLoaded.isElementLoaded(this.getClass(),driver,lstAccountSelect,5) &&
PageLoaded.isElementLoaded(this.getClass(),driver,elmSelectAll,5);
}

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

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

/**
* @author David Grayson
* @param elm {@link Element} The element to check
* @return {@link Boolean} Returns true if it can be interacted with, throws an error otherwise
*/
private boolean canInteract(Element elm){
return elm.syncEnabled(5) && elm.syncVisible(5);
}
}
101 changes: 101 additions & 0 deletions src/main/java/com/orasi/bluesource/Accounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ 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 = "//span[@data-original-title='Edit Hours']/a") private Link lnkEditRoleHours;
@FindBy(xpath = "//h4[@class='panel-title' and contains(text(),'Project Info')]") private Element elmProjectInfoPanelHeader;
@FindBy(xpath = "//h4[@class='panel-title' and contains(text(),'Role Information')]") private Element elmRoleInfoPanelHeader;
@FindBy(xpath = "//th[contains(text(),'Document')]/../../..") private Webtable tblDocuments;
@FindBy(xpath = "//tr/th[contains(text(),'Rate')]/../../..") private Webtable tblRates;


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

/**Page Interactions**/

/**
* This method gets a Roles hours from the Roles page
* @author David Grayson
* @return {@link String} Returns the text of the most recent hours in the Rates panel
*/
public String getRoleHours(){
return tblRates.getCellData(1,4);
}

/**
* This method will throw an error if no SOW document exists on Project page
* @author David Grayson
* @return {@link String} Returns the SOW document name
*/
public String getSOWDocumentName(){
PageLoaded.isDomComplete(driver);
int row = tblDocuments.getRowWithCellText("SOW");
return tblDocuments.getCell(row,1).getText();
}

/**
* This method clicks the Edit Hours icon link (small clock) in the Rates panel on the Role page
* @author David Grayson
*/
public void clickEditRoleHours(){
lnkEditRoleHours.syncEnabled(5);
lnkEditRoleHours.click();
}

/**
* would use the {@link #verifyProjectLink(String)} but it doesn't do what it's name implies
* @author David Grayson
* @param project {@link String} name of Project
* @return {@link Boolean} Returns <code>true</code> if the link is clickable within 5 seconds, <code>false</code> otherwise.
*/
public boolean verifyProjectLinkValid(String project){
return driver.findLink(By.linkText(project)).syncEnabled(5,false) &&
driver.findLink(By.linkText(project)).syncVisible(5,false);
}

/**
* @author David Grayson
* @param strRole {@link String} The name of the Role
* @return {@link Boolean} Returns <code>true</code> if the link is enabled and visible, <code>false</code> otherwise.
*/
public boolean verifyRoleLink(String strRole) {
return driver.findLink(By.linkText(strRole)).syncEnabled(5,false) &&
driver.findLink(By.linkText(strRole)).syncVisible(5,false);
}

/**
* @author David Grayson
* @param strAccount {@link String} name of Roles parent account
* @param strProject {@link String} name of Roles parent project
* @param strRole {@link String} name of role
* @return {@link Boolean} Returns <code>true</code> if the provided Roles page is loaded, <code>false</code> otherwise.
*/
public boolean verifyRolePageIsLoaded(String strAccount, String strProject, String strRole){
return PageLoaded.isElementLoaded(this.getClass(),driver,elmRoleInfoPanelHeader,5)
&& driver.findElement(By.xpath("//div[@class='breadcrumbs']")).getText()
.equals("Accounts - " + strAccount + " - " + strProject + " - " + strRole);
}

/**
* @author David Grayson
* @param strAccount {@link String} name of Projects parent account
* @param strProject {@link String} name of project
* @return {@link Boolean} Returns <code>true</code> if the provided Projects page is loaded, <code>false</code> otherwise.
*/
public boolean verifyProjectPageIsLoaded(String strAccount, String strProject){
return PageLoaded.isElementLoaded(this.getClass(),driver, elmProjectInfoPanelHeader,5)
&& driver.findElement(By.xpath("//div[@class='breadcrumbs']")).getText()
.equals("Accounts - " + strAccount + " - " + strProject);
}

/**
* @author David Grayson
* @param strAccount {@link String} name of Account
* @return {@link Boolean} Returns <code>true</code> if the provided Accounts page is loaded, <code>false</code> otherwise.
*/
public boolean verifyAccountPageIsLoaded(String strAccount){
String xpath = "//div[@class='breadcrumbs']/a[contains(text(),'" + strAccount + "')]";
return PageLoaded.isElementLoaded(this.getClass(),driver,tblProjects,5)
&& driver.findLink(By.xpath(xpath)).syncVisible(5,false);
}

/**
* @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
79 changes: 79 additions & 0 deletions src/main/java/com/orasi/bluesource/EditRoleHoursForm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.orasi.bluesource;

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.Listbox;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.impl.internal.ElementFactory;
import org.openqa.selenium.support.FindBy;

public class EditRoleHoursForm {
private OrasiDriver driver = null;

/**Page Elements**/
@FindBy(xpath = "//input[@id='role_budget_hour_hours']") private Textbox txtHours;
@FindBy(xpath = "//select[@id='role_budget_hour_document_id']") private Listbox lstDocument;
@FindBy(xpath = "//textarea[@id='rate_comments']") private Textbox txtComments;
@FindBy(xpath = "//input[@value='Add Hours']") private Button btnAddHours;


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

/**Page Interactions**/

public void testSetHours(){
setHours(String.valueOf(Double.parseDouble(txtHours.getText().trim()) + 0.3513));
}

public void clickAddHours(){
if (canInteract(btnAddHours))
btnAddHours.click();
}

public void setComments(String comments){
if (canInteract(txtComments)){
txtComments.clear();
txtComments.sendKeys(comments);
}
}

public void setDocument(String documentName){
if (canInteract(lstDocument))
lstDocument.select(documentName);
}

public void setHours(String hours){
if (canInteract(txtHours)){
txtHours.clear();
txtHours.sendKeys(hours);
}
}

/**
* @author David Grayson
* @return {@link Boolean} Returns true if key elements of the form have loaded
*/
public boolean verifyFormLoaded(){
return PageLoaded.isElementLoaded(this.getClass(),driver,txtHours,5) &&
PageLoaded.isElementLoaded(this.getClass(),driver,lstDocument,5) &&
PageLoaded.isElementLoaded(this.getClass(),driver,txtComments,5);
}

/**
* 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);
}
}
10 changes: 10 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,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
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/com/orasi/bluesource/Report.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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 <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 Boolean} Returns true if a report has a field with more than 2 decimals
*/
public boolean doesReportHaveLongDecimals(){
for (int i = 1; i <= tblReport.getRowCount(); i++){
for (int x = 1; x <= 7; x++){
TestReporter.log("Checking cell "+i+","+x);
if (tblReport.getCellData(i,x).contains(".")){
String[] split = tblReport.getCellData(i,x).split("[.]");
if (split[1].length()>2)
return true;
}
}
}
return false;
}
}
63 changes: 63 additions & 0 deletions src/main/java/com/orasi/bluesource/ReportingNavBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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 = "//h1[text()='Welcome']") private Element elmWelcome;
@FindBy(xpath = "//span[contains(text(),'Account Reports')]/..") private Link lnkAccountReportsDropdown;
@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);
}

/**
* This method clicks Burn Down Data link under the Account Reports drop down menu
* @author David Grayson
*/
public void clickAccountBurnDownData(){
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