Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #669 from zanata/fix-test-settings-tab
Browse files Browse the repository at this point in the history
Wait for settings tab, be less wait-ish in waiting for it
  • Loading branch information
djansen-redhat committed Jan 21, 2015
2 parents bb25da8 + 45784f6 commit e83d4f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions functional-test/src/main/java/org/zanata/page/AbstractPage.java
Expand Up @@ -190,13 +190,14 @@ public boolean apply(WebDriver input) {
* @return target WebElement
*/
public WebElement waitForWebElement(final By elementBy) {
log.info("Waiting for element ready {}", elementBy.toString());
waitForPageSilence();
return waitForAMoment().until(new Function<WebDriver, WebElement>() {
@Override
public WebElement apply(WebDriver input) {
WebElement targetElement = waitForElementExists(elementBy);
WebElement targetElement = getDriver().findElement(elementBy);
if (!elementIsReady(targetElement)) {
throw new NoSuchElementException("Waiting for element");
return null;
}
return targetElement;
}
Expand All @@ -211,14 +212,14 @@ public WebElement apply(WebDriver input) {
*/
public WebElement waitForWebElement(final WebElement parentElement,
final By elementBy) {
log.info("Waiting for element ready {}", elementBy.toString());
waitForPageSilence();
return waitForAMoment().until(new Function<WebDriver, WebElement>() {
@Override
public WebElement apply(WebDriver input) {
WebElement targetElement = waitForElementExists(parentElement,
elementBy);
WebElement targetElement = parentElement.findElement(elementBy);
if (!elementIsReady(targetElement)) {
throw new NoSuchElementException("Waiting for element");
return null;
}
return targetElement;
}
Expand All @@ -233,6 +234,7 @@ public WebElement apply(WebDriver input) {
* @return target WebElement
*/
public WebElement waitForElementExists(final By elementBy) {
log.info("Waiting for element exists {}", elementBy.toString());
waitForPageSilence();
return waitForAMoment().until(new Function<WebDriver, WebElement>() {
@Override
Expand All @@ -251,6 +253,7 @@ public WebElement apply(WebDriver input) {
*/
public WebElement waitForElementExists(final WebElement parentElement,
final By elementBy) {
log.info("Waiting for element exists {}", elementBy.toString());
waitForPageSilence();
return waitForAMoment().until(new Function<WebDriver, WebElement>() {
@Override
Expand Down
Expand Up @@ -78,6 +78,7 @@ public VersionLanguagesPage gotoLanguageTab() {
public VersionBasePage gotoSettingsTab() {
log.info("Click Settings tab");
slightPause();
waitForElementExists(By.id("settings"));
clickWhenTabEnabled(waitForWebElement(By.id("settings_tab")));
waitForWebElement(By.id("settings"));
return new VersionBasePage(getDriver());
Expand Down
Expand Up @@ -65,7 +65,7 @@ public List<String> getSourceDocumentNames() {
public List<String> apply(WebDriver input) {
List<String> fileNames = new ArrayList<String>();
for (WebElement element : getDocumentsTabDocumentList()) {
fileNames.add(waitForWebElement(element,
fileNames.add(element.findElement(
By.className("list__title"))
.getText());
}
Expand Down

0 comments on commit e83d4f4

Please sign in to comment.