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.
139 changes: 134 additions & 5 deletions src/main/java/com/orasi/bluesource/EmployeePage.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.orasi.bluesource;

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

import com.orasi.web.OrasiDriver;
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.Webtable;
Expand All @@ -17,9 +18,22 @@ 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='accordion']/div/div[3]/h4/a") Button btnManageProjectInfo;
@FindBy(xpath = "//*[@id='content']/div[6]/table/tbody/tr[6]/td/a") Button btnAddTimesheetWeek3;
@FindBy(xpath = "//input[@value='Save']") Button btnSaveTimesheet;
@FindBy(xpath = "(//*[@id='employee_reported_times___date_hours_hours'])[1]") Textbox txtFirstDayOfTimesheet;
@FindBy(xpath = "//*[@id='comment']") Textbox txtCommentBox;
@FindBy(xpath = "//span[@class='select2-selection__arrow']") Button btnTimesheetTypeArrow;
@FindBy(xpath = "//input[@class='select2-search__field']") Textbox txtTimesheetType;
@FindBy(xpath = "//div[@class='btn btn-primary btn-xs submit-comment']") Button btnOkTimesheetComment;
@FindBy(xpath = "//*[@id='notification-area']/div") Label lblSaveCommentMessage;
@FindBy(xpath = "//span[@class='approval-section edit-icon glyphicon glyphicon-pencil']") Button btnEditTimesheetWeek;
@FindBy(xpath = "//a[@title='Delete']") Button btnDeleteTimesheetWeek;
@FindBy(xpath = "//*[@id='time_modal']/div/div") Label lblTimesheetModal;
@FindBy(xpath = "//span[@class='week_total_hours']") Label lblTimesheetTotalHours;

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

/**
* Verifies the Manage Project Info button is visible on the employee page
* @return - True if visible
*/
public boolean verifyManageProjectInfo() {
return btnManageProjectInfo.syncVisible(2,true);
}

public void clickAddTimesheet3() {
btnAddTimesheetWeek3.syncVisible(2,true);
btnAddTimesheetWeek3.click();
}

/**
* Verifies the third week's Add Timesheet button is visible
* @return - True if visible
*/
public boolean verifyAddTimesheet3() {
return btnAddTimesheetWeek3.syncVisible(2,true);
}

public void clickSaveTimesheet() {
btnSaveTimesheet.syncVisible(2,true);
btnSaveTimesheet.click();
}

/**
* Verifies the Save Timesheet button is onscreen
* @return - True if visible
*/
public boolean verifySaveTimesheet() {
return btnSaveTimesheet.syncVisible(2,true);
}

/**
* Right clicks the first day of a timesheet onscreen
* @author andrew.mcgrail
*/
public void rightClickFirstDayOfTimesheet() {
Actions action = driver.actions();
action.contextClick(driver.findElement(By.xpath("(//*[@id='employee_reported_times___date_hours_hours'])[1]"))).build().perform();
}

/**
* Chooses the "Bench" value for a non-billable timesheet onscreen
* @author andrew.mcgrail
*/
public void assignTimesheetType() {
lblTimesheetModal.syncVisible(2,true);
btnTimesheetTypeArrow.click();
txtTimesheetType.sendKeys("Bench"+Keys.RETURN);
}

public boolean verifyCommentBox() {
return txtCommentBox.syncVisible(2,true);
}

/**
* Populates the first comment box on an employees weekly timesheet
* @param comment - The comment to populate the box with
* @author andrew.mcgrail
*/
public void populateCommentBox(String comment) {
txtCommentBox.sendKeys(comment);
btnOkTimesheetComment.click();
}

/**
* Verifies the comment box shows the passed value
* @param comment - Comment to be checked for
* @return - True if comments match
* @author andrew.mcgrail
*/
public boolean verifyCommentBox(String comment) {
return txtCommentBox.getText().equalsIgnoreCase(comment);
}

/**
* Verifies the message for successfully saving a timesheet
* @return - True if the save timesheet message is displayed
* @author andrew.mcgrail
*/
public boolean verifySaveTimesheetMessage() {
return lblSaveCommentMessage.getText().substring(2,52).equalsIgnoreCase("Reported time for this week was saved successfully");
}

