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.
62 changes: 61 additions & 1 deletion src/main/java/com/orasi/bluesource/Accounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
Expand All @@ -20,6 +21,7 @@
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;
Expand All @@ -46,6 +48,16 @@ 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 = "//*[@id='accordion']/div/div[1]/div/a[2]") private Link lnkAccountName;
@FindBy(xpath = "//*[@id='panel_body_1']/div/table/tbody/tr/td[1]/a") private Link lnkFirstProjectListed;
@FindBy(xpath = "//*[@id='panel_body_3']/div/div/table/tbody/tr/td[1]/a") private Link lnkFirstRoleListed;
@FindBy(xpath = "//*[@id='modal_3']/div/div") private Label lblAssignEmployeeModal;
@FindBy(xpath = "//*[@id='search-bar']/input") private Textbox txtSearchAccounts;
@FindBy(xpath = "(//span[@class='select2-selection__arrow'])[2]") private Button btnAssignEmployeeArrow;
@FindBy(xpath = "//input[@class='select2-search__field']") private Textbox txtSelectEmployee;
@FindBy(xpath = "//input[@value='Create Filled role']") private Button btnCreateFilledRole;
@FindBy(xpath = "//*[@id='notification-area']/div") private Label lblSuccessMessage;
@FindBy(xpath = "//span[@class='actions actions-add-hours']/a") private Button btnAddHours;

