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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<version>1.1.2</version>
<packaging>jar</packaging>
<properties>
<aspectj.version>1.8.5</aspectj.version>
<aspectj.version>1.8.13</aspectj.version>
<jenkinsBuildId>${env.BUILD_ID}</jenkinsBuildId>
<jenkinsBuildNumber>${env.BUILD_NUMBER}</jenkinsBuildNumber>
<jenkinsBuildTag>${env.BUILD_TAG}</jenkinsBuildTag>
Expand Down
110 changes: 109 additions & 1 deletion src/main/java/com/orasi/bluesource/Accounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ 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 = "//button[contains(text(),'New Role')]") private Button btnNewRole;
@FindBy(xpath = "//div[@data-toggle='toggle']") private Element elmBillToggle;
@FindBy(id = "role_role_type_id") private Listbox lstRoleType;
@FindBy(id = "role_max_resources") private Textbox txtMaxResources;
@FindBy(xpath = "//input[@value='Create Role']") private Button btnCreateRole;
@FindBy(xpath = "//*[@id=\"role_budget_rate\"]") private Textbox txtRate;
@FindBy(xpath = "//div[@class='rate-warning']") private Element elmLowRateAlert;
@FindBy(xpath = "//h4[contains(text(),'Basic Account - Test Project - Add Project Role')]/../button") private Button btnCloseAddRolePopup;

/**Constructor**/
public Accounts(OrasiDriver driver){
this.driver = driver;
Expand Down Expand Up @@ -375,6 +383,106 @@ public void selectCell(int row, int column) {
tblAccounts.clickCell(row, column);
PageLoaded.isDomComplete(driver, 1);
}

/**
* Clicks the New Role button under a project
*
* @author Christopher Batts
*/
public void clickNewRole() {
btnNewRole.syncVisible(5,true);
btnNewRole.click();
}

/**
* Clicks the Billable/Non-Billable toggle
*
* @author Christopher Batts
*/
public void toggleBill() {
elmBillToggle.syncVisible(5);
elmBillToggle.click();
}

/**
* Checks state of Billable/Non-Billable toggle. Returns true if Billable is displayed, otherwise returns false.
*
* @return Boolean
* @author Christopher Batts
*/
public boolean isBillOn() {
return elmBillToggle.getAttribute("class").contains("primary");
}


/**
* Clicks the +New Role button, fills out required fields, and submits the form.
*
* @param roleType String, name of role to select from list
* @param maxResources Integer, less than of equal to 30
*
* @author Christopher Batts
*/
public void createNonBillableRole(String roleType, int maxResources) {
clickNewRole();
if(isBillOn() == true) {
toggleBill();
}
lstRoleType.syncVisible(5);
lstRoleType.select(roleType);
txtMaxResources.sendKeys(Integer.toString(maxResources));
btnCreateRole.click();
}


/**
* Clicks the +New Role button, fills out required fields, and submits the form.
*
* @param roleType String, name of role to select from list
* @param maxResources Integer, less than of equal to 30
*
* @author Christopher Batts
*/
public void createBillableRole(String roleType, int maxResources) {
clickNewRole();
if(isBillOn() == false) {
toggleBill();
}
lstRoleType.syncVisible(5);
lstRoleType.select(roleType);
txtMaxResources.sendKeys(Integer.toString(maxResources));
btnCreateRole.click();
}


/**
* Verifies an alert is present when entered rate is lower than base rate for a role type
*
* @param roleType String, name of role to select from list
* @param maxResources Integer less than or equal to 30
* @return boolean, returns true if alert is present, returns false otherwise.
*/
public boolean verifyLowRateAlert(String roleType, int maxResources) {
clickNewRole();
Element role = driver.findElement(By.xpath("//option[contains(text(),'"+roleType+"')]"));
if(isBillOn() == false) {
toggleBill();
}
lstRoleType.syncVisible(5);
lstRoleType.select(roleType);
String r = role.getAttribute("data-baserate");
int rate = Integer.parseInt(r);

int lowRate = (int) ((Math.random() * (rate-2))+ 1);
txtRate.clear();
txtRate.sendKeys(Integer.toString(lowRate));
txtMaxResources.sendKeys(Integer.toString(maxResources));

return elmLowRateAlert.syncVisible(5,false);
}

public void closeAddRolePopup() {
btnCloseAddRolePopup.click();
}
}

