/** * Tests view versions. * * @param docPage the current doc page * @return the current doc page */ protected DocumentBasePage testViewVersions(DocumentBasePage docPage) { // Go to archived versions sub tab ArchivedVersionsSubPage archivedVersionsPage = docPage.getHistoryTab().getArchivedVersionsSubTab(); // Check version labels List<String> versionLabels = archivedVersionsPage.getVersionLabels(); List<String> expectedVersionLabels = new ArrayList<String>(); expectedVersionLabels.add("1.0"); expectedVersionLabels.add("2.0"); assertEquals(expectedVersionLabels, versionLabels); // View version 1.0 and check its title DocumentBasePage versionPage = archivedVersionsPage.viewVersion("1.0"); versionPage.checkDocTitle("Test file: modif 1 (Version 1.0)"); // Go back to doc docPage = versionPage.goToDocumentByBreadcrumb("Test file: modif 2"); // Go to archived versions sub tab archivedVersionsPage = docPage.getHistoryTab().getArchivedVersionsSubTab(); // View version 2.0 and check its title versionPage = archivedVersionsPage.viewVersion("2.0"); versionPage.checkDocTitle("Test file: modif 2 (Version 2.0)"); // Go back to doc and return it return versionPage.goToDocumentByBreadcrumb("Test file: modif 2"); }
/** * Tests delete versions. * * @param docPage the current doc page * @return the current doc page */ protected DocumentBasePage testDeleteVersions(DocumentBasePage docPage) { // Go to archived versions sub tab ArchivedVersionsSubPage archivedVersionsPage = docPage.getHistoryTab().getArchivedVersionsSubTab(); // Check cannot delete versions since none is selected archivedVersionsPage.checkCanRemoveSelectedVersions(false); // Select version 1.0 archivedVersionsPage = archivedVersionsPage.selectVersion("1.0"); // Check can delete versions since one is selected archivedVersionsPage.checkCanRemoveSelectedVersions(true); // Select version 2.0 archivedVersionsPage = archivedVersionsPage.selectVersion("2.0"); // Check can delete versions since two are selected archivedVersionsPage.checkCanRemoveSelectedVersions(true); // Delete selected versions archivedVersionsPage = archivedVersionsPage.removeSelectedVersions(); // Check version labels, there should be none List<String> versionLabels = archivedVersionsPage.getVersionLabels(); assertEquals(0, versionLabels.size()); // Go back to doc and return it return archivedVersionsPage.goToDocumentByBreadcrumb("Test file: modif 1"); }
/** * Tests restore version. * * @param docPage the current doc page * @return the current doc page */ protected DocumentBasePage testRestoreVersion(DocumentBasePage docPage) { // Go to archived versions sub tab ArchivedVersionsSubPage archivedVersionsPage = docPage.getHistoryTab().getArchivedVersionsSubTab(); // Restore version 1.0 and check its title DocumentBasePage restoredVersionPage = archivedVersionsPage.restoreVersion("1.0"); restoredVersionPage.checkDocTitle("Test file: modif 1"); // Return doc return restoredVersionPage; }