Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.8] Keep pagination scope when changing pagination type #6404

Open
wants to merge 2 commits into
base: 3.8.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
var="type"
itemValue="#{type.key}"
itemLabel="#{HelperForm.getTranslated(type.value)}"/>
<p:ajax event="itemSelect" update="paginationForm:paginationWrapperPanel"/>
<p:ajax event="itemSelect" update="paginationForm:advandedPaginationControls"/>
</p:selectOneMenu>
</div>
<div>
Expand All @@ -76,7 +76,7 @@
class="input"
requiredMessage="#{msgs.paginationStartValueNotSpecified}"/>
</div>
<div>
<h:panelGroup layout="block" id="advandedPaginationControls">
<!-- Advanced pagination -->
<script type="text/javascript">
function writeToPaginationStartValue(before, after) {
Expand Down Expand Up @@ -158,7 +158,7 @@
title="#{msgs.paginationVersoUseHint}"
onclick="return writeToPaginationStartValue('\277','')"
/>
</div>
</h:panelGroup>
<div>
<p:outputLabel value="#{msgs.paginationScope}:"
for="selectPaginationScope"/>
Expand Down
31 changes: 31 additions & 0 deletions Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down