public void clickEditTimesheet() {
btnEditTimesheetWeek.syncVisible(2,true);
btnEditTimesheetWeek.click();
}

/**
* Checks that the passed value is equal to the total hours of the
* the timesheet currently onscreen
* @return - True if both times match
* @param hours - A String of the hours you want e.g. "0"
* @author andrew.mcgrail
*/
public boolean verifyTimesheetTotalHours(String hours) {
return lblTimesheetTotalHours.getText().equalsIgnoreCase(hours);
}

public void clickDeleteTimesheet() {
btnDeleteTimesheetWeek.syncEnabled(2,true);
lblTimesheetModal.syncHidden(2,true);
btnDeleteTimesheetWeek.click();
}
}
13 changes: 6 additions & 7 deletions src/main/java/com/orasi/bluesource/Employees.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
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;
import com.orasi.utils.Sleeper;
import com.orasi.utils.TestReporter;
import com.orasi.utils.dataHelpers.personFactory.Person;
import com.orasi.web.OrasiDriver;
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 Down Expand Up @@ -55,8 +52,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 +308,7 @@ public boolean checkAccountPermissionOption(String strOption) {
catch (OptionNotInListboxException e){
return false;
}

}

}
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,92 @@
/**
* Tests Employees_Timesheet_CommentsBlank_Issue #613
* Test checks that a department head can add comments to
* an employees timesheet without adding hours, and the
* comment will show up along with a 0 hour timesheet
* @author Andrew McGrail
*/

package com.bluesource.employees;

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.utils.TestReporter;
import com.orasi.web.WebBaseTest;

public class EmployeesTimesheetCommentsBlank 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("EmployeesTimesheetCommentsBlank");
}

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

@Test
public void testEmployeesTimesheetCommentsBlank()
{
String firstName = "Issue";
String lastName = "613";
String fullName = firstName+" "+lastName;
String comment = "This is a cool comment";

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

// Step 1 Open a browser
// Step 2 Navigate to http://10.238.242.236
// Step 3 Enter the username of a departmenthead in the username field and a password in the password field. Then click the login button.
loginPage.AdminLogin();
// Step 4 Click the first name of an Employee in the Employee table.
employees.employeeSearch(fullName);
employees.selectEmployeeByName(firstName);
TestReporter.assertTrue(employeePage.verifyManageProjectInfo(), "Successfully landed on "+fullName+"'s page");
// Step 5 Click the Manage button in the Project Info section
employeePage.clickManageProjectInfo();
TestReporter.assertTrue(employeePage.verifyAddTimesheet3(), "The Project info for "+fullName+" is displayed");
// Step 6 On one of the timesheets, click the Add button.
employeePage.clickAddTimesheet3();
TestReporter.assertTrue(employeePage.verifySaveTimesheet(), "Successfully opened the timesheet modal");
employeePage.assignTimesheetType();
// Step 7 Right-Click in one of the time fields.
employeePage.rightClickFirstDayOfTimesheet();
TestReporter.assertTrue(employeePage.verifyCommentBox(), "The comment box is being displayed");
// Step 8 Enter text into the comment box and click the OK button.
employeePage.populateCommentBox(comment);
// Step 9 Click the Save button
employeePage.clickSaveTimesheet();
// Step 10 If the message of a locked time sheet is displayed, Click the unlock button and then Click the pencil Icon
TestReporter.assertTrue(employeePage.verifySaveTimesheetMessage(), "Verified the Timesheet was saved successfully");
employeePage.clickEditTimesheet();
// Step 11 Repeat steps 7 - 9 and verify that the speech bubble is present and the field is populated with "0"
employeePage.rightClickFirstDayOfTimesheet();
TestReporter.assertTrue(employeePage.verifyCommentBox(), "The comment box is being displayed");
TestReporter.assertTrue(employeePage.verifyCommentBox(comment), "Verified the timesheet correctly retains the comment data");
TestReporter.assertTrue(employeePage.verifyTimesheetTotalHours("0"), "Verified the timesheet still correctly has 0 hours");

employeePage.clickSaveTimesheet(); // To reset the test
employeePage.clickDeleteTimesheet(); // To reset the test
}
}
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.EmployeesTimesheetCommentsBlank" />
</classes>
</test>

Expand Down