6 changes: 6 additions & 0 deletions src/main/java/com/orasi/bluesource/EmployeePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.orasi.web.webelements.Checkbox;
import com.orasi.web.webelements.Element;
import com.orasi.web.webelements.Label;
import com.orasi.web.webelements.Link;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.Webtable;
import com.orasi.web.webelements.impl.internal.ElementFactory;
Expand All @@ -20,6 +21,7 @@ public class EmployeePage {
@FindBy(xpath = "//button[@data-target='#modal_1']") Button btnEditGeneral;
@FindBy(xpath = "//div//a[contains(text(),'Deactivate Employee')]") Button btnDeactivateEmployee;
@FindBy(xpath = "//div[@class='panel-heading']//a[contains(text(),'Deactivate')]") Button btnDeactivate;
@FindBy(linkText = "Manage") private Link lnkManage;

/**Constructor**/
public EmployeePage(OrasiDriver driver){
Expand Down Expand Up @@ -71,4 +73,8 @@ public void clickDeactivate(){
btnDeactivate.click();
}

public void clickManage() {
lnkManage.click();
}

}
4 changes: 4 additions & 0 deletions src/main/java/com/orasi/bluesource/Employees.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,9 @@ public boolean checkAccountPermissionOption(String strOption) {
}

}

public void clickManage() {
btnManage.click();
}

}
21 changes: 21 additions & 0 deletions src/main/java/com/orasi/bluesource/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.openqa.selenium.support.FindBy;

import com.orasi.web.OrasiDriver;
import com.orasi.web.PageLoaded;
import com.orasi.web.webelements.Link;
import com.orasi.web.webelements.impl.internal.ElementFactory;

