@Test public void canPushAndPullProperties() throws IOException, InterruptedException { restCaller.createProjectAndVersion("properties-test", "master", "properties"); // generate a zanata.xml TestFileGenerator.generateZanataXml( new File(tempDir, "zanata.xml"), "properties-test", "master", "properties", Lists.newArrayList("pl")); List<String> output = client.callWithTimeout( tempDir, "mvn -B org.zanata:zanata-maven-plugin:push -Dzanata.srcDir=. -Dzanata.userConfig=" + userConfigPath); assertThat(client.isPushSuccessful(output), Matchers.equalTo(true)); EditorPage editorPage = verifyPushedToEditor().setSyntaxHighlighting(false); 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), Matchers.is(true)); File transFile = new File(tempDir, "test_pl.properties"); assertThat(transFile.exists(), Matchers.is(true)); Properties translations = new Properties(); translations.load(new FileReader(transFile)); assertThat(translations.size(), Matchers.is(1)); assertThat(translations.getProperty("hey"), Matchers.equalTo("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() .goToPage( String.format( BasicWorkFlow.EDITOR_TEMPLATE, "properties-test", "master", "pl", "test"), EditorPage.class); assertThat( editor.getMessageTargetAtRowIndex(1), Matchers.equalTo("translation updated on client")); }
@Feature( summary = "The user can filter project versions by name", tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0) @Ignore("dodgy test (intermittent timeout)") @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) public void versionSearchFiltering() throws Exception { String projectName = "versionsearchnums"; zanataRestCaller = new ZanataRestCaller( "translator", PropertiesHolder.getProperty(Constants.zanataTranslatorKey.value())); zanataRestCaller.createProjectAndVersion(projectName, "alpha", "file"); zanataRestCaller.createProjectAndVersion(projectName, "bravo", "file"); assertThat(new LoginWorkFlow().signIn("translator", "translator").loggedInAs()) .isEqualTo("translator") .as("Login as translator"); ProjectVersionsPage projectVersionsPage = new ProjectWorkFlow().goToProjectByName(projectName).expectDisplayedVersions(2); assertVersions(projectVersionsPage, 2, new String[] {"bravo", "alpha"}); projectVersionsPage = projectVersionsPage .clickSearchIcon() .enterVersionSearch("alpha") .expectDisplayedVersions(1); assertVersions(projectVersionsPage, 1, new String[] {"alpha"}); projectVersionsPage = projectVersionsPage.clearVersionSearch().expectDisplayedVersions(2); assertVersions(projectVersionsPage, 2, new String[] {"bravo", "alpha"}); projectVersionsPage = projectVersionsPage.enterVersionSearch("bravo").expectDisplayedVersions(1); assertVersions(projectVersionsPage, 1, new String[] {"bravo"}); projectVersionsPage.waitForPageSilence(); projectVersionsPage = projectVersionsPage .clearVersionSearch() .enterVersionSearch("charlie") .expectDisplayedVersions(0); assertVersions(projectVersionsPage, 0, new String[] {}); projectVersionsPage.waitForPageSilence(); projectVersionsPage = projectVersionsPage.clearVersionSearch().expectDisplayedVersions(2); assertVersions(projectVersionsPage, 2, new String[] {"bravo", "alpha"}); }