/**Constructor**/
public Accounts(OrasiDriver driver){
Expand All @@ -54,6 +66,10 @@ public Accounts(OrasiDriver driver){
}

/**Page Interactions**/

public boolean verifyAccountsPage() {
return PageLoaded.isElementLoaded(this.getClass(), driver, tblAccounts);
}

/*
* Click on accounts tab
Expand Down Expand Up @@ -205,7 +221,7 @@ public void clickRoleLink(String strRole){
}

public void clickAssignEmployee(){
btnAssignEmployee.syncEnabled(5,true);
btnAddHours.syncVisible(1,true);
btnAssignEmployee.click();
}

Expand All @@ -229,6 +245,7 @@ public void clickAddAccount(){
}

public void setAccountNameTextbox(String strAccountName){
txtAccountName.syncVisible(2,true);
txtAccountName.set(strAccountName);
}

Expand Down Expand Up @@ -376,5 +393,48 @@ public void selectCell(int row, int column) {
PageLoaded.isDomComplete(driver, 1);
}

public void searchAccountName(String accountName) {
txtSearchAccounts.syncVisible(2,true);
txtSearchAccounts.set(accountName);
}

public boolean verifyAccountName(String accountName) {
return lnkAccountName.getText().equalsIgnoreCase(accountName);
}

public void clickFirstProject() {
lnkFirstProjectListed.click();
}

public boolean verifyProjectPage() {
return lnkFirstRoleListed.syncVisible(2,true);
}

public void clickFirstRole() {
lnkFirstRoleListed.syncEnabled(2,true);
lnkFirstRoleListed.click();
}

public boolean verifyRolePage() {
return btnAssignEmployee.syncVisible(2,true);
}

public boolean verifyAssignEmployee() {
return lblAssignEmployeeModal.syncVisible(2,true);
}

public void assignEmployee(String employeeName) {
btnAssignEmployeeArrow.click();
txtSelectEmployee.sendKeys(employeeName+Keys.RETURN);
btnCreateFilledRole.click();
}

public boolean verifySuccessMessage(String message) {
return lblSuccessMessage.getText().substring(2).equalsIgnoreCase(message);
}

public void navigateMailCatcher() {
driver.get("http://10.238.243.127:1080");
}
}

10 changes: 7 additions & 3 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.Listbox;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.Webtable;
import com.orasi.web.webelements.impl.internal.ElementFactory;
Expand All @@ -17,9 +18,9 @@ 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;

/**Constructor**/
public EmployeePage(OrasiDriver driver){
Expand Down Expand Up @@ -59,15 +60,18 @@ 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();
}

Expand Down
29 changes: 21 additions & 8 deletions src/main/java/com/orasi/bluesource/Employees.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public class Employees {
@FindBy(tagName = "p") private Label lblAmountInTable;
@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 = "//*[@id='employee_account_permission']") private Listbox lstAccountPermission;
@FindBy(xpath = "//*[@id='modal_1']/div/div") private Label lblAddEmployeeModal;
@FindBy(xpath = "//*[@id='notification-area']/div") private Label lblSuccessMessage;
@FindBy(xpath = "/html/body/div[1]") private Label lblLoadingOverlay;

/**Constructor**/
public Employees(OrasiDriver driver){
Expand All @@ -55,8 +58,11 @@ public void employeeSearch(String strSearch){
* @author Paul
*/
public void clickAddEmployee() {
btnAdd.syncEnabled(5,true);
btnAdd.click();
lblLoadingOverlay.syncHidden(2,true);
btnAdd.syncVisible(2,true);
btnAdd.syncEnabled(2,true);
btnAdd.syncInFrame(2,true);
btnAdd.click();
}

/**
Expand All @@ -70,6 +76,7 @@ public void addEmployeeModal(String username, String firstname, String lastname)

//complete text fields
completeRequiredFields(username,firstname,lastname);
txtEmployeeUsername.set(username);

//click Create Employee
clickCreateEmployee();
Expand Down Expand Up @@ -106,6 +113,7 @@ private void completeRequiredFields(String username,String firstname,String last
* @author Paul
*/
public void clickCreateEmployee() {
btnCreateEmployee.syncEnabled(2,true);
btnCreateEmployee.click();
}

Expand Down Expand Up @@ -266,9 +274,8 @@ else if (btnAdd.isDisplayed() == false)
System.out.println("Error finding the add button on the current page.");
}

public void VerifyProjectEmployeesPage() {
// TODO Auto-generated method stub

public boolean verifyProjectEmployeesPage() {
return PageLoaded.isElementLoaded(this.getClass(), driver, tblEmployees);
}

public void CreateBasicUser(String strUserName, String strFirstName, String strLastName) {
Expand Down Expand Up @@ -309,7 +316,13 @@ public boolean checkAccountPermissionOption(String strOption) {
catch (OptionNotInListboxException e){
return false;
}

}


public boolean verifyAddEmployeeModal() {
return lblAddEmployeeModal.syncVisible(2,true);
}

public boolean verifySuccessMessage(String message) {
return lblSuccessMessage.getText().substring(2).equalsIgnoreCase(message);
}
}
9 changes: 6 additions & 3 deletions src/main/java/com/orasi/bluesource/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,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 Down
89 changes: 89 additions & 0 deletions src/main/java/com/orasi/bluesource/MailCatcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.orasi.bluesource;

import java.util.ResourceBundle;

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

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


public class MailCatcher {
private OrasiDriver driver = null;
private ResourceBundle userCredentialRepo = ResourceBundle.getBundle(Constants.USER_CREDENTIALS_PATH);

public int loadTime;

/**Page Elements**/
@FindBy(xpath = "//*[@id='messages']/table/tbody/tr[1]/td[2]") private Link lnkFirstEmailRecipient;
@FindBy(xpath = "//html/body/div/div/p[1]") private Label lblFirstParagraph;
@FindBy(xpath = "//html/body/div/div/p[2]") private Label lblSecondParagraph;
@FindBy(xpath = "//*[@id='message']/header/nav/ul/li[3]/a") Link lnkSourceMessage;
@FindBy(xpath = "//*[@id='message']/header/nav/ul/li[1]/a") Link lnkHTMLMessage;
@FindBy(xpath = "//ul/li[1]/a[text()='BlueSource-User Guide-Timekeeping.pdf']") Link lnkEmailAttachment;

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

/**Page Interactions**/

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

/**
* This method checks through the first 30 emails for a given account name, then clicks it
* @param accountName - Employee's firstName.lastName
* @author Andrew McGrail
*/
public void findRecipient(String accountName) {
for(int i=1;i<30;i++) {
if(driver.findElement(By.xpath("//*[@id='messages']/table/tbody/tr["+i+"]/td[2]")).getText().equalsIgnoreCase("<"+accountName+"@orasi.com>")) {
driver.findElement(By.xpath("//*[@id='messages']/table/tbody/tr["+i+"]/td[2]")).click();
break;
}
}
}

/**
* This method goes into the email already selected by switching the driver to the
* iFrame the email is inside, causing a warning, then checks to ensure the email was to
* the correct Employee Name.
* @param employeeAccountName - Employee account name to be checked for
* @return - True if the email has the correct name
* @author Andrew McGrail
*/
public boolean verifyEmailRecipient(String employeeAccountName) {
try {
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@class='body']")));
return lblFirstParagraph.getText().substring(6,employeeAccountName.length()+6).equalsIgnoreCase(employeeAccountName);
}
catch(Exception e) {
return lblFirstParagraph.getText().substring(6,employeeAccountName.length()+6).equalsIgnoreCase(employeeAccountName);
}
}

/**
* This method checks the selected email to make sure it has the same Account
* listed as the one passed into this method.
* @param accountName - Account name to be checked against the email
* @return - True if the Account name in the email matchs the passed account name
* @author Andrew McGrail
*/
public boolean verifyEmailRole (String accountName) {
return lblSecondParagraph.getText().substring(37,accountName.length()+37).equalsIgnoreCase(accountName);
}

public void clickAttachment() {
driver.switchTo().defaultContent();
lnkEmailAttachment.click();
}
}
Loading