Expand All @@ -18,8 +19,10 @@ public class Header {
@FindBy(xpath = "//li[contains(.,'Employees')]/a") private Link lnkEmployees;
@FindBy(xpath = "//a[contains(text(),'Project')]") private Link lnkProjemployees;
@FindBy(xpath = "//a[contains(text(),'Project')]//..//..//..//following-sibling::a") private Link lnkEmployeeSelector;
@FindBy(partialLinkText = "Message Center") private Link lnkMessageCenter;
@FindBy(linkText = "Admin") private Link lnkAdmin;
@FindBy(linkText = "Timesheet Locks") private Link lnkTimesheetLocks;


/**Constructor**/
public Header(OrasiDriver driver){
Expand Down Expand Up @@ -80,8 +83,26 @@ public void navigateProjectEmployees() {
public void navigateLogout() {
MessageCenter messageCenter = new MessageCenter(driver);
messageCenter.closeMessageCenter();
PageLoaded.isDomComplete(driver,5);
lnkLogout.syncVisible(5);
lnkLogout.click();
}

public void clickLogout() {
PageLoaded.isDomComplete(driver, 5);
lnkLogout.syncVisible(5);
lnkLogout.click();
}

public void clickMessageCenter() {
lnkMessageCenter.syncVisible(5);
lnkMessageCenter.jsClick();
}

public void clickEmployees() {
lnkEmployees.syncVisible(5);
lnkEmployees.jsClick();
}

public void navigateTimesheetLocks() {
MessageCenter messageCenter = new MessageCenter(driver);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/orasi/bluesource/MessageCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class MessageCenter {
@FindBy(xpath = "//*[@id='content']/div[2]/div[3]") private Label lblMessageTableHead;
@FindBy(xpath = "//*[@id='panel_body_2']/div/div/table") private Webtable tabMessageCenter;
@FindBy(tagName = "table") private Webtable tabByXpath;
@FindBy(xpath = "//*[@id=\"message_center\"]/div/div/div/div/div/div[3]/a[1]") private Link lnkApprove;

/**Constructor**/
public MessageCenter(OrasiDriver driver){
Expand Down Expand Up @@ -166,4 +167,8 @@ else if (tabByXpath.isDisplayed() == true)
return count;
}

public void clickApprove() {
lnkApprove.jsClick();
}

}
15 changes: 14 additions & 1 deletion src/main/java/com/orasi/bluesource/ProjectEmployees.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ProjectEmployees {
private ResourceBundle userCredentialRepo = ResourceBundle.getBundle(Constants.USER_CREDENTIALS_PATH);

/**Page Elements**/

@FindBy(xpath = "//*[@id=\"content\"]/table") private Webtable tblProjectEmployees;

/**Constructor**/
public ProjectEmployees(OrasiDriver driver){
Expand All @@ -43,4 +43,17 @@ public boolean VerifyProjectEmployeesPage() {

}

/**
* Selects an employee from the ProjectEmployees table by the employee's name.
*
* @param String employeeName
* @author Christopher Batts
*/
public void selectEmployee(String employeeName) {
int row = tblProjectEmployees.getRowWithCellText(employeeName);
int column = tblProjectEmployees.getColumnWithCellText(employeeName, row);

tblProjectEmployees.getCell(row, column).findElement(By.linkText(employeeName)).click();
}

}
63 changes: 62 additions & 1 deletion src/main/java/com/orasi/bluesource/ReportedTimesSummary.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
package com.orasi.bluesource;

import java.util.List;
import java.util.ResourceBundle;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;

import com.orasi.utils.Constants;
import com.orasi.utils.Sleeper;
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.Link;
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;
Expand All @@ -21,7 +27,12 @@ public class ReportedTimesSummary {

/**Page Elements**/
@FindBy(xpath = "//div[contains(@class,'time-back')]") private Button btnBack;

@FindBy(xpath = "//*[@id=\"content\"]/div[6]/table") private Webtable tblTimeSheets;
@FindBy(xpath = "//*[@id=\"time-entry-table\"]") private Webtable tblTimeEntry;
@FindBy(xpath = "//select[@id = 'flavor']") private Listbox lstNonBillType;
@FindBy(xpath = "//*[@id=\"edit_employee_252\"]/div[4]/input[2]") private Button btnSubmitTimeSheet;
@FindBy(xpath = "//*[@id=\"content\"]/div[6]/table/tbody/tr[3]/td/table") private Webtable tblTimeSheetSubTable;

/**Constructor**/
public ReportedTimesSummary(OrasiDriver driver){
this.driver = driver;
Expand All @@ -36,4 +47,54 @@ public void clickBackbutton() {
btnBack.click();
}

public void addTimeSheetToCurrentPeriod() {
tblTimeSheets.syncVisible(5);
PageLoaded.isDomComplete(driver, 5);
tblTimeSheets.findElement(By.xpath("//a[@class='add-resource-btn btn btn-default btn-xs pull-right']")).click();
}

public void submitTimeSheet() {
// PageLoaded.isDomComplete(driver, 5);
btnSubmitTimeSheet.syncVisible(5,true);
btnSubmitTimeSheet.jsClick();
}

public void fillTimeSheet() {
try {
PageLoaded.isDomComplete(driver, 5);
lstNonBillType.syncVisible(5);
}catch (Exception e) {
System.out.println("Element not found");
}
lstNonBillType.select("Bench");
List<Element> entryFields = tblTimeEntry.findElements(By.xpath("//input[contains(@class, 'time-entry-hour-fields')]"));
int count = 0;
for(WebElement x : entryFields) {
count ++;
if(count < 6 && x.isEnabled()) {
x.sendKeys("8");
}
}
}
/**
* Hovers over 'approved' message on the row with the given role name
*
* @param String name of the role the time was submitted for
* @param String name of approver
* @return boolean True if message appears, false otherwise.
*/
public boolean checkApprovedByMessage(String role, String approver) {
int row = tblTimeSheetSubTable.getRowWithCellText(role);
int column = tblTimeSheetSubTable.getColumnWithCellText("Approved");

Actions action = new Actions(driver);
WebElement x = tblTimeSheetSubTable.getCell(row, column);
WebElement y = x.findElement(By.xpath("//div[@class = 'approval-status underline']"));
WebElement z = tblTimeSheetSubTable.findElement(By.xpath("//div[@class = 'tooltip fade top in']"));
action.moveToElement(y).pause(5).moveToElement(z).pause(5).build().perform();


return tblTimeSheetSubTable.findElement(By.xpath("//div[@class = 'tooltip fade top in']")).isDisplayed();
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/orasi/web/WebBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public OrasiDriver testStart(String testName) {
setTestName(testName);
driverSetup();
// launch the application under test normally
if (pageUrl.isEmpty()) {
if (getPageURL() == null || getPageURL().isEmpty()) {
launchApplication();
// Otherwise if you have a specific page you want the test to start from
} else {
Expand Down
Loading