diff --git a/pom.xml b/pom.xml
index 57f10b1..98d3b57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
1.1.2
jar
- 1.8.5
+ 1.8.13
${env.BUILD_ID}
${env.BUILD_NUMBER}
${env.BUILD_TAG}
diff --git a/src/main/java/com/orasi/bluesource/EmployeePage.java b/src/main/java/com/orasi/bluesource/EmployeePage.java
index 2cf3f9b..71a5e3b 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.Link;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.Webtable;
import com.orasi.web.webelements.impl.internal.ElementFactory;
@@ -20,6 +21,7 @@ public class EmployeePage {
@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(linkText = "Manage") private Link lnkManage;
/**Constructor**/
public EmployeePage(OrasiDriver driver){
@@ -71,4 +73,8 @@ public void clickDeactivate(){
btnDeactivate.click();
}
+ public void clickManage() {
+ lnkManage.click();
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/bluesource/Employees.java b/src/main/java/com/orasi/bluesource/Employees.java
index 4f7c74d..f404e87 100644
--- a/src/main/java/com/orasi/bluesource/Employees.java
+++ b/src/main/java/com/orasi/bluesource/Employees.java
@@ -311,5 +311,9 @@ public boolean checkAccountPermissionOption(String strOption) {
}
}
+
+ public void clickManage() {
+ btnManage.click();
+ }
}
\ 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..720ed36 100644
--- a/src/main/java/com/orasi/bluesource/Header.java
+++ b/src/main/java/com/orasi/bluesource/Header.java
@@ -6,6 +6,7 @@
import org.openqa.selenium.support.FindBy;
import com.orasi.web.OrasiDriver;
+import com.orasi.web.PageLoaded;
import com.orasi.web.webelements.Link;
import com.orasi.web.webelements.impl.internal.ElementFactory;
@@ -18,6 +19,7 @@ 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(partialLinkText = "Message Center") private Link lnkMessageCenter;
/**Constructor**/
public Header(OrasiDriver driver){
@@ -78,7 +80,25 @@ public void navigateProjectEmployees() {
public void navigateLogout() {
MessageCenter messageCenter = new MessageCenter(driver);
messageCenter.closeMessageCenter();
+ PageLoaded.isDomComplete(driver,5);
+ lnkLogout.syncVisible(5);
lnkLogout.click();
}
+
+ public void clickLogout() {
+ PageLoaded.isDomComplete(driver, 5);
+ lnkLogout.syncVisible(5);
+ lnkLogout.click();
+ }
+
+ public void clickMessageCenter() {
+ lnkMessageCenter.syncVisible(5);
+ lnkMessageCenter.jsClick();
+ }
+
+ public void clickEmployees() {
+ lnkEmployees.syncVisible(5);
+ lnkEmployees.jsClick();
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/bluesource/MessageCenter.java b/src/main/java/com/orasi/bluesource/MessageCenter.java
index e38e2c2..29944bc 100644
--- a/src/main/java/com/orasi/bluesource/MessageCenter.java
+++ b/src/main/java/com/orasi/bluesource/MessageCenter.java
@@ -28,6 +28,7 @@ public class MessageCenter {
@FindBy(xpath = "//*[@id='content']/div[2]/div[3]") private Label lblMessageTableHead;
@FindBy(xpath = "//*[@id='panel_body_2']/div/div/table") private Webtable tabMessageCenter;
@FindBy(tagName = "table") private Webtable tabByXpath;
+ @FindBy(xpath = "//*[@id=\"message_center\"]/div/div/div/div/div/div[3]/a[1]") private Link lnkApprove;
/**Constructor**/
public MessageCenter(OrasiDriver driver){
@@ -166,4 +167,8 @@ else if (tabByXpath.isDisplayed() == true)
return count;
}
+ public void clickApprove() {
+ lnkApprove.jsClick();
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/bluesource/ProjectEmployees.java b/src/main/java/com/orasi/bluesource/ProjectEmployees.java
index 40b1616..0f957e2 100644
--- a/src/main/java/com/orasi/bluesource/ProjectEmployees.java
+++ b/src/main/java/com/orasi/bluesource/ProjectEmployees.java
@@ -21,7 +21,7 @@ public class ProjectEmployees {
private ResourceBundle userCredentialRepo = ResourceBundle.getBundle(Constants.USER_CREDENTIALS_PATH);
/**Page Elements**/
-
+ @FindBy(xpath = "//*[@id=\"content\"]/table") private Webtable tblProjectEmployees;
/**Constructor**/
public ProjectEmployees(OrasiDriver driver){
@@ -43,4 +43,17 @@ public boolean VerifyProjectEmployeesPage() {
}
+ /**
+ * Selects an employee from the ProjectEmployees table by the employee's name.
+ *
+ * @param String employeeName
+ * @author Christopher Batts
+ */
+ public void selectEmployee(String employeeName) {
+ int row = tblProjectEmployees.getRowWithCellText(employeeName);
+ int column = tblProjectEmployees.getColumnWithCellText(employeeName, row);
+
+ tblProjectEmployees.getCell(row, column).findElement(By.linkText(employeeName)).click();
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/bluesource/ReportedTimesSummary.java b/src/main/java/com/orasi/bluesource/ReportedTimesSummary.java
index a648d5a..658ea74 100644
--- a/src/main/java/com/orasi/bluesource/ReportedTimesSummary.java
+++ b/src/main/java/com/orasi/bluesource/ReportedTimesSummary.java
@@ -1,17 +1,26 @@
package com.orasi.bluesource;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Iterator;
+import java.util.List;
import java.util.ResourceBundle;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import com.orasi.utils.Constants;
import com.orasi.utils.Sleeper;
import com.orasi.utils.TestReporter;
import com.orasi.web.OrasiDriver;
+import com.orasi.web.PageLoaded;
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;
import com.orasi.web.webelements.Textbox;
import com.orasi.web.webelements.Webtable;
import com.orasi.web.webelements.impl.internal.ElementFactory;
@@ -21,7 +30,12 @@ public class ReportedTimesSummary {
/**Page Elements**/
@FindBy(xpath = "//div[contains(@class,'time-back')]") private Button btnBack;
-
+ @FindBy(xpath = "//*[@id=\"content\"]/div[6]/table") private Webtable tblTimeSheets;
+ @FindBy(xpath = "//*[@id=\"time-entry-table\"]") private Webtable tblTimeEntry;
+ @FindBy(xpath = "//select[@id = 'flavor']") private Listbox lstNonBillType;
+ @FindBy(xpath = "//*[@id=\"edit_employee_252\"]/div[4]/input[2]") private Button btnSubmitTimeSheet;
+ @FindBy(xpath = "//*[@id=\"content\"]/div[6]/table/tbody/tr[3]/td/table") private Webtable tblTimeSheetSubTable;
+
/**Constructor**/
public ReportedTimesSummary(OrasiDriver driver){
this.driver = driver;
@@ -36,4 +50,206 @@ public void clickBackbutton() {
btnBack.click();
}
+ public void addTimeSheetToCurrentPeriod() {
+ tblTimeSheets.syncVisible(5);
+ PageLoaded.isDomComplete(driver, 5);
+ tblTimeSheets.findElement(By.xpath("//a[@class='add-resource-btn btn btn-default btn-xs pull-right']")).click();
+ }
+
+ public void submitTimeSheet() {
+// PageLoaded.isDomComplete(driver, 5);
+ btnSubmitTimeSheet.syncVisible(5,true);
+ btnSubmitTimeSheet.jsClick();
+ }
+
+ public void fillTimeSheet() {
+ try {
+ PageLoaded.isDomComplete(driver, 5);
+ lstNonBillType.syncVisible(5);
+ }catch (Exception e) {
+ System.out.println("Element not found");
+ }
+ lstNonBillType.select("Bench");
+ List entryFields = tblTimeEntry.findElements(By.xpath("//input[contains(@class, 'time-entry-hour-fields')]"));
+ int count = 0;
+ for(WebElement x : entryFields) {
+ count ++;
+ if(count < 6 && x.isEnabled()) {
+ x.sendKeys("8");
+ }
+ }
+ }
+ /**
+ * Hovers over 'approved' message on the row with the given role name
+ *
+ * @param String name of the role the time was submitted for
+ * @param String name of approver
+ * @return boolean True if message appears, false otherwise.
+ */
+ public boolean checkApprovedByMessage(String role, String approver) {
+ int row = tblTimeSheetSubTable.getRowWithCellText(role);
+ int column = tblTimeSheetSubTable.getColumnWithCellText("Approved");
+
+ Actions action = new Actions(driver);
+ WebElement x = tblTimeSheetSubTable.getCell(row, column);
+ WebElement y = x.findElement(By.xpath("//div[@class = 'approval-status underline']"));
+ WebElement z = tblTimeSheetSubTable.findElement(By.xpath("//div[@class = 'tooltip fade top in']"));
+ action.moveToElement(y).pause(5).moveToElement(z).pause(5).build().perform();
+
+
+ return tblTimeSheetSubTable.findElement(By.xpath("//div[@class = 'tooltip fade top in']")).isDisplayed();
+ }
+
+ public boolean verifyTotalHours(String day) {
+ Webtable tblSubTimeSheets = driver.findWebtable(By.xpath("//div[contains(text(),'"+day+"')]/../../../../.."));
+
+ int col = tblSubTimeSheets.getColumnWithCellText(day, 2);
+ int totalRow = tblSubTimeSheets.getRowWithCellText("Total:");
+
+ List dateHours = tblSubTimeSheets.findElements(By.xpath("//div[contains(text(),'"+day+"')]/.."));
+ double total = 0;
+ double hour = 0;
+ for (Element element : dateHours) {
+ String text = element.getText();
+ if(text.contains("\n")) {
+ int b = text.indexOf("\n");
+ text = text.substring(0, b);
+ hour = Double.parseDouble(text);
+ total = total + hour;
+ } else {
+ hour = 0;
+ total = total + hour;
+ }
+ }
+
+ String tot = Double.toString(total);
+ int totalCol = tblSubTimeSheets.getColumnWithCellText(tot, totalRow);
+
+ if(tblSubTimeSheets.getCellData(totalRow, totalCol).equals(tot)) {
+ return true;
+ }
+ return false;
+ }
+
+
+
+ public boolean verifyAllTotalHours() {
+ LocalDate today = LocalDateTime.now().toLocalDate();
+ LocalDate Mon,Tues,Wed,Thurs,Fri,Sat,Sun;
+ String Monday = " ",Tuesday = " ",Wednesday = " ",Thursday = " ",Friday = " ",Saturday = " ",Sunday = " ";
+
+ switch (today.getDayOfWeek()) {
+ case MONDAY:
+ Tues = today.plusDays(1);
+ Wed = today.plusDays(2);
+ Thurs = today.plusDays(3);
+ Fri = today.plusDays(4);
+ Sat = today.plusDays(5);
+ Sun = today.plusDays(6);
+ Monday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case TUESDAY:
+ Mon = today.minusDays(1);
+ Wed = today.plusDays(1);
+ Thurs = today.plusDays(2);
+ Fri = today.plusDays(3);
+ Sat = today.plusDays(4);
+ Sun = today.plusDays(5);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case WEDNESDAY:
+ Mon = today.minusDays(2);
+ Tues = today.minusDays(1);
+ Thurs = today.plusDays(1);
+ Fri = today.plusDays(2);
+ Sat = today.plusDays(3);
+ Sun = today.plusDays(4);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case THURSDAY:
+ Mon = today.minusDays(3);
+ Tues = today.minusDays(2);
+ Wed = today.minusDays(1);
+ Fri = today.plusDays(1);
+ Sat = today.plusDays(2);
+ Sun = today.plusDays(3);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case FRIDAY:
+ Mon = today.minusDays(4);
+ Tues = today.minusDays(3);
+ Wed = today.minusDays(2);
+ Thurs = today.minusDays(1);
+ Sat = today.plusDays(1);
+ Sun = today.plusDays(2);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case SATURDAY:
+ Mon = today.minusDays(5);
+ Tues = today.minusDays(4);
+ Wed = today.minusDays(3);
+ Thurs = today.minusDays(2);
+ Fri = today.minusDays(1);
+ Sun = today.plusDays(1);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ Sunday = Sun.getMonthValue()+"/"+Sun.getDayOfMonth();
+ break;
+ case SUNDAY:
+ Mon = today.minusDays(6);
+ Tues = today.minusDays(5);
+ Wed = today.minusDays(4);
+ Thurs = today.minusDays(3);
+ Fri = today.minusDays(2);
+ Sat = today.minusDays(1);
+ Monday = Mon.getMonthValue()+"/"+Mon.getDayOfMonth();
+ Tuesday = Tues.getMonthValue()+"/"+Tues.getDayOfMonth();
+ Wednesday = Wed.getMonthValue()+"/"+Wed.getDayOfMonth();
+ Thursday = Thurs.getMonthValue()+"/"+Thurs.getDayOfMonth();
+ Friday = Fri.getMonthValue()+"/"+Fri.getDayOfMonth();
+ Saturday = Sat.getMonthValue()+"/"+Sat.getDayOfMonth();
+ Sunday = today.getMonthValue()+"/"+today.getDayOfMonth();
+ break;
+ default:
+ break;
+ }
+
+ return verifyTotalHours(Monday) && verifyTotalHours(Tuesday) &&
+ verifyTotalHours(Wednesday) && verifyTotalHours(Thursday) &&
+ verifyTotalHours(Friday);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/web/WebBaseTest.java b/src/main/java/com/orasi/web/WebBaseTest.java
index 55cdad9..4503434 100644
--- a/src/main/java/com/orasi/web/WebBaseTest.java
+++ b/src/main/java/com/orasi/web/WebBaseTest.java
@@ -343,7 +343,7 @@ public OrasiDriver testStart(String testName) {
setTestName(testName);
driverSetup();
// launch the application under test normally
- if (pageUrl.isEmpty()) {
+ if (getPageURL() == null || getPageURL().isEmpty()) {
launchApplication();
// Otherwise if you have a specific page you want the test to start from
} else {
diff --git a/src/main/java/com/orasi/web/webelements/Element.java b/src/main/java/com/orasi/web/webelements/Element.java
index a7d6f89..fe338c6 100644
--- a/src/main/java/com/orasi/web/webelements/Element.java
+++ b/src/main/java/com/orasi/web/webelements/Element.java
@@ -9,7 +9,6 @@
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.FindBy;
@@ -25,7 +24,6 @@
@ImplementedBy(ElementImpl.class)
public interface Element extends WebElement, WrapsElement, Locatable {
-
/**
* @author Justin
* @see main.java.com.orasi.core.interfaces.impl.ElementImpl#clear()
@@ -108,6 +106,16 @@ public interface Element extends WebElement, WrapsElement, Locatable {
@SuppressWarnings("unchecked")
@Override
Element findElement(By by);
+
+ /**
+ * @author John Martin
+ * @param by
+ * - Search for specified {@link By} location and return it's
+ * {@link WebElement}
+ * @return {@link WebElement}
+ * @see main.java.com.orasi.core.interfaces.impl.ElementImpl#findWebElement()
+ */
+ WebElement findWebElement(By by);
/**
* @author Justin
@@ -117,9 +125,19 @@ public interface Element extends WebElement, WrapsElement, Locatable {
* @return {@link List}
* @see main.java.com.orasi.core.interfaces.impl.ElementImpl#findElements()
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({ "unchecked" })
@Override
- List findElements(By by);
+ List findElements(By by);
+
+ /**
+ * @author John Martin
+ * @param by
+ * - Search for specified {@link By} location and return all
+ * web elements found in a {@link List}
+ * @return {@link List}
+ * @see main.java.com.orasi.core.interfaces.impl.ElementImpl#findElements()
+ */
+ List findWebElements(By by);
/**
* @author Justin
@@ -144,13 +162,6 @@ public interface Element extends WebElement, WrapsElement, Locatable {
@Override
String getCssValue(String propertyName);
- /**
- * @return {@link Coordinates}
- * @see org.orasi.chameleon.interfaces.impl.ElementImpl#getCoordinates();
- */
- @Override
- Coordinates getCoordinates();
-
/**
* @author Justin
* @return {@link Point} Return x and y location
diff --git a/src/main/java/com/orasi/web/webelements/Webtable.java b/src/main/java/com/orasi/web/webelements/Webtable.java
index 0ba9538..bfe0fb9 100644
--- a/src/main/java/com/orasi/web/webelements/Webtable.java
+++ b/src/main/java/com/orasi/web/webelements/Webtable.java
@@ -28,7 +28,7 @@ public interface Webtable extends Element {
/**
* @summary - Return the Cell of the specified row and Column in a Webtable
*/
- WebElement getCell(int row, int column);
+ Element getCell(int row, int column);
/**
* @summary - Click cell in the specified row and Column in a Webtable
diff --git a/src/main/java/com/orasi/web/webelements/impl/ElementImpl.java b/src/main/java/com/orasi/web/webelements/impl/ElementImpl.java
index dd5aa8e..8486f1e 100644
--- a/src/main/java/com/orasi/web/webelements/impl/ElementImpl.java
+++ b/src/main/java/com/orasi/web/webelements/impl/ElementImpl.java
@@ -27,7 +27,6 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
@@ -196,10 +195,22 @@ public Dimension getSize() {
* @see org.openqa.selenium.WebElement#findElement(By)
*/
@Override
- public List findElements(By by) {
- logTrace("Entering ElementImpl#findElements");
+ public List findElements(By by) {
+ logTrace("Entering ElementImpl#findElements");
List elements = getWrappedElement().findElements(by);
+ List elementList = new ArrayList<>();
+ elements.forEach(element -> elementList.add(new ElementImpl(getWrappedDriver(), by, element)));
logTrace("Exiting ElementImpl#findElements");
+ return elementList;
+ }
+
+ /**
+ * @see org.openqa.selenium.WebElement#findElement(By)
+ */
+ public List findWebElements(By by) {
+ logTrace("Entering ElementImpl#findWebElements");
+ List elements = getWrappedElement().findElements(by);
+ logTrace("Exiting ElementImpl#findWebElements");
return elements;
}
@@ -230,13 +241,25 @@ public String getTagName() {
/**
* @see org.openqa.selenium.WebElement#findElement(By)
*/
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public Element findElement(By by) {
logTrace("Entering ElementImpl#findElement");
- Element element = new ElementImpl(this.driver,by);
+ Element element = new ElementImpl(this.driver, by);
logTrace("Exiting ElementImpl#findElement");
return element;
}
+
+ /**
+ * @see org.openqa.selenium.WebElement#findElement(By)
+ */
+ @Override
+ public WebElement findWebElement(By by) {
+ logTrace("Entering ElementImpl#findWebElement");
+ WebElement element = getWrappedElement().findElement(by);
+ logTrace("Exiting ElementImpl#findWebElement");
+ return element;
+ }
/**
* @see org.openqa.selenium.WebElement#isEnabled()
@@ -393,14 +416,6 @@ public OrasiDriver getWrappedDriver() {
return driver;
}
- /**
- * @see org.openqa.selenium.internal.Locatable#getCoordinates();
- */
- @Override
- public Coordinates getCoordinates() {
- return ((Locatable) getWrappedElement()).getCoordinates();
- }
-
@Override
public boolean elementWired() {
return (getWrappedElement() != null);
@@ -468,11 +483,13 @@ public X getScreenshotAs(OutputType target) {
@Override
public boolean syncVisible(Object... args) {
logTrace("Entering ElementImpl#syncVisible");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
+
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -481,15 +498,16 @@ public boolean syncVisible(Object... args) {
}
interfaceLog("Syncing to element [" + getElementLocatorInfo()
- + " ] to be VISIBLE within [ " + timeout + " ] seconds.");
+ + " ] to be VISIBLE within [ " + requestedTimeout + " ] seconds.");
StopWatch stopwatch = new StopWatch();
boolean found = false;
long timeLapse;
-
+
+ driver.setElementTimeout(0);
WebDriverWait wait = new WebDriverWait(driver, 1);
stopwatch.start();
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
found = wait.pollingEvery(MILLISECONDS_TO_POLL_FOR_ELEMENT, TimeUnit.MILLISECONDS).until(ExtendedExpectedConditions.elementToBeVisible(reload()));
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
@@ -498,6 +516,7 @@ public boolean syncVisible(Object... args) {
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
logTrace("Element not VISIBLE and failTestOnSync is [ TRUE ]");
@@ -545,11 +564,13 @@ public boolean syncVisible(Object... args) {
@Override
public boolean syncHidden(Object... args) {
logTrace("Entering ElementImpl#syncHidden");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -559,13 +580,14 @@ public boolean syncHidden(Object... args) {
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to element [" + getElementLocatorInfo()
- + " ] to be HIDDEN within [ " + timeout + " ] seconds.");
+ + " ] to be HIDDEN within [ " + requestedTimeout + " ] seconds.");
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
stopwatch.start();
WebDriverWait wait = new WebDriverWait(driver, 1);
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
found = wait.pollingEvery(MILLISECONDS_TO_POLL_FOR_ELEMENT, TimeUnit.MILLISECONDS).until(ExtendedExpectedConditions.elementToBeHidden(reload()));
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
@@ -575,6 +597,7 @@ public boolean syncHidden(Object... args) {
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
logTrace("Element not HIDDEN and failTestOnSync is [ TRUE ]");
@@ -618,11 +641,10 @@ public boolean syncHidden(Object... args) {
@Override
public boolean syncEnabled(Object... args) {
logTrace("Entering ElementImpl#syncEnabled");
- int requestedTimeout = getWrappedDriver().getElementTimeout();
- int currentElementTimeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
- driver.setElementTimeout(1);
-
+
try {
if (args[0] != null) {
requestedTimeout = Integer.valueOf(args[0].toString());
@@ -635,6 +657,7 @@ public boolean syncEnabled(Object... args) {
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to element [" + getElementLocatorInfo()
+ " ] to be ENABLED within [ " + requestedTimeout + " ] seconds.");
@@ -648,14 +671,17 @@ public boolean syncEnabled(Object... args) {
}
found = wait.pollingEvery(MILLISECONDS_TO_POLL_FOR_ELEMENT, TimeUnit.MILLISECONDS).until(ExpectedConditions.elementToBeClickable(reload())) != null;
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
+ } catch (WebDriverException we) {
+ if (!we.getMessage().toLowerCase().contains("is not clickable at point")) {
+ throw we;
+ }
}
}
- driver.setElementTimeout(currentElementTimeout);
-
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, element);
@@ -704,11 +730,12 @@ public boolean syncEnabled(Object... args) {
@Override
public boolean syncDisabled(Object... args) {
logTrace("Entering ElementImpl#syncDisabled");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -718,25 +745,31 @@ public boolean syncDisabled(Object... args) {
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to element [" + getElementLocatorInfo()
- + " ] to be DISABLED within [ " + timeout + " ] seconds.");
+ + " ] to be DISABLED within [ " + requestedTimeout + " ] seconds.");
stopwatch.start();
WebDriverWait wait = new WebDriverWait(driver, 1);
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
if (Highlight.getDebugMode()) {
Highlight.highlightDebug(driver, reload());
}
found = wait.pollingEvery(MILLISECONDS_TO_POLL_FOR_ELEMENT, TimeUnit.MILLISECONDS).until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(reload()))) != null;
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
+ } catch (WebDriverException we) {
+ if (!we.getMessage().toLowerCase().contains("is not clickable at point")) {
+ throw we;
+ }
}
}
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -785,11 +818,12 @@ public boolean syncDisabled(Object... args) {
@Override
public boolean syncTextInElement(String text, Object... args) {
logTrace("Entering ElementImpl#syncTextInElement");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -801,8 +835,9 @@ public boolean syncTextInElement(String text, Object... args) {
long timeLapse;
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to text [" + text + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
+ driver.setElementTimeout(0);
WebDriverWait wait = new WebDriverWait(driver, 0);
stopwatch.start();
if (Highlight.getDebugMode()) {
@@ -820,11 +855,12 @@ public boolean syncTextInElement(String text, Object... args) {
}
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
}
- } while (stopwatch.getTime() / 1000.0 < timeout);
+ } while (stopwatch.getTime() / 1000.0 < requestedTimeout);
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, element);
@@ -872,11 +908,13 @@ public boolean syncTextInElement(String text, Object... args) {
@Override
public boolean syncTextMatchesInElement(String regex, Object... args) {
logTrace("Entering ElementImpl#syncTextMatchesInElement");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -886,11 +924,13 @@ public boolean syncTextMatchesInElement(String regex, Object... args) {
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to text regular expression [" + regex + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
stopwatch.start();
WebDriverWait wait = new WebDriverWait(driver, 0);
+
do {
try {
@@ -907,10 +947,12 @@ public boolean syncTextMatchesInElement(String regex, Object... args) {
}
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException e) {
}
- } while (stopwatch.getTime() / 1000.0 < timeout);
+ } while (stopwatch.getTime() / 1000.0 < requestedTimeout);
+
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -961,26 +1003,30 @@ public boolean syncTextMatchesInElement(String regex, Object... args) {
@Override
public boolean syncAttributeContainsValue(String attribute, String value, Object... args) {
logTrace("Entering ElementImpl#syncAttributeContainsValue");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
}
} catch (ArrayIndexOutOfBoundsException aiobe) {
}
+
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to attribute [ " + attribute + " ] to contain [ " + value + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
stopwatch.start();
WebDriverWait wait = new WebDriverWait(driver, 1);
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
if (Highlight.getDebugMode()) {
Highlight.highlightDebug(driver, reload());
@@ -993,6 +1039,7 @@ public boolean syncAttributeContainsValue(String attribute, String value, Object
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -1043,11 +1090,12 @@ public boolean syncAttributeContainsValue(String attribute, String value, Object
@Override
public boolean syncAttributeMatchesValue(String attribute, String regex, Object... args) {
logTrace("Entering ElementImpl#syncAttributeMatchesValue");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -1057,13 +1105,14 @@ public boolean syncAttributeMatchesValue(String attribute, String regex, Object.
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to attribute [ " + attribute + " ] to match the regular expression of [ " + regex + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
WebDriverWait wait = new WebDriverWait(driver, 1);
stopwatch.start();
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
if (Highlight.getDebugMode()) {
Highlight.highlightDebug(driver, reload());
@@ -1077,6 +1126,7 @@ public boolean syncAttributeMatchesValue(String attribute, String regex, Object.
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -1126,11 +1176,13 @@ public boolean syncAttributeMatchesValue(String attribute, String regex, Object.
@Override
public boolean syncCssPropertyContainsValue(String cssProperty, String value, Object... args) {
logTrace("Entering ElementImpl#syncCssPropertyContainsValue");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -1140,13 +1192,14 @@ public boolean syncCssPropertyContainsValue(String cssProperty, String value, Ob
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to CSS Property [ " + cssProperty + " ] to contain [ " + value + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
-
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
WebDriverWait wait = new WebDriverWait(driver, 1);
stopwatch.start();
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
if (Highlight.getDebugMode()) {
Highlight.highlightDebug(driver, reload());
@@ -1160,6 +1213,7 @@ public boolean syncCssPropertyContainsValue(String cssProperty, String value, Ob
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -1208,11 +1262,13 @@ public boolean syncCssPropertyContainsValue(String cssProperty, String value, Ob
@Override
public boolean syncCssPropertyMatchesValue(String cssProperty, String regex, Object... args) {
logTrace("Entering ElementImpl#syncCssPropertyMatchesValue");
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -1222,12 +1278,13 @@ public boolean syncCssPropertyMatchesValue(String cssProperty, String regex, Obj
boolean found = false;
long timeLapse;
+ driver.setElementTimeout(0);
StopWatch stopwatch = new StopWatch();
interfaceLog("Syncing to CSS Property [ " + cssProperty + " ] to contain [ " + regex + " ] in element ["
- + getElementLocatorInfo() + " ] to be displayed within [ " + timeout + " ] seconds.");
+ + getElementLocatorInfo() + " ] to be displayed within [ " + requestedTimeout + " ] seconds.");
WebDriverWait wait = new WebDriverWait(driver, 0);
stopwatch.start();
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
if (Highlight.getDebugMode()) {
Highlight.highlightDebug(driver, reload());
@@ -1241,6 +1298,7 @@ public boolean syncCssPropertyMatchesValue(String cssProperty, String regex, Obj
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
Highlight.highlightError(driver, reload());
@@ -1269,14 +1327,15 @@ public boolean syncCssPropertyMatchesValue(String cssProperty, String regex, Obj
}
@Beta
- protected WebElement reload() {
+ protected Element reload() {
logTrace("Entering ElementImpl#reload");
- WebElement el = null;
+ Element el = null;
logTrace("Search DOM for element [ " + by.toString() + " ]");
try {
WebDriverWait wait = new WebDriverWait(getWrappedDriver().getWebDriver(), getWrappedDriver().getElementTimeout());
- el = wait.until(ExpectedConditions.presenceOfElementLocated(by));
+ wait.until(ExpectedConditions.presenceOfElementLocated(by));
+ el = driver.findElement(by);
} catch (WebDriverException wde) {
throw new NoSuchElementException("Failed locate element [ " + by.toString() + " ]");
}
@@ -1290,13 +1349,13 @@ protected WebElement reload() {
public boolean syncInFrame(Object... args) {
logTrace("Entering ElementImpl#syncInFrame");
final String action = "FOUND IN FRAME";
- int originalDriverTimeout = getWrappedDriver().getElementTimeout();
- int timeout = getWrappedDriver().getElementTimeout();
+ int requestedTimeout = driver.getElementTimeout();
+ int originalTimeout = driver.getElementTimeout(); //to set back the implicit wait to original value
boolean failTestOnSync = DEFAULT_SYNC_HANDLER;
- getWrappedDriver().setElementTimeout(0);
+
try {
if (args[0] != null) {
- timeout = Integer.valueOf(args[0].toString());
+ requestedTimeout = Integer.valueOf(args[0].toString());
}
if (args[1] != null) {
failTestOnSync = Boolean.parseBoolean(args[1].toString());
@@ -1305,15 +1364,14 @@ public boolean syncInFrame(Object... args) {
}
interfaceLog("Syncing to element [" + getElementLocatorInfo()
- + " ] to be " + action + " within [ " + timeout + " ] seconds.");
-
+ + " ] to be " + action + " within [ " + requestedTimeout + " ] seconds.");
StopWatch stopwatch = new StopWatch();
boolean found = false;
long timeLapse;
-
WebDriverWait wait = new WebDriverWait(driver, 1);
+ driver.setElementTimeout(0);
stopwatch.start();
- while (((stopwatch.getTime()) / 1000.0) < timeout && !found) {
+ while (((stopwatch.getTime()) / 1000.0) < requestedTimeout && !found) {
try {
found = wait.pollingEvery(MILLISECONDS_TO_POLL_FOR_ELEMENT, TimeUnit.MILLISECONDS).until(ExtendedExpectedConditions.elementToFoundInFrame(by));
} catch (NoSuchElementException | ClassCastException | StaleElementReferenceException | TimeoutException te) {
@@ -1322,6 +1380,7 @@ public boolean syncInFrame(Object... args) {
stopwatch.stop();
timeLapse = stopwatch.getTime();
stopwatch.reset();
+ driver.setElementTimeout(originalTimeout);
if (!found && failTestOnSync) {
logTrace("Element not " + action + " and failTestOnSync is [ TRUE ]");
@@ -1337,12 +1396,10 @@ public boolean syncInFrame(Object... args) {
+ " ] is not " + action + " on the page after [ "
+ (timeLapse) / 1000.0 + " ] seconds.");
logTrace("Exiting ElementImpl#syncInFrame");
- getWrappedDriver().setElementTimeout(originalDriverTimeout);
return found;
}
interfaceLog("Element [" + getElementLocatorInfo() + " ] is " + action + " on the page after [ " + (timeLapse) / 1000.0 + " ] seconds.");
- getWrappedDriver().setElementTimeout(originalDriverTimeout);
logTrace("Exiting ElementImpl#syncInFrame");
return found;
}
@@ -1353,4 +1410,10 @@ public Rectangle getRect() {
return null;
}
-}
+ @Override
+ public Coordinates getCoordinates() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/orasi/web/webelements/impl/WebtableImpl.java b/src/main/java/com/orasi/web/webelements/impl/WebtableImpl.java
index 8ee606d..71533f5 100644
--- a/src/main/java/com/orasi/web/webelements/impl/WebtableImpl.java
+++ b/src/main/java/com/orasi/web/webelements/impl/WebtableImpl.java
@@ -6,7 +6,6 @@
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
import com.orasi.web.OrasiDriver;
import com.orasi.web.webelements.Element;
@@ -28,20 +27,20 @@ public WebtableImpl(OrasiDriver driver, By by) {
super(driver, by);
}
- private List getRowCollection() {
+ private List getRowCollection() {
logTrace("Entering WebtableImpl#getRowCollection");
getWrappedDriver().setElementTimeout(1, TimeUnit.SECONDS);
- List rowCollection = reload().findElements(By.xpath("tr|tbody/tr"));
+ List rowCollection = reload().findElements(By.xpath("tr|tbody/tr"));
getWrappedDriver().setElementTimeout(getWrappedDriver().getElementTimeout(), TimeUnit.SECONDS);
logTrace("Exiting WebtableImpl#getRowCollection");
return rowCollection;
}
- private List getColumnCollection(WebElement row) {
+ private List getColumnCollection(Element row) {
logTrace("Entering WebtableImpl#getColumnCollection");
getWrappedDriver().setElementTimeout(1, TimeUnit.MILLISECONDS);
- List columnCollection = row.findElements(By.xpath("th|td"));
+ List columnCollection = row.findElements(By.xpath("th|td"));
getWrappedDriver().setElementTimeout(getWrappedDriver().getElementTimeout(), TimeUnit.SECONDS);
logTrace("Exiting WebtableImpl#getColumnCollection");
return columnCollection;
@@ -234,15 +233,15 @@ public int getRowWithCellText(String text, int columnPosition, int startRow, boo
logTrace("Entering WebtableImpl#getRowWithCellText(String text, int columnPosition, int startRow, boolean exact)");
int currentRow = 1, rowFound = 0;
- List rowCollection = getRowCollection();
- for (WebElement rowElement : rowCollection) {
+ List rowCollection = getRowCollection();
+ for (Element rowElement : rowCollection) {
if (startRow > currentRow) {
currentRow++;
} else {
if (currentRow <= rowCollection.size()) {
if (columnPosition == -1) {
- for (WebElement cell : getColumnCollection(rowElement)) {
+ for (Element cell : getColumnCollection(rowElement)) {
if (exact) {
if (cell.getText().trim().equals(text)) {
logTrace("Exiting WebtableImpl#getRowWithCellText(String text, int columnPosition, int startRow, boolean exact)");
@@ -256,7 +255,7 @@ public int getRowWithCellText(String text, int columnPosition, int startRow, boo
}
}
} else {
- WebElement cell = rowElement.findElements(By.xpath("th|td")).get(columnPosition - 1);
+ Element cell = rowElement.findElements(By.xpath("th|td")).get(columnPosition - 1);
if (exact) {
if (cell.getText().trim().equals(text)) {
logTrace("Exiting WebtableImpl#getRowWithCellText(String text, int columnPosition, int startRow, boolean exact)");
@@ -313,8 +312,8 @@ public int getColumnWithCellText(String text) {
public int getColumnWithCellText(String text, int rowPosition) {
logTrace("Entering WebtableImpl#getColumnWithCellText(String text, int rowPosition)");
int currentColumn = 1;
- List columns = getColumnCollection(getRowCollection().get(rowPosition - 1));
- for (WebElement cell : columns) {
+ List columns = getColumnCollection(getRowCollection().get(rowPosition - 1));
+ for (Element cell : columns) {
if (currentColumn <= columns.size()) {
if (cell.getText().trim().equals(text)) {
logTrace("Exiting WebtableImpl#getColumnWithCellText(String text, int rowPosition)");
diff --git a/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java b/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java
new file mode 100644
index 0000000..dd63734
--- /dev/null
+++ b/src/test/java/com/bluesource/AddDailyTotalHoursOnTimeReportScreen.java
@@ -0,0 +1,69 @@
+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.EmployeePage;
+import com.orasi.bluesource.Header;
+import com.orasi.bluesource.LoginPage;
+import com.orasi.bluesource.ReportedTimesSummary;
+import com.orasi.utils.TestReporter;
+import com.orasi.web.WebBaseTest;
+
+public class AddDailyTotalHoursOnTimeReportScreen extends WebBaseTest{
+
+
+ // **************
+ // Data Provider
+ // **************
+ /*@DataProvider(name = "accounts_industry", parallel=true)
+ public Object[][] scenarios() {
+ return new ExcelDataProvider("/testdata/blueSource_Users.xlsx", "Sheet1").getTestData();
+ }*/
+
+ @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(groups = {"smoke"} )
+ public void testAddDailyTotalHoursOnTimeReportScreen() {
+ LoginPage loginPage = new LoginPage(getDriver());
+ Header header = new Header(getDriver());
+ ReportedTimesSummary rtSummary = new ReportedTimesSummary(getDriver());
+ EmployeePage ePage = new EmployeePage(getDriver());
+
+ TestReporter.logStep("Login to BlueSource");
+ loginPage.LoginWithCredentials("steven.barnes", "123");
+
+ TestReporter.logStep("Click Manage button");
+ ePage.clickManage();
+
+ TestReporter.logStep("Verify daily totals are accurate");
+ TestReporter.assertTrue(rtSummary.verifyAllTotalHours(),"Verify daily totals are accurate");
+
+ TestReporter.logStep("Logout");
+ header.clickLogout();
+
+ }
+
+}
diff --git a/src/test/java/com/bluesource/messagecenter/ApproveNonBillInMessageCenter.java b/src/test/java/com/bluesource/messagecenter/ApproveNonBillInMessageCenter.java
new file mode 100644
index 0000000..6478d62
--- /dev/null
+++ b/src/test/java/com/bluesource/messagecenter/ApproveNonBillInMessageCenter.java
@@ -0,0 +1,103 @@
+package com.bluesource.messagecenter;
+
+import org.testng.ITestContext;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.orasi.bluesource.EmployeePage;
+import com.orasi.bluesource.Header;
+import com.orasi.bluesource.LoginPage;
+import com.orasi.bluesource.MessageCenter;
+import com.orasi.bluesource.ProjectEmployees;
+import com.orasi.bluesource.ReportedTimesSummary;
+import com.orasi.utils.TestReporter;
+import com.orasi.utils.dataProviders.ExcelDataProvider;
+import com.orasi.web.WebBaseTest;
+
+public class ApproveNonBillInMessageCenter extends WebBaseTest{
+
+
+ // ************* *
+ // Data Provider
+ // **************
+ @DataProvider(name = "messageCenter_data", parallel=true)
+ public Object[][] scenarios() {
+ return new ExcelDataProvider("/testdata/blueSource_Users.xlsx", "Sheet1").getTestData();
+ }
+
+ @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(groups = {"smoke"})
+ public void testApproveNonBillInMessageCenter() {
+ LoginPage loginPage = new LoginPage(getDriver());
+ Header header = new Header(getDriver());
+ MessageCenter message = new MessageCenter(getDriver());
+ EmployeePage empPage = new EmployeePage(getDriver());
+ ReportedTimesSummary rtSummary = new ReportedTimesSummary(getDriver());
+ ProjectEmployees projEmp = new ProjectEmployees(getDriver());
+
+ TestReporter.logStep("Test started");
+ TestReporter.logStep("Login to bluesource as an employee with non-billable role on an open project");
+ loginPage.LoginWithCredentials("steven.barnes", "123");
+
+
+ TestReporter.logStep("Submit a timesheet");
+ empPage.clickManage();
+ rtSummary.addTimeSheetToCurrentPeriod();
+ rtSummary.fillTimeSheet();
+ rtSummary.submitTimeSheet();
+
+ TestReporter.logStep("logout");
+
+ header.clickLogout();
+
+
+ TestReporter.logStep("login as the user's manager");
+ loginPage.LoginWithCredentials("sherri.collins", "123");
+
+
+ TestReporter.logStep("approve the timesheet in Message Center");
+ header.clickMessageCenter();
+ message.clickApprove();
+ message.closeMessageCenter();
+
+
+ TestReporter.logStep("click the employees button");
+ header.clickEmployees();
+
+
+ TestReporter.logStep("find the employee that submitted the time sheet");
+ projEmp.selectEmployee("Steven Barnes");
+
+ TestReporter.logStep("Hover over Approved status and verify that approved by message appears");
+ TestReporter.assertTrue(rtSummary.checkApprovedByMessage("Bench", "Sherri Collins"), "Verify that Approved By message displays");
+
+
+
+
+
+
+ }
+}
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 @@
-
+