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.
42 changes: 39 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,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(xpath = "//*[@id='content']/h1") Label lblEmployeeName;
@FindBy(xpath = "//*[@id='modal_1']/div/div") Label lblEditGeneralModal;
@FindBy(xpath = "//a[contains(text(),'Deactivate Employee')]") Button btnDeactivateEmployee;
@FindBy(xpath = "//a[contains(text(),'Deactivate')]") Button btnDeactivate;
@FindBy(xpath = "//*[@id='panel_body_1']/div/ul/li") Label lblDeactivateMessage;
@FindBy(xpath = "//td[contains(text(),'Status')]/../td[2]") Label lblEmployeeStatus;
@FindBy(xpath = "//*[@id='panel_body_1']/div/table/tbody/tr/td[5]") Label lblRoleEndDate;

/**Constructor**/
public EmployeePage(OrasiDriver driver){
Expand Down Expand Up @@ -59,16 +65,46 @@ 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(){
btnDeactivate.syncVisible(2, true);
btnDeactivate.click();
}

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

public boolean verifyEditGeneralModal() {
return lblEditGeneralModal.syncVisible(2,true);
}

public boolean verifyDeactivateEmployee() {
return btnDeactivateEmployee.syncEnabled(2,true);
}

public boolean verifyDeactivate() {
return btnDeactivate.syncEnabled(2,true);
}

public boolean verifyDeactivateMessage(String accountName, String projectName, String roleName, String currentDate) {
return lblDeactivateMessage.getText().equalsIgnoreCase(accountName+" - "+projectName+" - "+roleName+" will be set to end "+currentDate+".");
}

public boolean verifyEmployeeStatus(String status) {
return lblEmployeeStatus.getText().equalsIgnoreCase(status);
}

public boolean verifyFirstRoleEndDate(String date) {
return lblRoleEndDate.getText().equalsIgnoreCase(date);
}
}
22 changes: 16 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 = "//*[@id='notification-area']/div") private Label lblSuccessMessage;

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

/**Page Interactions**/

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

public void employeeSearch(String strSearch){
txtEmployeeSearch.syncEnabled(2,true);
txtEmployeeSearch.set(strSearch);
}

Expand All @@ -55,8 +60,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 +316,10 @@ public boolean checkAccountPermissionOption(String strOption) {
catch (OptionNotInListboxException e){
return false;
}


}

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* This tests Issue 491 Deactivate Employee_Filled Role End Date
* The test chooses a preidentified employee on a project who is Active,
* verifies there is a warning message when deactivating the employee
* then verifies the end date for the project role is updated.
* @author Andrew McGrail
*/
package com.bluesource.employees;

import com.orasi.utils.TestReporter;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import org.testng.ITestContext;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import com.orasi.bluesource.EmployeePage;
import com.orasi.bluesource.Employees;
import com.orasi.bluesource.LoginPage;
import com.orasi.web.WebBaseTest;

public class DeactiveEmployeeFilledRoleEndDate extends WebBaseTest{

@BeforeMethod
@Parameters({ "runLocation", "browserUnderTest", "browserVersion",
"operatingSystem", "environment" })
public void setup(@Optional String runLocation, String browserUnderTest,
String browserVersion, String operatingSystem, String environment) {
setApplicationUnderTest("BLUESOURCE");
setBrowserUnderTest(browserUnderTest);
setBrowserVersion(browserVersion);
setOperatingSystem(operatingSystem);
setRunLocation(runLocation);
setEnvironment(environment);
setThreadDriver(true);
testStart("DeactiveEmployeeFilledRoleEndDate");
}

@AfterMethod
public void close(ITestContext testResults){
endTest("TestAlert", testResults);
}

@Test
public void testDeactiveEmployeeFilledRoleEndDate()
{
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy");
LocalDate localDate = LocalDate.now();
String currentDate = dtf.format(localDate);

// Variables to be Set
String firstName = "Issue";
String lastName = "491";
String employeeName = firstName+" "+lastName;
String deactiveMessage = "Employee successfully deactivated";
String accountName = "Account for Testing";
String projectName = "Project1";
String roleName = "Project Manager Onsite";

LoginPage loginPage = new LoginPage(getDriver());
Employees employees = new Employees(getDriver());
EmployeePage employeePage = new EmployeePage(getDriver());

// Step 1 Preconditions: Identify or create a user that is assigned a role on a project.
// Employee: Issue 491
// Step 2 Open browser.
// Step 3 Navigate to http://10.238.242.236
// Step 4 Enter a valid username of a user with one of the following roles: Company Admin, Department Admin, Department Head, Upper management
// Step 5 Enter a valid password.
// Step 6 Click the Login button or press Enter.
loginPage.AdminLogin();
TestReporter.assertTrue(employees.verifyPageIsLoaded(), "Successfully landed on the employees page");
// Step 7 Click an employee name.
employees.employeeSearch(employeeName);
employees.selectEmployeeByName(lastName);
TestReporter.assertTrue(employeePage.verifyEmployeeName(employeeName), "Successfully landed on "+employeeName+"'s employee page");
// Step 8 Click the Edit button in the General Info section.
employeePage.editGeneralInfo();
TestReporter.assertTrue(employeePage.verifyEditGeneralModal(), "Verifying the Edit General Modal is present");
// Step 9 Verify the Deactivate Employee button is displayed at the bottom of the window.
TestReporter.assertTrue(employeePage.verifyDeactivateEmployee(), "The Deactivate Employee button is present");
// Step 10 Click the Deactivate Employee button.
employeePage.clickDeactivateEmployee();
// Step 11 Verify the Deactivate button is displayed at the top right of the page.
TestReporter.assertTrue(employeePage.verifyDeactivate(), "The Deactivate Employee button was pushed");
// Step 12 Verify that project role end date is displayed with the text: "(Account) - (Project) - (Role) will be set to end XX/XX/XXXX."
TestReporter.assertTrue(employeePage.verifyDeactivateMessage(accountName, projectName, roleName, currentDate),
"Verified the page warns the end date of the project role will be changed to today's date");
// Step 13 Click the Deactivate button.
employeePage.clickDeactivate();
TestReporter.assertTrue(employees.verifySuccessMessage(deactiveMessage), "Verified "+employeeName+" was deactivated");
// Step 14 Click on the deactivated employee's name and verify that their status has changed to "Inactive"
employees.employeeSearch(employeeName);
employees.selectEmployeeByName(lastName);
TestReporter.assertTrue(employeePage.verifyEmployeeStatus("Inactive"), "Verified that "+employeeName+" has been set to Inactive");
// Step 15 Verify that the project end date is displayed as the current date.
TestReporter.assertTrue(employeePage.verifyFirstRoleEndDate(currentDate), "Verified the role end date has been updated");
}
}
Binary file added src/test/resources/drivers/chromedriver.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion src/test/resources/sandbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<test name="In Progress test" parallel="methods" thread-count="20">
<classes>
<class name="com.bluesource.admin.TimesheetLockDisplay" />
<class name="com.bluesource.employees.DeactiveEmployeeFilledRoleEndDate" />
</classes>
</test>

Expand Down