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
Binary file added drivers/chromedriver.exe
Binary file not shown.
84 changes: 84 additions & 0 deletions src/main/java/com/orasi/bluesource/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.orasi.bluesource;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.support.FindBy;

import com.orasi.web.OrasiDriver;
import com.orasi.web.webelements.Button;
import com.orasi.web.webelements.Label;
import com.orasi.web.webelements.Listbox;

import com.orasi.web.webelements.impl.internal.ElementFactory;

public class Admin {
private OrasiDriver driver = null;

/**Page Elements**/
@FindBy(id= "date_month") private Listbox lbMonth;
@FindBy(xpath = "//*[@value='Create Lock']") private Button btnCreateLock;
@FindBy(xpath = "//*[@id='notification-area']/div") private Label lblSuccessMessage;

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

/**Page Interactions**/

/**
* Selects the month of the year on the Timesheet Locks screen
* @param month - The month of the year to be selected
* @author Andrew McGrail
*/
public void selectMonth(String month) {
lbMonth.syncVisible(2,true);
lbMonth.select(month);
}

public void clickCreateLock() {
btnCreateLock.syncVisible(2,true);
btnCreateLock.click();
driver.switchTo().alert().accept();
}

/**
* Matchs the passed String with the success message at the top of the
* timelock screen.
* @param message - Message to be matched
* @return True the message matchs
* @author Andrew McGrail
*/
public boolean verifySuccessMessage(String message) {
return lblSuccessMessage.getText().substring(2, 2+message.length()).equalsIgnoreCase(message); // Stops before the # of timesheets altered
}

/**
* This method verifies the Create Lock button exists on the page
* @return - True if Create Lock exists
* @author Andrew McGrail
*/
public boolean verifyCreateLock() {
return btnCreateLock.syncVisible(1);
}

/**
* This method closes the timesheet lock for the month passed to it
* @param month - The month of the lock
* @author Andrew McGrail
*/
public void clickCloseTimesheet(String month) {
for(int i=1;i<5;i++) {
try {
if(driver.findLabel(By.xpath("//tr["+i+"]/td[1]")).getText().equalsIgnoreCase(month)) {
driver.findButton(By.xpath("//tr["+i+"]/td[3]/a/div")).click();
driver.switchTo().alert().accept();
}
}
catch(NoSuchElementException e) {
break;
}
}
}
}
99 changes: 93 additions & 6 deletions src/main/java/com/orasi/bluesource/EmployeePage.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.orasi.bluesource;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.support.FindBy;

import com.orasi.web.OrasiDriver;
import com.orasi.web.PageLoaded;
import com.orasi.web.webelements.Button;
import com.orasi.web.webelements.Checkbox;
import com.orasi.web.webelements.Element;
import com.orasi.web.webelements.Label;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.Listbox;
import com.orasi.web.webelements.Webtable;
import com.orasi.web.webelements.impl.internal.ElementFactory;

