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
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();
}

}
20 changes: 20 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,6 +19,7 @@ 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;

/**Constructor**/
public Header(OrasiDriver driver){
Expand Down Expand Up @@ -78,7 +80,25 @@ 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();
}

}
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();
}

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

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Iterator;
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 +30,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 +50,206 @@ 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();
}

public boolean verifyTotalHours(String day) {
Webtable tblSubTimeSheets = driver.findWebtable(By.xpath("//div[contains(text(),'"+day+"')]/../../../../.."));

int col = tblSubTimeSheets.getColumnWithCellText(day, 2);
int totalRow = tblSubTimeSheets.getRowWithCellText("Total:");

List<Element> dateHours = tblSubTimeSheets.findElements(By.xpath("//div[contains(text(),'"+day+"')]/.."));
double total = 0;
double hour = 0;
for (Element element : dateHours) {
String text = element.getText();
if(text.contains("\n")) {
int b = text.indexOf("\n");
text = text.substring(0, b);
hour = Double.parseDouble(text);
total = total + hour;
} else {
hour = 0;
total = total + hour;
}
}

String tot = Double.toString(total);
int totalCol = tblSubTimeSheets.getColumnWithCellText(tot, totalRow);

if(tblSubTimeSheets.getCellData(totalRow, totalCol).equals(tot)) {
return true;
}
return false;
}



public boolean verifyAllTotalHours() {
LocalDate today = LocalDateTime.now().toLocalDate();
LocalDate Mon,Tues,Wed,Thurs,Fri,Sat,Sun;
String Monday = " ",Tuesday = " ",Wednesday = " ",Thursday = " ",Friday = " ",Saturday = " ",Sunday = " ";

switch (today.getDayOfWeek()) {
case MONDAY:
Tues = today.plusDays(1);
Wed = today.plusDays(2);
Thurs = today.plusDays(3);
Fri = today.plusDays(4);
Sat = today.plusDays(5);
Sun = today.plusDays(6);
Monday = today.getMonthValue()+"/"+today.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case TUESDAY:
Mon = today.minusDays(1);
Wed = today.plusDays(1);
Thurs = today.plusDays(2);
Fri = today.plusDays(3);
Sat = today.plusDays(4);
Sun = today.plusDays(5);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = today.getMonthValue()+"/"+today.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case WEDNESDAY:
Mon = today.minusDays(2);
Tues = today.minusDays(1);
Thurs = today.plusDays(1);
Fri = today.plusDays(2);
Sat = today.plusDays(3);
Sun = today.plusDays(4);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = today.getMonthValue()+"/"+today.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case THURSDAY:
Mon = today.minusDays(3);
Tues = today.minusDays(2);
Wed = today.minusDays(1);
Fri = today.plusDays(1);
Sat = today.plusDays(2);
Sun = today.plusDays(3);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = today.getMonthValue()+"/"+today.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case FRIDAY:
Mon = today.minusDays(4);
Tues = today.minusDays(3);
Wed = today.minusDays(2);
Thurs = today.minusDays(1);
Sat = today.plusDays(1);
Sun = today.plusDays(2);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = today.getMonthValue()+"/"+today.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case SATURDAY:
Mon = today.minusDays(5);
Tues = today.minusDays(4);
Wed = today.minusDays(3);
Thurs = today.minusDays(2);
Fri = today.minusDays(1);
Sun = today.plusDays(1);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = today.getMonthValue()+"/"+today.getDayOfMonth();
Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
break;
case SUNDAY:
Mon = today.minusDays(6);
Tues = today.minusDays(5);
Wed = today.minusDays(4);
Thurs = today.minusDays(3);
Fri = today.minusDays(2);
Sat = today.minusDays(1);
Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
Sunday = today.getMonthValue()+"/"+today.getDayOfMonth();
break;
default:
break;
}

return verifyTotalHours(Monday) && verifyTotalHours(Tuesday) &&
verifyTotalHours(Wednesday) && verifyTotalHours(Thursday) &&
verifyTotalHours(Friday);
}
}
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