Package org.zanata.page.webtrans

Examples of org.zanata.page.webtrans.EditorPage


                sourceResource, false);

        // open editor
        new LoginWorkFlow().signIn("admin", "admin");
        // webTrans
        final EditorPage editorPage =
                new BasicWorkFlow().goToEditor("base", "master", "pl",
                        "test.pot");

        String translation = editorPage.getMessageTargetAtRowIndex(0);
        // for some reason getText() will return one space in it
        assertThat(translation.trim()).isEmpty();

        // push target
        TranslationsResource translationsResource =
                buildTranslationResource(
                        buildTextFlowTarget("res1", "hello world translated"));
        restCaller.postTargetDocResource(projectSlug, iterationSlug, docId,
                new LocaleId("pl"), translationsResource, "auto");

        // REST push broadcast event to editor
        assertThat(editorPage.expectBasicTranslationAtRowIndex(0,
                "hello world translated")).isTrue();
    }
View Full Code Here


                false);

        // open editor
        new LoginWorkFlow().signIn("admin", "admin");
        // webTrans
        final EditorPage editorPage =
                new BasicWorkFlow().goToEditor("base", "beta", "pl",
                        "test.pot");

        String translation = editorPage.getMessageTargetAtRowIndex(0);
        // for some reason getText() will return one space in it
        assertThat(translation.trim()).isEmpty();

        // run copyTrans
        restCaller.runCopyTrans(projectSlug, "beta", docId);

        // copyTrans broadcast event to editor
        assertThat(editorPage.expectBasicTranslationAtRowIndex(0,
                "hello world translated")).isTrue();
    }
View Full Code Here

                .gotoDocumentTab();

        assertThat(versionDocumentsPage.sourceDocumentsContains(testFileName))
                .as("Document shows in table");

        EditorPage editorPage = versionDocumentsPage
                .gotoLanguageTab()
                .translate("pl", testFileName);

        assertThat(editorPage.getMessageSourceAtRowIndex(0))
                .isEqualTo(testString)
                .as("The translation source is correct");
    }
View Full Code Here

                        "mvn -B zanata:push -Dzanata.pushType=both -Dzanata.userConfig="
                                + userConfigPath);

        assertThat(client.isPushSuccessful(output)).isTrue();

        EditorPage editorPage = verifyPluralPushedToEditor();

        File pullDir = Files.createTempDir();
        String pullDirPath = pullDir.getAbsolutePath();
        String command =
                "mvn -B zanata:pull -Dzanata.pullType=both -Dzanata.srcDir="
                        + pullDirPath + " -Dzanata.transDir=" + pullDirPath
                        + " -Dzanata.userConfig=" + userConfigPath;
        output = client.callWithTimeout(tempDir, command);
        assertThat(client.isPushSuccessful(output)).isTrue();

        // source round trip
        List<TextFlow> originalTextFlows =
                getTextFlows(new File(projectRootPath + "/pot/test.pot"));
        List<TextFlow> pulledTextFlows =
                getTextFlows(new File(pullDir, "test.pot"));
        assertThat(pulledTextFlows).isEqualTo(originalTextFlows);

        // translation round trip
        List<TextFlowTarget> originalTargets =
                getTextFlowTargets(new File(projectRootPath + "/pl/test.po"));
        List<TextFlowTarget> pulledTargets =
                getTextFlowTargets(new File(pullDir + "/pl/test.po"));
        assertThat(pulledTargets).isEqualTo(originalTargets);

        // translate on web UI and pull again
        editorPage.translateTargetAtRowIndex(0, "one aoeuaouaou")
                .saveAsFuzzyAtRow(0);


        client.callWithTimeout(tempDir, command);
        List<String> newContents =
