Skip to content

Commit

Permalink
Merge pull request kitodo#5765 from effective-webwork/fix-process-sel…
Browse files Browse the repository at this point in the history
…ection-st

Fix process selection st
  • Loading branch information
solth authored Oct 6, 2023
2 parents 115fdde + 2e0ee80 commit e107408
Showing 1 changed file with 4 additions and 39 deletions.
43 changes: 4 additions & 39 deletions Kitodo/src/test/java/org/kitodo/selenium/ProcessesSelectingST.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.sql.Date;
import java.time.LocalDate;
import java.time.ZoneId;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitodo.data.database.beans.Process;
import org.kitodo.data.database.beans.Project;
import org.kitodo.data.database.beans.Template;
import org.kitodo.data.database.beans.User;
import org.kitodo.production.services.ServiceManager;
import org.kitodo.selenium.testframework.BaseTestSelenium;
Expand All @@ -42,39 +35,11 @@ public class ProcessesSelectingST extends BaseTestSelenium {
public static void setup() throws Exception {

User user = ServiceManager.getUserService().getById(1);
user.setTableSize(2);
user.setTableSize(1);
ServiceManager.getUserService().saveToDatabase(user);
addProcesses();
processesPage = Pages.getProcessesPage();
}

private static void addProcesses() throws Exception {
Project projectOne = ServiceManager.getProjectService().getById(1);
Template template = ServiceManager.getTemplateService().getById(1);

Process forthProcess = new Process();
forthProcess.setTitle("Forth process");
LocalDate localDate = LocalDate.of(2020, 3, 20);
forthProcess.setCreationDate(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
forthProcess.setWikiField("SelectionTest");
forthProcess.setDocket(ServiceManager.getDocketService().getById(1));
forthProcess.setProject(projectOne);
forthProcess.setRuleset(ServiceManager.getRulesetService().getById(1));
forthProcess.setTemplate(template);
ServiceManager.getProcessService().save(forthProcess);

Process fifthProcess = new Process();
fifthProcess.setTitle("Fifth process");
localDate = LocalDate.of(2020, 4, 20);
fifthProcess.setCreationDate(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
fifthProcess.setWikiField("SelectionTest");
fifthProcess.setDocket(ServiceManager.getDocketService().getById(1));
fifthProcess.setProject(projectOne);
fifthProcess.setRuleset(ServiceManager.getRulesetService().getById(1));
fifthProcess.setTemplate(template);
ServiceManager.getProcessService().save(fifthProcess);
}

@Before
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
Expand All @@ -94,7 +59,7 @@ public void selectAllProcessesOnPageTest() throws Exception {
processesPage.goTo();

processesPage.selectAllRowsOnPage();
assertEquals(processesPage.countListedSelectedProcesses(), 2);
assertEquals(processesPage.countListedSelectedProcesses(), 1);

processesPage.goToNextPage();
assertEquals(processesPage.countListedSelectedProcesses(), 0);
Expand All @@ -109,9 +74,9 @@ public void selectAllProcessesTest() throws Exception {
processesPage.goTo();

processesPage.selectAllRows();
assertEquals(processesPage.countListedSelectedProcesses(), 2);
assertEquals(processesPage.countListedSelectedProcesses(), 1);

processesPage.goToNextPage();
assertEquals(processesPage.countListedSelectedProcesses(), 2);
assertEquals(processesPage.countListedSelectedProcesses(), 1);
}
}

0 comments on commit e107408

Please sign in to comment.