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

Commit

Permalink
Fix and add tests missing from the test plan
Browse files Browse the repository at this point in the history
Some tests have not been run, as they were missing from the plan.
Adds them and fixes the ones that broke during.
Add category to some tests.
Remove unused imports.
Add license headers.
  • Loading branch information
djansen-redhat committed Nov 6, 2014
1 parent 18fe12b commit 920e4f3
Show file tree
Hide file tree
Showing 43 changed files with 511 additions and 49 deletions.
Expand Up @@ -20,12 +20,14 @@
*/
package org.zanata.page.glossary;

import java.util.ArrayList;
import java.util.List;

import lombok.extern.slf4j.Slf4j;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.zanata.page.BasePage;
import org.zanata.util.WebElementUtil;

Expand All @@ -45,17 +47,34 @@ public GlossaryPage(WebDriver driver) {
public List<String> getAvailableGlossaryLanguages() {
log.info("Query available glossary languages");
return WebElementUtil.getColumnContents(getDriver(), glossaryTable, 0);
/* List<String> availableLanguages = new ArrayList<>();
for (WebElement element : getListItems()) {
availableLanguages.add(element
.findElement(By.className("list__title")).getText().trim());
}
return availableLanguages;
*/
}

public int getGlossaryEntryCount(String lang) {
log.info("Query number of glossary entries for {}", lang);
List<String> langs = getAvailableGlossaryLanguages();
int row = langs.indexOf(lang);
List<WebElement> langs = getListItems();
int row = getAvailableGlossaryLanguages().indexOf(lang);
if (row >= 0) {
return Integer
.parseInt(WebElementUtil.getColumnContents(getDriver(),
glossaryTable, 2).get(row));
/* return Integer.parseInt(langs.get(row)
.findElement(By.className("stats__figure")).getText());
*/
}
return -1;
}

private List<WebElement> getListItems() {
return getDriver()
.findElement(By.id("glossary_form"))
.findElement(By.className("list--stats"))
.findElements(By.className("list__item--actionable"));
}
}
20 changes: 20 additions & 0 deletions functional-test/src/test/java/org/zanata/feature/Feature.java
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature;

import java.lang.annotation.ElementType;
Expand Down
Expand Up @@ -22,7 +22,6 @@


import lombok.extern.slf4j.Slf4j;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.experimental.categories.Category;
Expand All @@ -35,7 +34,6 @@
import org.zanata.feature.testharness.ZanataTestCase;
import org.zanata.feature.testharness.TestPlan.DetailedTest;
import org.zanata.page.account.RegisterPage;
import org.zanata.page.utility.HomePage;
import org.zanata.util.EnsureLogoutRule;
import org.zanata.util.rfc2822.InvalidEmailAddressRFC2822;
import org.zanata.workflow.BasicWorkFlow;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.clientserver;

import java.io.File;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.clientserver;

import com.google.common.base.Joiner;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.clientserver;

import java.io.File;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.concurrentedit;

import java.util.Collections;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.concurrentedit;

import org.junit.Before;
Expand Down
Expand Up @@ -23,17 +23,15 @@
import lombok.extern.slf4j.Slf4j;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.experimental.categories.Category;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.zanata.feature.testharness.TestPlan.BasicAcceptanceTest;
import org.zanata.feature.testharness.TestPlan.DetailedTest;
import org.zanata.feature.testharness.ZanataTestCase;
import org.zanata.page.projectversion.VersionDocumentsPage;
import org.zanata.page.projectversion.VersionLanguagesPage;
import org.zanata.page.projectversion.versionsettings.VersionDocumentsTab;
import org.zanata.page.webtrans.EditorPage;
import org.zanata.util.CleanDocumentStorageRule;
import org.zanata.util.SampleProjectRule;
Expand All @@ -51,6 +49,7 @@
*/
@Slf4j
@RunWith(Theories.class)
@Category(DetailedTest.class)
public class DocTypeUploadTest extends ZanataTestCase {

@ClassRule
Expand Down
Expand Up @@ -22,10 +22,8 @@

import java.io.File;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.Feature;
Expand Down
Expand Up @@ -24,8 +24,6 @@

import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand Down
Expand Up @@ -21,29 +21,23 @@
package org.zanata.feature.document;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.testharness.TestPlan.DetailedTest;
import org.zanata.feature.testharness.ZanataTestCase;
import org.zanata.page.projectversion.VersionDocumentsPage;
import org.zanata.page.projectversion.VersionLanguagesPage;
import org.zanata.page.projectversion.versionsettings.VersionDocumentsTab;
import org.zanata.page.webtrans.EditorPage;
import org.zanata.util.CleanDocumentStorageRule;
import org.zanata.util.SampleProjectRule;
import org.zanata.util.TestFileGenerator;
import org.zanata.util.ZanataRestCaller;
import org.zanata.workflow.BasicWorkFlow;
import org.zanata.workflow.LoginWorkFlow;
import org.zanata.workflow.ProjectWorkFlow;

import java.io.File;

import static org.assertj.core.api.Assertions.assertThat;
import static org.zanata.util.FunctionalTestHelper.assumeTrue;

/**
* Covers more detailed testing of the subtitle formats
Expand Down
Expand Up @@ -24,8 +24,6 @@

import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
Expand Down
@@ -1,3 +1,23 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.editor;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -50,11 +70,12 @@ public void setUp() {
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0)
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
public void canFilterByMultipleFields() {
EditorPage editorPage =
new BasicWorkFlow().goToEditor("about-fedora", "master", "fr",
document);
EditorPage editorPage = new BasicWorkFlow()
.goToEditor("about-fedora", "master", "fr", document);

assertThat(editorPage.getMessageSources()).containsExactly(
"hello world", "greetings", "hey");

final EditorPage page = editorPage.inputFilterQuery("resource-id:res2");

editorPage.waitFor(new Callable<Iterable<? extends String>>() {
Expand Down
Expand Up @@ -21,7 +21,6 @@
package org.zanata.feature.editor;

import java.io.File;
import java.util.HashMap;

import org.junit.Before;
import org.junit.Rule;
Expand Down
Expand Up @@ -21,7 +21,6 @@
package org.zanata.feature.editor;

import java.io.File;
import java.util.HashMap;

import org.junit.Before;
import org.junit.Rule;
Expand Down
Expand Up @@ -21,7 +21,6 @@
package org.zanata.feature.editor;

import java.io.File;
import java.util.HashMap;

import org.junit.Before;
import org.junit.Rule;
Expand Down
Expand Up @@ -21,7 +21,6 @@
package org.zanata.feature.editor;

import java.io.File;
import java.util.HashMap;

import org.junit.Before;
import org.junit.Rule;
Expand Down
Expand Up @@ -22,6 +22,8 @@

import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.testharness.TestPlan.DetailedTest;
import org.zanata.feature.testharness.ZanataTestCase;
import org.zanata.page.webtrans.EditorPage;
import org.zanata.util.RetryRule;
Expand All @@ -34,6 +36,7 @@
/**
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@Category(DetailedTest.class)
public class TranslationHistoryTest extends ZanataTestCase {

@Rule
Expand Down

0 comments on commit 920e4f3

Please sign in to comment.