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

Commit

Permalink
Fix functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Apr 6, 2014
1 parent f9e241c commit 33c275c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
Expand Up @@ -23,11 +23,9 @@
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.zanata.page.webtrans.EditorPage;

import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
Expand Down Expand Up @@ -105,15 +103,17 @@ public EditorPage apply(WebDriver driver) {
public boolean sourceDocumentsContains(String document) {
gotoDocumentTab();
List<WebElement> documentList = getLanguageTabDocumentList();
for (WebElement tableRow : documentList) {
if (tableRow.getText().contains(document)) {
for (final WebElement tableRow : documentList) {
if (tableRow.findElement(By.className("list__title")).getText()
.contains(document)) {
return true;
}
}
return false;
}

private List<WebElement> getLanguageTabDocumentList() {

waitForTenSec().until(new Predicate<WebDriver>() {
@Override
public boolean apply(WebDriver input) {
Expand All @@ -123,8 +123,10 @@ public boolean apply(WebDriver input) {
}
});

return getDriver().findElement(By.id("documents-document_list"))
.findElements(By.tagName("li"));
List<WebElement> rows =
getDriver().findElement(By.id("documents-document_list"))
.findElements(By.xpath("./li"));
return rows;
}

private List<WebElement> getVersionTabDocumentList() {
Expand All @@ -142,7 +144,6 @@ public boolean apply(WebDriver input) {
By.xpath("//form[@id='languages-document_list']/ul[@class='list--stats']/li"));
}


public String getStatisticsForLocale(final String localeId) {
gotoLanguageTab();

Expand Down
@@ -1,15 +1,16 @@
package org.zanata.page.projectversion.versionsettings;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.zanata.page.projectversion.VersionBasePage;
import org.zanata.page.projectversion.VersionLanguagesPage;

import java.util.List;

/**
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @author Damian Jansen <a
* href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
public class VersionDocumentsTab extends VersionBasePage {

Expand Down Expand Up @@ -52,14 +53,15 @@ public VersionLanguagesPage submitUpload() {
}

public boolean sourceDocumentsContains(String document) {
gotoDocumentTab();
List<WebElement> documentList = getDriver()
.findElement(By.id("settings-document_form"))
.findElement(By.tagName("ul"))
.findElements(By.tagName("li"));
for (WebElement tableRow : documentList) {
if (tableRow.findElement(By.tagName("label"))
.getText().contains(document)) {

List<WebElement> documentLabelList =
getDriver()
.findElement(By.id("settings-document_form"))
.findElement(By.tagName("ul"))
.findElements(
By.xpath(".//li/label[@class='form__checkbox__label']"));
for (WebElement label : documentLabelList) {
if (label.getText().contains(document)) {
return true;
}
}
Expand Down

0 comments on commit 33c275c

Please sign in to comment.