Expand All @@ -17,9 +19,14 @@ public class EmployeePage {
/**Page Elements**/
@FindBy(xpath = "//tr[1]//a[@class='glyphicon glyphicon-pencil']") Button btnEditFirstProject;
@FindBy(xpath = "//div[@id='panel_body_1']//table") Webtable tblProjectInfo;
@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(xpath = "//*[@id=\'accordion\']/div/div[7]/button") Button btnEditGeneral;
@FindBy(partialLinkText = "Deactivate Employee") Button btnDeactivateEmployee;
@FindBy(partialLinkText = "Deactivate") Button btnDeactivate;
@FindBy(xpath = "//*[@id='content']/h1") Label lblEmployeeName;
@FindBy(xpath = "//*[@id='accordion']/div/div[3]/h4/a") Button btnManageProjectInfo;
@FindBy(xpath = "//*[@id='date_month']") private Listbox lbTimesheetMonth;
@FindBy(id = "select_date_range") private Button btnTimesheetGo;
@FindBy(xpath = "//*[@id='content']/h3") private Label lblTimesheetTitle;

/**Constructor**/
public EmployeePage(OrasiDriver driver){
Expand All @@ -28,6 +35,7 @@ public EmployeePage(OrasiDriver driver){
}

/**Page Interactions**/

public void clickFirstEditProjectButton(){
btnEditFirstProject.click();
}
Expand Down Expand Up @@ -59,16 +67,95 @@ public boolean verifyStartDate(String strStartDate, String strProject) {
}

public void editGeneralInfo() {
btnEditGeneral.syncVisible(3, true);
btnEditGeneral.click();

}

public void clickDeactivateEmployee() {
btnDeactivateEmployee.syncVisible(2, true);
btnDeactivateEmployee.click();
}

public void clickDeactivate(){
btnDeactivateEmployee.syncVisible(2, true);
btnDeactivate.click();
}

public boolean verifyEmployeeName(String name) {
return lblEmployeeName.getText().equalsIgnoreCase(name);
}

public void clickManageProject() {
btnManageProjectInfo.syncVisible(2,true);
btnManageProjectInfo.click();
}

/**
* This method checks if the driver is on the Timesheet Lock page
* @return - True if Timesheet Page is loaded
* @author Andrew McGrail
*/
public boolean verifyTimesheetPage(){
return PageLoaded.isElementLoaded(this.getClass(), driver, lbTimesheetMonth);
}

/**
* This method selects the month passed into it for the employee time sheet display month
* @param month - String month to be set to
* @author Andrew McGrail
*/
public void setMonth(String month) {
lbTimesheetMonth.syncVisible(2,true);
lbTimesheetMonth.select(month);
}

public void clickTimesheetGo() {
btnTimesheetGo.syncVisible(2,true);
btnTimesheetGo.click();
}

/**
* This method verifies the employee's timesheet page report to be the same
* as the month passed in.
* @param month - String month to be checked
* @return - True if matchs
* @author Andrew McGrail
*/
public boolean verifyTimesheetTitle(String month) {
try {
lblTimesheetTitle.syncVisible(2,true);
int subStringPoint = lblTimesheetTitle.getText().indexOf('-');
return lblTimesheetTitle.getText().substring(subStringPoint+2, subStringPoint+2+month.length()).equalsIgnoreCase(month);
}
catch(StaleElementReferenceException e) {
lblTimesheetTitle.syncVisible(2,true);
int subStringPoint = lblTimesheetTitle.getText().indexOf('-');
return lblTimesheetTitle.getText().substring(subStringPoint+2, subStringPoint+2+month.length()).equalsIgnoreCase(month);
}
}

/**
* This method checks an employee's timesheet for the approval status passed in,
* returning true if ALL weeks match the passed String
* @param status - Status of the employee's timesheet weeks
* @return - True if all weeks match the passed string
* @author Andrew McGrail
*/
public boolean verifyTimesheetLocked(String status) {
boolean verify = false;
for(int i=1;i<5;i++) {
try{
String checkThis = driver.findLabel(By.xpath("(//div[@class='approval-status'])["+i+"]")).getText();
if(checkThis.equals(status))
verify=true;
else
verify=false;
}
catch(NoSuchElementException e) {
break;
}
}
return verify;
}
}
31 changes: 25 additions & 6 deletions src/main/java/com/orasi/bluesource/Employees.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ResourceBundle;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.support.FindBy;

import com.orasi.utils.Constants;
Expand All @@ -14,7 +13,6 @@
import com.orasi.web.PageLoaded;
import com.orasi.web.exceptions.OptionNotInListboxException;
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;
Expand All @@ -38,6 +36,7 @@ public class Employees {
@FindBy(xpath = "//*[@id='accordion']/div/div[3]/h4/a") private Button btnManage;
@FindBy(xpath = "//div//input[@id='search-bar']") private Textbox txtEmployeeSearch;
@FindBy(xpath = "//*[@id=\"employee_account_permission\"]") private Listbox lstAccountPermission;
@FindBy(xpath = "//tr[2]/td[1]/a") private Link lnkFirstEmployeeName;

/**Constructor**/
public Employees(OrasiDriver driver){
Expand All @@ -46,6 +45,11 @@ public Employees(OrasiDriver driver){
}

/**Page Interactions**/

public boolean verifyPageIsLoaded(){
return PageLoaded.isElementLoaded(this.getClass(), driver, txtEmployeeSearch);
}

public void employeeSearch(String strSearch){
txtEmployeeSearch.set(strSearch);
}
Expand All @@ -55,8 +59,10 @@ public void employeeSearch(String strSearch){
* @author Paul
*/
public void clickAddEmployee() {
btnAdd.syncEnabled(5,true);
btnAdd.click();
btnAdd.syncVisible(2,true);
btnAdd.syncEnabled(2,true);
btnAdd.syncInFrame(2,true);
btnAdd.click();
}

/**
Expand Down Expand Up @@ -309,7 +315,20 @@ public boolean checkAccountPermissionOption(String strOption) {
catch (OptionNotInListboxException e){
return false;
}

}


/**
* This method checks if the passed string is in the search bar
* @param name - Name to be verified in the search bar
* @return - True if the search bar matchs the passed name
* @author Andrew McGrail
*/
public boolean verifySearchBar(String name) {
return txtEmployeeSearch.getText().equalsIgnoreCase(name);
}

public void clickFirstEmployeeName() {
lnkFirstEmployeeName.syncVisible(2,true);
lnkFirstEmployeeName.click();
}
}
24 changes: 19 additions & 5 deletions src/main/java/com/orasi/bluesource/Header.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.orasi.bluesource;

import javax.wsdl.Message;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.support.FindBy;

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

Expand All @@ -18,6 +17,8 @@ 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(xpath = "/html/body/header/div/nav/ul/li[2]/a") private Button btnAdminMenu;
@FindBy(xpath = "//a[@href='/admin/lock-timesheets/2018']") private Link lnkTimesheetLocks;
@FindBy(linkText = "Admin") private Link lnkAdmin;
@FindBy(linkText = "Timesheet Locks") private Link lnkTimesheetLocks;

Expand Down Expand Up @@ -64,9 +65,12 @@ else if (accountBool == false)
* @author Paul
*/
public void navigateEmployees() {
MessageCenter messageCenter = new MessageCenter(driver);
messageCenter.closeMessageCenter();
lnkEmployees.click();
lnkEmployees.syncVisible(2,true);
// MessageCenter messageCenter = new MessageCenter(driver);
// messageCenter.closeMessageCenter();
lnkEmployees.syncVisible(2,true);
lnkEmployees.syncInFrame(2,true);
lnkEmployees.click();
}

public void navigateProjectEmployees() {
Expand All @@ -82,6 +86,16 @@ public void navigateLogout() {
messageCenter.closeMessageCenter();
lnkLogout.click();
}

/**
* This method navigates to Admin/Timesheet lock page
* @author Andrew McGrail
*/
public void navigateTimesheetLocks() {
btnAdminMenu.click();
lnkTimesheetLocks.syncVisible(2,true);
lnkTimesheetLocks.click();
}

public void navigateTimesheetLocks() {
MessageCenter messageCenter = new MessageCenter(driver);
Expand Down
Loading