Skip to content

Commit

Permalink
Fixed issues paypal#45 and added a supporting unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Zaytsev committed Oct 21, 2014
1 parent 254d92d commit 4ea21ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static void waitForCondition(ExpectedCondition<?> condition, long timeou
public static void waitUntilElementIsInvisible(final String elementLocator) {
logger.entering(elementLocator);
Preconditions.checkState(Grid.driver() != null, INVALID_STATE_ERR_MSG);
By by = HtmlElementUtils.getFindElementType(elementLocator);
By by = HtmlElementUtils.resolveByType(elementLocator);
ExpectedCondition<Boolean> condition = ExpectedConditions.invisibilityOfElementLocated(by);
waitForCondition(condition);
logger.exiting();
Expand All @@ -84,7 +84,7 @@ public static void waitUntilElementIsInvisible(final String elementLocator) {
public static void waitUntilElementIsPresent(final String elementLocator) {
logger.entering(elementLocator);
Preconditions.checkState(Grid.driver() != null, INVALID_STATE_ERR_MSG);
By by = HtmlElementUtils.getFindElementType(elementLocator);
By by = HtmlElementUtils.resolveByType(elementLocator);
ExpectedCondition<WebElement> condition = ExpectedConditions.presenceOfElementLocated(by);
waitForCondition(condition);
logger.exiting();
Expand All @@ -100,7 +100,7 @@ public static void waitUntilElementIsPresent(final String elementLocator) {
public static void waitUntilElementIsVisible(final String elementLocator) {
logger.entering(elementLocator);
Preconditions.checkState(Grid.driver() != null, INVALID_STATE_ERR_MSG);
By by = HtmlElementUtils.getFindElementType(elementLocator);
By by = HtmlElementUtils.resolveByType(elementLocator);
ExpectedCondition<WebElement> condition = ExpectedConditions.visibilityOfElementLocated(by);
waitForCondition(condition);
logger.exiting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
public class SeLionSeleniumTest {

final String badLocator = "//wrong locator or text or page title";
final String locator = "//input[@id='lst-ib']";
final String locator = "//input[@id='gbqfq']";
final String pipedLocator = "//input[@id='gbqfq']|SomeOtherLocator";
final String disappearElement = "btnI";
final String pageTitle = "Google";
final String text = "Maps";
Expand Down Expand Up @@ -101,6 +102,18 @@ public void testWaitUntilElementPresentPos() {
}
}

@Test(groups = { "browser-tests" })
@WebTest
public void testWasitUntilElementPipedLocator() {
Grid.driver().get(url);
try {
WebDriverWaitUtils.waitUntilElementIsPresent(pipedLocator);
assertTrue(true);
} catch (WaitTimedOutException e) {
fail(e.getMessage());
}
}

@Test(groups = { "browser-tests" }, expectedExceptions = { WaitTimedOutException.class })
@WebTest
public void testWaitUntilPageTitlePresentNeg() {
Expand Down

0 comments on commit 4ea21ad

Please sign in to comment.