View Full Code Here

    }

    private static EditorPage verifyPluralPushedToEditor() {
        // verify first message
        new LoginWorkFlow().signIn("admin", "admin");
        EditorPage editorPage = new BasicWorkFlow()
                .goToEditor("plurals", "master", "pl", "test");

        assertThat(editorPage.getMessageSourceAtRowIndex(0, Plurals.SourceSingular))
                .isEqualTo("One file removed");
        assertThat(editorPage.getMessageSourceAtRowIndex(0, Plurals.SourcePlural))
                .isEqualTo("%d files removed");
        // nplural for Polish is 3

        assertThat(editorPage.getBasicTranslationTargetAtRowIndex(0,
                Plurals.TargetSingular))
                .isEqualTo("1 aoeuaouaou");
        assertThat(editorPage.getBasicTranslationTargetAtRowIndex(0,
                Plurals.TargetPluralOne))
                .isEqualTo("%d aoeuaouao");
        assertThat(editorPage.getBasicTranslationTargetAtRowIndex(0,
                Plurals.TargetPluralTwo))
                .isEqualTo("");

        return editorPage;
    }
View Full Code Here

                "basichtml", "." + extension,
                "<html><body>Line One<p>Line Two<p>Line Three</body></html>");
        zanataRestCaller.createProjectAndVersion(extension+"-translate",
                extension, "file");

        EditorPage editorPage = new ProjectWorkFlow()
                .goToProjectByName(extension+"-translate")
                .gotoVersion(extension)
                .gotoSettingsTab()
                .gotoSettingsDocumentsTab()
                .pressUploadFileButton()
                .enterFilePath(testfile.getAbsolutePath())
                .submitUpload()
                .clickUploadDone()
                .gotoLanguageTab()
                .translate("fr", testfile.getName());

        assertThat(editorPage.getMessageSourceAtRowIndex(0))
                .isEqualTo("Line One")
                .as("Item 1 shows Line One");

        assertThat(editorPage.getMessageSourceAtRowIndex(1))
                .isEqualTo("Line Two")
                .as("Item 2 shows Line Two");
        assertThat(editorPage.getMessageSourceAtRowIndex(2))
                .isEqualTo("Line Three")
                .as("Item 3 shows Line Three");

        editorPage = editorPage
                .translateTargetAtRowIndex(0, "Une Ligne")
                .approveTranslationAtRow(0)
                .translateTargetAtRowIndex(1, "Deux Ligne")
                .approveTranslationAtRow(1)
                .translateTargetAtRowIndex(2, "Ligne Trois")
                .approveTranslationAtRow(2);

        assertTranslations(editorPage);

        // Close and reopen the editor to test save
        editorPage.reload();

        assertTranslations(editorPage);
    }
View Full Code Here

        assertThat(clientWorkFlow.isPushSuccessful(result)).isTrue()
                .as("Glossary delete was successful");


        new LoginWorkFlow().signIn("admin", "admin");
        EditorPage editorPage =
                new BasicWorkFlow().goToEditor("about-fedora", "master", "hi",
                        "About_Fedora")
                        .searchGlossary("hello");

        assertThat(editorPage.getGlossaryResultTable())
                .as("Glossary table is empty").isEmpty();

        editorPage = new BasicWorkFlow().goToEditor("about-fedora", "master",
                "pl", "About_Fedora")
                .searchGlossary("hello");

        assertThat(editorPage.getGlossaryResultTable()
                .get(1).get(1)).isEqualTo("cześć")
                .as("The glossary result in row 2, column 2 is correct");
    }
