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/Reporting.java b/src/main/java/com/orasi/bluesource/Reporting.java new file mode 100644 index 0000000..7e4be9f --- /dev/null +++ b/src/main/java/com/orasi/bluesource/Reporting.java @@ -0,0 +1,81 @@ +package com.orasi.bluesource; + +import org.openqa.selenium.Keys; +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.Link; +import com.orasi.web.webelements.Textbox; +import com.orasi.web.webelements.impl.internal.ElementFactory; + + +public class Reporting { + private OrasiDriver driver = null; + + + /**Page Elements**/ + @FindBy(id = "employee_username") private Textbox txtUsername; + @FindBy(id = "employee_password") private Textbox txtPassword; + @FindBy(xpath = "//div[3]/input") private Button btnSubmitLogin; + @FindBy(xpath = "//*[@id='nav-side-menu']/ul/li[1]/a") private Button btnEmployeeReports; + @FindBy(xpath = "//li[1]/div/ul/li[1]/a") private Link lnkEmployeeTimeByProject; + @FindBy(xpath = "//span[1]/span/span[2]") private Button btnSearchEmployeeArrow; + @FindBy(xpath = "/html/body/span/span/span[1]/input") private Textbox txtEmployeeSearch; + @FindBy(xpath = "//*[@id='employee_report_list']/div") private Label lblReportEmployeeName; + @FindBy(xpath = "//*[@id='blank_modal']/div/div") private Label lblModal; + + + /**Constructor**/ + public Reporting(OrasiDriver driver){ + this.driver = driver; + ElementFactory.initElements(driver, this); + } + + /**Page Interactions**/ + + /** + * This method logs into Blue Source Reporting as Admin + * @author Andrew McGrail + */ + public void adminLogin() { + driver.get("http://10.238.243.127:8080/reporting/login"); + txtUsername.set("company.admin"); + txtPassword.set("123"); + btnSubmitLogin.click(); + } + + /** + * This method searchs the Employee Reports for Time by Project + * for the param name. + * @param name - The employee name to be searched + * @author Andrew McGrail + */ + public void searchEmployee(String name) { + lblModal.syncVisible(2,true); + btnSearchEmployeeArrow.syncVisible(2,true); + btnSearchEmployeeArrow.click(); + txtEmployeeSearch.syncEnabled(2,true); + txtEmployeeSearch.sendKeys(name+Keys.RETURN); + } + + /** + * This method checks the employee report by project time for the + * provided param name. + * @param expectedName - The employee name to be verified + * @return True if the name displayed matches the param, false if not + */ + public boolean verifyFullNameShowing(String expectedName) { + if(lblReportEmployeeName.getText().substring(0, (lblReportEmployeeName.getText().length())-2).equalsIgnoreCase(expectedName)) + return true; + return false; + } + + public void clickTimeByProject() { + btnEmployeeReports.syncVisible(2,true); + btnEmployeeReports.click(); + lnkEmployeeTimeByProject.syncVisible(2,true); + lnkEmployeeTimeByProject.click(); + } +} \ No newline at end of file diff --git a/src/test/java/com/bluesource/NameTooBigForBox.java b/src/test/java/com/bluesource/NameTooBigForBox.java new file mode 100644 index 0000000..9896b3a --- /dev/null +++ b/src/test/java/com/bluesource/NameTooBigForBox.java @@ -0,0 +1,60 @@ +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.Reporting; +import com.orasi.utils.TestReporter; +import com.orasi.web.WebBaseTest; + +public class NameTooBigForBox 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 testNameTooBigForBox() { + String employeeName = "Thisisforntesting thelongname1"; + + Reporting reporting = new Reporting(getDriver()); + + //Step 1 Open browser. + //Step 2 Navigate to http://10.238.242.236/reporting/login + //Step 3 Input a valid username into the 'Username' textbox. + //Step 4 Input a valid password into the 'Password' textbox. + //Step 5 Click the 'Login' button or press Enter. + reporting.adminLogin(); + TestReporter.logStep("Successfully logged in as Admin to BlueSource Reporting."); + //Step 6 Click 'Employee Reports' from the Navigation bar. + //Step 7 Select the 'Time by Projects' under Employee Reports. + reporting.clickTimeByProject(); + TestReporter.logStep("Navigated to the Employee Reports for Time by Project"); + //Step 8 Select employee Thisisforntesting thelongname1 + reporting.searchEmployee(employeeName); + TestReporter.logStep("Searched Employee Reports by Projects for the name "+employeeName); + //Step 9 Verify the employee name fits inside the box. + TestReporter.assertTrue(reporting.verifyFullNameShowing(employeeName), "Verifying the requested name is shown in full on the report."); + } + +} 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..9ef14e6 100644 --- a/src/test/resources/sandbox.xml +++ b/src/test/resources/sandbox.xml @@ -13,7 +13,7 @@ - +