This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for viewing translation history
Test the translation history view shows Test two versions can be compared
- Loading branch information
1 parent
e3a9f8e
commit d95e8fe
Showing
2 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
functional-test/src/test/java/org/zanata/feature/editor/TranslationHistoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* 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 org.junit.Rule; | ||
import org.junit.Test; | ||
import org.zanata.feature.testharness.ZanataTestCase; | ||
import org.zanata.page.webtrans.EditorPage; | ||
import org.zanata.util.RetryRule; | ||
import org.zanata.util.SampleProjectRule; | ||
import org.zanata.workflow.LoginWorkFlow; | ||
import org.zanata.workflow.ProjectWorkFlow; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
public class TranslationHistoryTest extends ZanataTestCase { | ||
|
||
@Rule | ||
public RetryRule retryRule = new RetryRule(0); | ||
|
||
@Rule | ||
public SampleProjectRule sampleProjectRule = new SampleProjectRule(); | ||
|
||
@Test | ||
public void showTranslationHistory() { | ||
new LoginWorkFlow().signIn("admin", "admin"); | ||
EditorPage editorPage = new ProjectWorkFlow() | ||
.goToProjectByName("about fedora") | ||
.gotoVersion("master") | ||
.translate("pl", "About_Fedora") | ||
.translateTargetAtRowIndex(0, "historytest") | ||
.saveAsFuzzyAtRow(0) | ||
.clickShowHistoryForRow(0); | ||
|
||
assertThat(editorPage.getHistoryEntryAuthor(0)) | ||
.startsWith("Administrator") | ||
.as("The user is displayed"); | ||
assertThat(editorPage.getHistoryEntryContent(0)) | ||
.contains("historytest") | ||
.as("The content change is displayed"); | ||
} | ||
|
||
@Test | ||
public void compareTranslationHistory() { | ||
new LoginWorkFlow().signIn("admin", "admin"); | ||
EditorPage editorPage = new ProjectWorkFlow() | ||
.goToProjectByName("about fedora") | ||
.gotoVersion("master") | ||
.translate("pl", "About_Fedora") | ||
.translateTargetAtRowIndex(0, "historytest") | ||
.saveAsFuzzyAtRow(0) | ||
.translateTargetAtRowIndex(0, "historytest2") | ||
.approveTranslationAtRow(0) | ||
.clickShowHistoryForRow(0) | ||
.clickCompareOn(0) | ||
.clickCompareOn(1); | ||
|
||
assertThat(editorPage.getTranslationHistoryCompareTabtext()) | ||
.isEqualTo("Compare ver. 2 and 1") | ||
.as("The tab displays compared versions"); | ||
|
||
editorPage = editorPage.clickCompareVersionsTab(); | ||
|
||
assertThat(editorPage.getComparisonTextInRow(0)) | ||
.isEqualTo("historytest2") | ||
.as("The new text is displayed"); | ||
assertThat(editorPage.getComparisonTextInRow(1)) | ||
.isEqualTo("historytest2") | ||
.as("The old text is also displayed"); | ||
assertThat(editorPage.getComparisonTextDiff()) | ||
.contains("--2") | ||
.as("The diff is displayed"); | ||
} | ||
} |