Skip to content

Commit

Permalink
feature/IVYPORTAL-18158-Implement-File-Preview-to-Portal-Components
Browse files Browse the repository at this point in the history
- update GUI test
  • Loading branch information
nhthinh-axonivy committed Jan 13, 2025
1 parent 84b6497 commit 3182f75
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,20 @@ public void waitForDocumentTableComponentPageLoaded() {
public int countDocuments() {
return getDocuments().size();
}

public void clickPreviewButton() {
$("[id$=':document-preview']").click();
}

public void waitForPreviewDialog() {
$("[id$=':preview-document-dialog']").shouldBe(Condition.appear, DEFAULT_TIMEOUT);
}

public boolean isPreviewContentDisplayed() {
return $("object[type='application/pdf']").shouldBe(Condition.appear, DEFAULT_TIMEOUT).isDisplayed();
}

public void closePreviewDialog() {
$("[id$=':preview-document-dialog'] .ui-dialog-titlebar-close").click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@ public void testUploadDocument() {
assertEquals(1, documentTableComponentPage.countDocuments());
}

@Test
public void testPreviewDocument() {
DocumentTableComponentPage documentTableComponentPage = new DocumentTableComponentPage();
documentTableComponentPage.uploadSampleDocument(FileHelper.getAbsolutePathToTestFile("sample-file.txt"));
refreshPage();
documentTableComponentPage.waitForDocumentTableComponentPageLoaded();
assertEquals(1, documentTableComponentPage.countDocuments());
documentTableComponentPage.clickPreviewButton();
documentTableComponentPage.waitForPreviewDialog();
assertTrue(documentTableComponentPage.isPreviewContentDisplayed());
documentTableComponentPage.closePreviewDialog();
}
}

0 comments on commit 3182f75

Please sign in to comment.