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,74 @@
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.WebElement;
import org.openqa.selenium.support.FindBy;

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

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 clickGenerateReport(){
if (canInteract(elmGenerateReport))
elmGenerateReport.click();
}

/**
* @author David Grayson
* @return {@link List<String>} Returns a List of all the accounts that can be selected
*/
public List<String> getAllAccounts(){
ArrayList<String> allAccounts = new ArrayList<>();
if (canInteract(lstAccountSelect)){
for(WebElement elm:lstAccountSelect.getOptions()){
allAccounts.add(elm.getText());
}
}
return allAccounts;
}

public void clickSelectAll(){
if (canInteract(elmSelectAll))
elmSelectAll.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);
}
}
27 changes: 26 additions & 1 deletion src/main/java/com/orasi/bluesource/Accounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ public Accounts(OrasiDriver driver){

/**Page Interactions**/

/**
* @author David Grayson
* @param strAccount {@link String} The name of the account to check
* @return {@link Boolean} Returns <code>true</code> if the Account passed has active projects, <code>false</code> otherwise
*/
public boolean doesAccountHaveActiveProjects(String strAccount){
clickAccountLink(strAccount);

if (tblProjects.getRowCount() == 0 || tblProjects.findElements(By.xpath("//tr[@class='closed-project']")).size() == tblProjects.getRowCount()){
driver.navigate().back();
return false;
} else {
driver.navigate().back();
return true;
}
}

/**
* @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 Expand Up @@ -155,7 +180,7 @@ public void sort_by_industry()

public void clickAccountLink(String strAccount){
String xpathExpression;
xpathExpression = "//td//a[contains(text(),'" + strAccount + "')]";
xpathExpression = "//td//a[text()='" + strAccount + "']";
Link lnkAccount = driver.findLink(By.xpath(xpathExpression));
lnkAccount.click();
}
Expand Down
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 @@ -29,6 +29,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
74 changes: 74 additions & 0 deletions src/main/java/com/orasi/bluesource/Report.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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;

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 column {@link Integer} the column to check
* @return {@link Boolean} Returns true if the specified column has empty values, false otherwise
*/
public boolean doesColumnHaveEmptyValues(int column){
for (int i = 1; i <= tblReport.getRowCount(); i++){
if (tblReport.getCell(i,column).getText().isEmpty())
return true;
}
return false;
}

/**
* @author David Grayson
* @return {@link List<String>} Returns a List of all Accounts in the report
*/
public List<String> getAllAccounts(){
ArrayList<String> accounts = new ArrayList<>();
for (int i = 1; i <= tblReport.getRowCount(); i++){
if (!accounts.contains(tblReport.getCell(i,1).getText()))
accounts.add(tblReport.getCell(i,1).getText());
}
TestReporter.log(accounts.toString());
return accounts;
}
}
62 changes: 62 additions & 0 deletions src/main/java/com/orasi/bluesource/ReportingNavBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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