From bf3edcfc94fad921155670bf232c815ed5666506 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Tue, 30 Sep 2025 12:31:45 -0700 Subject: [PATCH] update test to function as expected when run after other tests --- src/org/labkey/test/tests/wiki/WikiTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/org/labkey/test/tests/wiki/WikiTest.java b/src/org/labkey/test/tests/wiki/WikiTest.java index 0d79a49bf1..25f63450bc 100644 --- a/src/org/labkey/test/tests/wiki/WikiTest.java +++ b/src/org/labkey/test/tests/wiki/WikiTest.java @@ -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")); @@ -268,9 +270,10 @@ public void testDeleteUndeleteAttachment() throws IOException wikiHelper.setWikiBody("

" + wikiContent + "

"); 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 @@ -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);