diff --git a/drivers/chromedriver.exe b/drivers/chromedriver.exe new file mode 100644 index 0000000..28a4067 Binary files /dev/null and b/drivers/chromedriver.exe differ diff --git a/src/main/java/com/orasi/bluesource/EmployeePage.java b/src/main/java/com/orasi/bluesource/EmployeePage.java index 2cf3f9b..3ac1f65 100644 --- a/src/main/java/com/orasi/bluesource/EmployeePage.java +++ b/src/main/java/com/orasi/bluesource/EmployeePage.java @@ -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; @@ -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){ @@ -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(); } diff --git a/src/main/java/com/orasi/bluesource/Employees.java b/src/main/java/com/orasi/bluesource/Employees.java index 4f7c74d..f53f210 100644 --- a/src/main/java/com/orasi/bluesource/Employees.java +++ b/src/main/java/com/orasi/bluesource/Employees.java @@ -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(); } /** @@ -309,7 +311,7 @@ public boolean checkAccountPermissionOption(String strOption) { catch (OptionNotInListboxException e){ return false; } - + } - + } \ No newline at end of file diff --git a/src/main/java/com/orasi/bluesource/Header.java b/src/main/java/com/orasi/bluesource/Header.java index 3522250..610db60 100644 --- a/src/main/java/com/orasi/bluesource/Header.java +++ b/src/main/java/com/orasi/bluesource/Header.java @@ -62,9 +62,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() { diff --git a/src/main/java/com/orasi/bluesource/LoginPage.java b/src/main/java/com/orasi/bluesource/LoginPage.java index 3d71ad5..52e8674 100644 --- a/src/main/java/com/orasi/bluesource/LoginPage.java +++ b/src/main/java/com/orasi/bluesource/LoginPage.java @@ -2,6 +2,8 @@ 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; @@ -30,6 +32,9 @@ public class LoginPage { @FindBy(xpath = "//img[@class = 'img-responsive brand']") private Element elmLogo; @FindBy(xpath ="(//table[@class='table'])[3]") private Webtable wtbDetails; @FindBy(xpath = "//*[@id='content']/div[2]/div/h3") private Label lblBadLogin; + @FindBy(xpath = "//*[@id='time-entry-table']/tbody/tr[2]/td[1]/span/span[1]/span/span[2]") private Button btnTimesheetDropdown; + @FindBy(xpath = "/html/body/span/span/span[1]/input") private Textbox txtTimesheetDropdown; + @FindBy(xpath = "//*[@id='employee_reported_times___date_hours_hours']") private Webtable wtHoursTable; /**Constructor**/ public LoginPage(OrasiDriver driver){ @@ -103,4 +108,46 @@ public void invalid_login() System.out.println("User not logged in or found.. \n" + "Output from the current page: " + innerText); } + /** + * This method determines if the hours entered into the timesheet are shown + * @return boolean - If the input hours and displayed hours match + * @author Andrew McGrail + */ + public boolean checkTimesheetHours() { + String whatWeSet=null; + String whatIsShown=null; + boolean answer=true; + + for(int i=1;i<7;i++) { + whatWeSet = driver.findTextbox(By.xpath("(//*[@id='employee_reported_times___date_hours_hours'])["+i+"]")).getText(); + whatIsShown=driver.findLabel(By.xpath("//tr[6]/td["+(i+1)+"]")).getText(); + if(!(whatWeSet.equals(whatIsShown))) + answer=false; + } + return answer; + } + + /** + * This method sets the "Non-billable type" for the Current Timesheet + * @param type - The non-billable type + * @author Andrew McGrail + */ + public void setTimesheetDropdown(String type) { + txtTimesheetDropdown.sendKeys(type+Keys.RETURN); + } + + /** + * This method sets the hours for the timesheet + * @author Andrew McGrail + */ + public void setTimesheetHours() { + for(int i=1;i<8;i++) { + driver.findTextbox(By.xpath("(//*[@id='employee_reported_times___date_hours_hours'])["+i+"]")).set(String.valueOf(i*2)); + } + } + + public void clickTimesheetDropdown() { + btnTimesheetDropdown.syncVisible(2,true); + btnTimesheetDropdown.click(); + } } \ No newline at end of file diff --git a/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java b/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java new file mode 100644 index 0000000..e940e8e --- /dev/null +++ b/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java @@ -0,0 +1,66 @@ +/** + * Test for Issue 859 - Add Daily Total Hours on Time Report Screen + * Fills in an employees timesheet and checks the page updates reflecting that + * @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.Header; +import com.orasi.bluesource.LoginPage; +import com.orasi.utils.TestReporter; +import com.orasi.web.WebBaseTest; + +public class AddDailyTotalHoursOnTimeReportScreen 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(""); + } + + @AfterMethod + public void close(ITestContext testResults){ + endTest("TestAlert", testResults); + } + + @Test + public void testAddDailyTotalHoursOnTimeReportScreen() { + Header header = new Header(getDriver()); + LoginPage loginPage = new LoginPage(getDriver()); + + // Step 1 Open browser. + // Step 2 Navigate to http://10.238.243.127 + // Step 3 Input valid username into the 'Username' textbox of employee that has an open timesheet (not submitted). + // Step 4 Input valid password into the 'Password' textbox. + // Step 5 Click the 'Login' button or press Enter. + loginPage.LoginWithCredentials("this test", "123"); + TestReporter.logStep("Successfully logged into BlueSource"); + // Step 6 Enter time for various days including other rows such as bench or training. + loginPage.clickTimesheetDropdown(); + loginPage.setTimesheetDropdown("Onboarding"); + loginPage.setTimesheetHours(); + TestReporter.logStep("Hours have been set in the timesheet"); + // Step 7 Verify the daily totals display on the timesheet at the bottom. + TestReporter.assertTrue(loginPage.checkTimesheetHours(), "Verifying the hours entered in the timesheet appear below it."); + // Step 8 Click 'Logout' button. + header.navigateLogout(); + TestReporter.logStep("Successfully logged out of BlueSource"); + } +} \ No newline at end of file diff --git a/src/test/resources/drivers/chromedriver.exe b/src/test/resources/drivers/chromedriver.exe new file mode 100644 index 0000000..28a4067 Binary files /dev/null and b/src/test/resources/drivers/chromedriver.exe differ diff --git a/src/test/resources/sandbox.xml b/src/test/resources/sandbox.xml index 37bb0d4..4248c72 100644 --- a/src/test/resources/sandbox.xml +++ b/src/test/resources/sandbox.xml @@ -13,7 +13,7 @@ - +