From 7c9329453bc1d29d4594cc52b5826264f5c560b4 Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Thu, 6 Feb 2025 12:42:57 +0100 Subject: [PATCH 1/2] Add Selenium test to verfiy that pagination scope is not reset when changing pagination type --- .../java/org/kitodo/selenium/MetadataST.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java index d875ca9c3cc..e027800a122 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java @@ -225,6 +225,37 @@ public void showPaginationByDefaultTest() throws Exception { assertFalse(Pages.getMetadataEditorPage().isPaginationPanelVisible()); } + /** + * Verifies that changing the pagination type does not reset the selected pagination scope. + * @throws Exception when page navigation fails + */ + @Test + public void keepPaginationScopeOnPaginationTypeChangeTest() throws Exception { + String paginationTogglerId = "secondSectionSecondColumnToggler"; + String paginationScopeId = "paginationForm:selectPaginationScope"; + String paginationTypeId = "paginationForm:paginationTypeSelect"; + String secondTypeCssSelector = "#paginationForm\\:paginationTypeSelect_items li:nth-child(2)"; + login("kowal"); + Pages.getProcessesPage().goTo().editMetadata(MockDatabase.MEDIA_RENAMING_TEST_PROCESS_TITLE); + Browser.getDriver().findElement(By.id(paginationTogglerId)).click(); + // get current scope value + await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(3, TimeUnit.SECONDS) + .until(Browser.getDriver().findElement(By.id(paginationScopeId))::isDisplayed); + String scope = Browser.getDriver().findElement(By.id(paginationScopeId)).getText(); + // change pagination type + await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(3, TimeUnit.SECONDS) + .until(Browser.getDriver().findElement(By.id(paginationTypeId))::isDisplayed); + Browser.getDriver().findElement(By.id(paginationTypeId)).click(); + await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(3, TimeUnit.SECONDS) + .until(Browser.getDriver().findElement(By.cssSelector(secondTypeCssSelector))::isDisplayed); + Browser.getDriver().findElement(By.cssSelector(secondTypeCssSelector)).click(); + // verify that scope value did not change + await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(3, TimeUnit.SECONDS) + .until(Browser.getDriver().findElement(By.id(paginationScopeId))::isDisplayed); + String scopeUpdated = Browser.getDriver().findElement(By.id(paginationScopeId)).getText(); + assertEquals(scope, scopeUpdated, "Pagination scope changed after changing pagination type"); + } + /** * Verifies that changing process images on file system triggers information/warning dialog. * @throws Exception when page navigation fails From cfb28dfd1edfae968c78395cf32d57b42b1a7cef Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Mon, 12 Aug 2024 10:36:43 +0200 Subject: [PATCH 2/2] Do not reset pagination scope when changing pagination type --- .../includes/metadataEditor/dialogs/pagination.xhtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/pagination.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/pagination.xhtml index aca83ac8064..bb11745793f 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/pagination.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/pagination.xhtml @@ -61,7 +61,7 @@ var="type" itemValue="#{type.key}" itemLabel="#{HelperForm.getTranslated(type.value)}"/> - +
@@ -76,7 +76,7 @@ class="input" requiredMessage="#{msgs.paginationStartValueNotSpecified}"/>
-
+