Skip to content

Commit

Permalink
Fix Selenium test
Browse files Browse the repository at this point in the history
  • Loading branch information
solth committed Feb 8, 2023
1 parent b4655ee commit 473ebb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void hideStructureDataTest() throws Exception {
Pages.getLoginPage().goTo().performLogin(metadataUser);
Pages.getProcessesPage().goTo().editSecondProcessMetadata();
Assert.assertFalse(Pages.getMetadataEditorPage().isStructureTreeFormVisible());
Pages.getMetadataEditorPage().closeEditor();
}

/**
Expand All @@ -94,6 +95,7 @@ public void changeProcessLinkOrderTest() throws Exception {
Pages.getMetadataEditorPage().getNameOfFirstLinkedChildProcess().endsWith(SECOND_CHILD_PROCESS_TITLE));
Assert.assertTrue("Wrong resulting order of linked child processes",
Pages.getMetadataEditorPage().getNameOfSecondLinkedChildProcess().endsWith(FIRST_CHILD_PROCESS_TITLE));
Pages.getMetadataEditorPage().closeEditor();
cleanup();
}

Expand All @@ -102,9 +104,12 @@ public void changeProcessLinkOrderTest() throws Exception {
*/
@Test
public void totalNumberOfScansTest() throws Exception {
User metadataUser = ServiceManager.getUserService().getByLogin("kowal");
Pages.getLoginPage().goTo().performLogin(metadataUser);
Pages.getProcessesPage().goTo().editSecondProcessMetadata();
assertEquals("Total number of scans is not correct", "(Anzahl von Scans: 1)",
Pages.getMetadataEditorPage().getNumberOfScans());
Pages.getMetadataEditorPage().closeEditor();
}

/**
Expand All @@ -113,11 +118,14 @@ public void totalNumberOfScansTest() throws Exception {
*/
@Test
public void showPaginationByDefaultTest() throws Exception {
User metadataUser = ServiceManager.getUserService().getByLogin("kowal");
Pages.getLoginPage().goTo().performLogin(metadataUser);
Pages.getProcessesPage().goTo().editSecondProcessMetadata();
assertFalse(Pages.getMetadataEditorPage().isPaginationPanelVisible());
Pages.getUserEditPage().setPaginationToShowByDefault();
Pages.getProcessesPage().goTo().editSecondProcessMetadata();
assertTrue(Pages.getMetadataEditorPage().isPaginationPanelVisible());
Pages.getMetadataEditorPage().closeEditor();
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class MetadataEditorPage extends Page<MetadataEditorPage> {
@FindBy(id = "saveExit")
private WebElement saveAndExitButton;

@FindBy(id = "close")
private WebElement closeButton;

public MetadataEditorPage() {
super("metadataEditor.jsf");
}
Expand Down Expand Up @@ -98,4 +101,11 @@ public String getNameOfFirstLinkedChildProcess() {
public String getNameOfSecondLinkedChildProcess() {
return secondChildProcess.getText();
}

/**
* Close Metadata editor to release metadata lock.
*/
public void closeEditor() {
closeButton.click();
}
}

0 comments on commit 473ebb2

Please sign in to comment.