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.
100 changes: 100 additions & 0 deletions src/main/java/com/orasi/bluesource/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.orasi.bluesource;

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.Textbox;
import com.orasi.web.webelements.impl.internal.ElementFactory;

public class Admin {
private OrasiDriver driver = null;

/**Page Elements**/
@FindBy(xpath = "//a[contains(text(),'Add New Holiday')]") private Button btnAddNewHoliday;
@FindBy(xpath = "//*[@id='content']/table/tbody/tr/td[1]") private Label lblFirstHolidayName;
@FindBy(xpath = "//*[@id='content']/table/tbody/tr/td[2]") private Label lblFirstHolidayDate;
@FindBy(xpath = "//*[@id='holiday_name']") private Textbox txtHolidayName;
@FindBy(xpath = "//*[@id='holiday_date']") private Textbox txtHolidayDate;
@FindBy(xpath = "//input[@value='Create Holiday']") private Button btnCreateHoliday;
@FindBy(xpath = "//*[@id='notification-area']/div") private Label lblFailureMessage;

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

/**Page Interactions**/

public void clickAddNewHoliday() {
btnAddNewHoliday.syncVisible(2,true);
btnAddNewHoliday.click();
}

/**
* Verifies the Add New Holiday button is onscreen
* @return - True if button is onscreen
*/
public boolean verifyAddNewHoliday() {
return btnAddNewHoliday.syncVisible(2,true);
}

/**
* Retrives the first holiday name from the table
* @return - String with Holiday Name
*/
public String getFirstHolidayName() {
return lblFirstHolidayName.getText();
}

/**
* Gets the first holiday listed's end date in form "YYYY-MM-DD"
* @return - String of the date
*/
public String getFirstHolidayDate() {
return lblFirstHolidayDate.getText();
}

/**
* Verifies the Textbox for Holiday Name on the new Holiday screen appears
* @return - True if exists on screen
*/
public boolean verifyNewHolidayName() {
return txtHolidayName.syncVisible(2,true);
}

/**
* Populates the New Holiday Name field with whats passed
* @param holidayName - Name of the new holiday
*/
public void populateHolidayname(String holidayName) {
txtHolidayName.syncVisible(2,true);
txtHolidayName.set(holidayName);
}

/**
* Populates the New Holiday date field in form "MMDDYYYY"
* @param holidayDate
*/
public void populateHolidayDate(String holidayDate) {
String parsedDate = holidayDate.substring(5,7)+holidayDate.substring(8,10)+holidayDate.substring(0, 4);
txtHolidayDate.sendKeys(parsedDate);
}

public void clickCreateHoliday() {
btnCreateHoliday.syncVisible(2,true);
btnCreateHoliday.click();
}

/**
* Verifies the notification message onscreen matches what is passed
* @param failMessage - Full Error message
* @return - True if what is shown onscreen matches what's passed
*/
public boolean verifyFailureMessage(String failMessage) {
System.out.println(lblFailureMessage.getText().substring(2));
return lblFailureMessage.getText().substring(2).equalsIgnoreCase(failMessage);
}
}
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
10 changes: 6 additions & 4 deletions src/main/java/com/orasi/bluesource/Employees.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,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 +311,7 @@ public boolean checkAccountPermissionOption(String strOption) {
catch (OptionNotInListboxException e){
return false;
}

}

}
22 changes: 12 additions & 10 deletions src/main/java/com/orasi/bluesource/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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(linkText = "Admin") private Link lnkAdmin;
@FindBy(linkText = "Timesheet Locks") private Link lnkTimesheetLocks;
@FindBy(xpath = "/html/body/header/div/nav/ul/li[2]/a") private Link lnkAdminDropdown;
@FindBy(xpath = "//a[contains(text(),'Company Holidays')]") private Link lnkCompanyHolidays;

/**Constructor**/
public Header(OrasiDriver driver){
Expand Down 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 All @@ -83,10 +86,9 @@ public void navigateLogout() {
lnkLogout.click();
}

public void navigateTimesheetLocks() {
MessageCenter messageCenter = new MessageCenter(driver);
messageCenter.closeMessageCenter();
lnkAdmin.click();
lnkTimesheetLocks.click();
public void navigateCompanyHolidays() {
lnkAdminDropdown.click();
lnkCompanyHolidays.syncVisible(2,true);
lnkCompanyHolidays.click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Tests Company Admin_Admin_Company Holidays_Duplicate_Error - Issue #748
* Test attempts to create a Holiday with the same Name and Date as an
* already existing holiday, then verifies the duplicate holiday is
* not created and the proper error message is shown
* @author andrew.mcgrail
*/
package com.bluesource;

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

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

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

@Test
public void testCompanyAdminAdminCompanyHolidaysDuplicateError()
{
String holidayName, holidayDate = null;

LoginPage loginPage = new LoginPage(getDriver());
Header header = new Header(getDriver());
Admin adminPage = new Admin(getDriver());

// Step 1 Open the browser and navigate to "http://10.238.243.127".
// Step 2 Login as 'company.admin'.
loginPage.AdminLogin();
// Step 3 Click on 'Admin' -> 'Company Holidays'.
header.navigateCompanyHolidays();
TestReporter.assertTrue(adminPage.verifyAddNewHoliday(), "Successfully landed on Company Holidays page");
// Step 4 Notate the name and date of an existing Holiday.
holidayName = adminPage.getFirstHolidayName();
holidayDate = adminPage.getFirstHolidayDate();
String failMessage = "Holiday "+holidayName+" failed to be created. [[\"Date has already been taken\"]]";
// Step 5 Click the 'Add New Holiday' button.
adminPage.clickAddNewHoliday();
TestReporter.assertTrue(adminPage.verifyNewHolidayName(), "Successfully landed on New Holiday page");
// Step 6 Inside the 'Name' textbox, enter in the Name of an existing Holiday.
adminPage.populateHolidayname(holidayName);
// Step 7 Select the Date of the existing Holiday inside the 'Date' field.
adminPage.populateHolidayDate(holidayDate);
// Step 8 Click the 'Create Holiday' button.
adminPage.clickCreateHoliday();
// Step 9 Verify the Error Message displays on the page the user is currently displaying.
TestReporter.assertTrue(adminPage.verifyFailureMessage(failMessage), "Verified the Holiday couldn't be created and the error message is correct");
}
}
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.CompanyAdminAdminCompanyHolidaysDuplicateError" />
</classes>
</test>

Expand Down