Skip to content
Merged
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
14 changes: 10 additions & 4 deletions src/org/labkey/test/tests/wiki/WikiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ public void testDeleteUndeleteAttachment() throws IOException
String wikiContent = "Lorem Ipsum something";
String fileName = "wiki_temp_file_attachment.txt";
File testAttachment = TestFileUtils.writeTempFile(fileName, "it was a dark and stormy night");
Locator wikiPageLinkLoc = Locator.linkWithText(wikiTitle);
Locator editLinkLoc = Locator.linkWithText("Edit");
Locator.XPathLocator attachmentParentLoc = Locator.id("wiki-ea-name-0");
Locator.XPathLocator removeLinkLoc = Locator.tag("td").child(Locator.linkContainingText("remove"));
Locator.XPathLocator deleteLinkLoc = Locator.tag("td").child(Locator.linkContainingText("delete"));
Expand All @@ -268,9 +270,10 @@ public void testDeleteUndeleteAttachment() throws IOException
wikiHelper.setWikiBody("<p>" + wikiContent + "</p>");
wikiHelper.saveWikiPage();
numberOfWikiCreated++;
clickAndWait(wikiPageLinkLoc);

log("adding an attachment");
wikiHelper.editWikiPage();
clickAndWait(editLinkLoc);
click(filePickerLinkLoc);
setFormElement(fileInputLoc, testAttachment);
waitForElement(removeLinkLoc); // when just attached, 'remove' will be an option but delete will not be
Expand All @@ -281,24 +284,27 @@ public void testDeleteUndeleteAttachment() throws IOException
setFormElement(fileInputLoc, testAttachment);
wikiHelper.saveWikiPage(); // save with the attachment
waitForElement(Locator.linkWithText(fileName));
clickAndWait(wikiPageLinkLoc);

log("Deleting attachment");
wikiHelper.editWikiPage();
clickAndWait(editLinkLoc);
click(deleteLinkLoc);
waitForElement(attachmentParentLoc.withAttributeContaining("style", "text-decoration: line-through"));
wikiHelper.saveWikiPage();
// verify save while in deleted state actually deletes the attachment
assertElementNotPresent(Locator.linkWithText(fileName));
clickAndWait(wikiPageLinkLoc);

log("prepare to delete/undelete attachment");
// re-attach the file and save
wikiHelper.editWikiPage();
clickAndWait(editLinkLoc);
click(filePickerLinkLoc);
setFormElement(fileInputLoc, testAttachment);
wikiHelper.saveWikiPage();
clickAndWait(wikiPageLinkLoc);

log("Un-Deleting attachment");
wikiHelper.editWikiPage();
clickAndWait(editLinkLoc);
click(deleteLinkLoc); // delete
waitForElement(attachmentParentLoc.withAttributeContaining("style", "text-decoration: line-through"));
waitAndClick(undeleteLinkLoc);
Expand Down