View Full Code Here

    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
    public void translateBasicOdsFile() {
        File testfile = testFileGenerator.openTestFile("test-ods.ods");
        zanataRestCaller.createProjectAndVersion("ods-translate", "ods", "file");

        EditorPage editorPage = new ProjectWorkFlow()
                .goToProjectByName("ods-translate")
                .gotoVersion("ods")
                .gotoSettingsTab()
                .gotoSettingsDocumentsTab()
                .pressUploadFileButton()
                .enterFilePath(testfile.getAbsolutePath())
                .submitUpload()
                .clickUploadDone()
                .gotoLanguageTab()
                .translate("fr", testfile.getName());

        assertThat(editorPage.getMessageSourceAtRowIndex(0))
                .isEqualTo("TestODS")
                .as("Item 1 shows TestODS (the sheet name)");
        assertThat(editorPage.getMessageSourceAtRowIndex(1))
                .isEqualTo("First")
                .as("Item 2 shows First (the page name)");
        assertThat(editorPage.getMessageSourceAtRowIndex(2))
                .isEqualTo("Line One")
                .as("Item 3 shows Line One");
        assertThat(editorPage.getMessageSourceAtRowIndex(3))
                .isEqualTo("Line Two")
                .as("Item 4 shows Line Two");
        assertThat(editorPage.getMessageSourceAtRowIndex(4))
                .isEqualTo("Line Three")
                .as("Item 5 shows Line Three");

        editorPage = editorPage
                .translateTargetAtRowIndex(0, "TestODS")
                .approveTranslationAtRow(0)
                .translateTargetAtRowIndex(1, "Début")
                .approveTranslationAtRow(1)
                .translateTargetAtRowIndex(2, "Une Ligne")
                .approveTranslationAtRow(2)
                .translateTargetAtRowIndex(3, "Deux Ligne")
                .approveTranslationAtRow(3)
                .translateTargetAtRowIndex(4, "Ligne Trois")
                .approveTranslationAtRow(4);

        assertTranslations(editorPage);

        // Close and reopen the editor to test save, switches to CodeMirror
        editorPage.reload();

        assertTranslations(editorPage);
    }
View Full Code Here

                "mvn -B org.zanata:zanata-maven-plugin:push -Dzanata.srcDir=. "+
                "-Dzanata.userConfig=" + userConfigPath);

        assertThat(client.isPushSuccessful(output)).isTrue();

        EditorPage editorPage = verifyPushedToEditor();
        editorPage = editorPage.translateTargetAtRowIndex(2,
                "translation updated approved")
                .approveTranslationAtRow(2);

        editorPage.translateTargetAtRowIndex(1, "translation updated fuzzy")
                .saveAsFuzzyAtRow(1);

        output = client.callWithTimeout(tempDir,
                "mvn -B org.zanata:zanata-maven-plugin:pull " +
                "-Dzanata.userConfig=" + userConfigPath);

        assertThat(client.isPushSuccessful(output)).isTrue();
        File transFile = new File(tempDir, "test_pl.properties");
        assertThat(transFile.exists()).isTrue();
        Properties translations = new Properties();
        translations.load(new FileReader(transFile));
        assertThat(translations.size()).isEqualTo(1);
        assertThat(translations.getProperty("hey"))
                .isEqualTo("translation updated approved");

        // change on client side
        translations.setProperty("greeting", "translation updated on client");
        translations.store(new FileWriter(transFile), null);

        // push again
        client.callWithTimeout(tempDir,
                "mvn -B org.zanata:zanata-maven-plugin:push " +
                "-Dzanata.pushType=trans -Dzanata.srcDir=. -Dzanata.userConfig="
                + userConfigPath);

        final EditorPage editor =
                new BasicWorkFlow().goToEditor("properties-test",
                        "master", "pl", "test");
        assertThat(editor.getBasicTranslationTargetAtRowIndex(1))
                .isEqualTo("translation updated on client");
    }
View Full Code Here

                .isEqualTo("translation updated on client");
    }

    private static EditorPage verifyPushedToEditor() {
        new LoginWorkFlow().signIn("admin", "admin");
        EditorPage editorPage =
                new BasicWorkFlow().goToEditor("properties-test",
                        "master", "pl", "test");

        assertThat(editorPage.getMessageSourceAtRowIndex(0))
                .isEqualTo("hello world");
        assertThat(editorPage.getMessageSourceAtRowIndex(1))
                .isEqualTo("this is from Huston");
        assertThat(editorPage.getMessageSourceAtRowIndex(2))
                .isEqualTo("hey hey");

        return editorPage;
    }
View Full Code Here

TOP

Related Classes of org.zanata.page.webtrans.EditorPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.