@@ -51,14 +51,14 @@ public class WikiTest extends BaseWebDriverTest
5151 private static final String PROJECT_NAME = TRICKY_CHARACTERS_FOR_PROJECT_NAMES + "WikiVerifyProject";
5252 private static final String SUBFOLDER_NAME = TRICKY_CHARACTERS_FOR_PROJECT_NAMES + "WikiVerifySubfolder";
5353 private static final String SUBFOLDER_PATH = String.format("%s/%s", PROJECT_NAME, SUBFOLDER_NAME);
54- private static final String WIKI_PAGE_ALTTITLE = "PageBBB has HTML";
54+ private static final String WIKI_PAGE_ALT_TITLE = "PageBBB has HTML";
5555 private static final String WIKI_PAGE_WEBPART_ID = "qwp999";
5656 private static final String WIKI_PAGE_TITLE = "_Test Wiki " + BaseWebDriverTest.INJECT_CHARS_1;
5757 private static final String WIKI_PAGE_NAME = "_Test Wiki Name " + BaseWebDriverTest.INJECT_CHARS_2;
5858 private static final String WIKI_PAGE_CONTENT =
59- "<b>Some HTML content</b>\n" +
60- "<b>${labkey.webPart(partName='Query', title='My Users', schemaName='core', " +
61- "queryName='Users', allowChooseQuery='true', allowChooseView='true', dataRegionName='" + WIKI_PAGE_WEBPART_ID + "')}</b>\n";
59+ "<b>Some HTML content</b>\n" +
60+ "<b>${labkey.webPart(partName='Query', title='My Users', schemaName='core', " +
61+ "queryName='Users', allowChooseQuery='true', allowChooseView='true', dataRegionName='" + WIKI_PAGE_WEBPART_ID + "')}</b>\n";
6262 private static final String WIKI_CHECK_CONTENT = "More HTML content";
6363 private static int numberOfWikiCreated = 0;
6464
@@ -133,7 +133,7 @@ public void testSteps()
133133
134134 log("test edit wiki");
135135 clickAndWait(Locator.linkWithText("Edit"));
136- setFormElement(Locator.name("title"), WIKI_PAGE_ALTTITLE );
136+ setFormElement(Locator.name("title"), WIKI_PAGE_ALT_TITLE );
137137 String wikiPageContentEdited =
138138 "<b>Some HTML content</b><br>\n" +
139139 "<b>" + WIKI_CHECK_CONTENT + "</b><br>\n";
@@ -150,21 +150,21 @@ public void testSteps()
150150 portalHelper.addWebPart("Wiki");
151151 portalHelper.clickWebpartMenuItem("Wiki", "Customize");
152152 selectOptionByText(Locator.name("webPartContainer"), "/" + getProjectName());
153- selectOptionByTextContaining(Locator.name("name").findElement(getDriver()), WIKI_PAGE_ALTTITLE );
153+ selectOptionByTextContaining(Locator.name("name").findElement(getDriver()), WIKI_PAGE_ALT_TITLE );
154154 clickButton("Submit");
155155 verifyWikiPagePresent();
156156
157157 log("test delete wiki");
158158 goToProjectHome();
159- clickAndWait(Locator.linkWithText(WIKI_PAGE_ALTTITLE ));
159+ clickAndWait(Locator.linkWithText(WIKI_PAGE_ALT_TITLE ));
160160 clickAndWait(Locator.linkWithText("Edit"));
161161 clickButton("Delete Page");
162162 clickButton("Delete");
163- assertTextNotPresent(WIKI_PAGE_ALTTITLE );
163+ assertTextNotPresent(WIKI_PAGE_ALT_TITLE );
164164
165165 log("verify second wiki part pointing to first handled delete well");
166166 clickFolder(getSubfolderName());
167- assertTextNotPresent(WIKI_PAGE_ALTTITLE );
167+ assertTextNotPresent(WIKI_PAGE_ALT_TITLE );
168168 }
169169
170170 @Test
@@ -175,10 +175,10 @@ public void testEmbeddedVideoInWiki()
175175 String wikiName = "Wiki with video";
176176 String wikiTitle = "Sample finder video";
177177 String wikiContent = """
178- Some random content start : Have fun watching video below
179- {video:%s|height:350|width:500}
180- Hope you had fun watching the video..!
181- """.formatted(videoUrl);
178+ Some random content start : Have fun watching video below
179+ {video:%s|height:350|width:500}
180+ Hope you had fun watching the video..!
181+ """.formatted(videoUrl);
182182
183183 ExternalSourcesPage.beginAt(this).ensureHost(Directive.Frame, videoHost);
184184
@@ -259,7 +259,7 @@ public void testDeleteUndeleteAttachment() throws IOException
259259 Locator undeleteLinkLoc = Locator.tag("td").child("a").child("span").containing("un-delete");
260260 Locator filePickerLinkLoc = Locator.id("filePickerLink");
261261 Locator fileInputLoc = Locator.tag("input").withAttribute("type", "file")
262- .withAttributeContaining("id", "formFile");
262+ .withAttributeContaining("id", "formFile");
263263
264264 goToProjectHome();
265265 log("Creating the wiki " + wikiTitle);
@@ -309,8 +309,9 @@ public void testDeleteUndeleteAttachment() throws IOException
309309 waitForElement(attachmentParentLoc.withAttributeContaining("style", "text-decoration: line-through"));
310310 waitAndClick(undeleteLinkLoc);
311311 checker().awaiting(Duration.ofMillis(500), ()-> Assertions.assertThat(attachmentParentLoc.findElement(getDriver()).getAttribute("style"))
312- .as("expect strikethrough style not to be present")
313- .doesNotContain("text-decoration: line-through"));
312+ .as("expect strikethrough style not to be present")
313+ .doesNotContain("text-decoration: line-through")
314+ );
314315 wikiHelper.saveWikiPage();
315316 // note: attaching the file and leaving it there will create a search result, so increment wikiCreated count here
316317 numberOfWikiCreated++;
@@ -346,24 +347,28 @@ public void testCreateWikiWithHostileNameAndTitle() throws Exception
346347 {
347348 log("Error creating wiki page: " + success.getMessage());
348349 checker().wrapAssertion(() -> Assertions.assertThat(success.getMessage())
349- .as("expect error")
350- .contains("Wiki name contains invalid characters"));
350+ .as("expect error")
351+ .contains("Wiki name contains invalid characters")
352+ );
351353 checker().verifyEquals("expect 400 for bad request", 400, success.getStatusCode());
352354 var jsonProps = new JSONObject(success.getProperties());
353355 var errors = jsonProps.getJSONArray("errors");
354356
355357 checker().wrapAssertion(() -> Assertions.assertThat(List.of(errors.getJSONObject(0), errors.getJSONObject(1)))
356- .extracting(a -> a.get("msg"))
357- .as("expect warnings for wiki name and title")
358- .containsOnly("Wiki name contains invalid characters.", "Wiki title contains invalid characters."));
358+ .extracting(a -> a.get("msg"))
359+ .as("expect warnings for wiki name and title")
360+ .containsOnly("Wiki name contains invalid characters.", "Wiki title contains invalid characters.")
361+ );
359362 checker().wrapAssertion(() -> Assertions.assertThat(List.of(errors.getJSONObject(0), errors.getJSONObject(1)))
360- .extracting(a -> a.get("severity"))
361- .as("expect error severity")
362- .containsOnly("Error"));
363+ .extracting(a -> a.get("severity"))
364+ .as("expect error severity")
365+ .containsOnly("Error")
366+ );
363367 checker().wrapAssertion(() -> Assertions.assertThat(List.of(errors.getJSONObject(0), errors.getJSONObject(1)))
364- .extracting(a -> a.get("field"))
365- .as("expect errors for name, title")
366- .containsOnly("name", "title"));
368+ .extracting(a -> a.get("field"))
369+ .as("expect errors for name, title")
370+ .containsOnly("name", "title")
371+ );
367372 }
368373 }
369374
@@ -408,24 +413,28 @@ public void testUpdateWikiWithHostileNameAndTitle() throws Exception
408413 } catch (CommandException success)
409414 {
410415 checker().wrapAssertion(()-> Assertions.assertThat(success.getMessage())
411- .as("expect error")
412- .contains("Wiki title contains invalid characters"));
416+ .as("expect error")
417+ .contains("Wiki title contains invalid characters")
418+ );
413419 checker().verifyEquals("expect 400 for bad request", 400, success.getStatusCode());
414420 var jsonProps =new JSONObject(success.getProperties());
415421 var error = jsonProps.getJSONArray("errors").getJSONObject(0);
416422
417423 checker().wrapAssertion(()-> Assertions.assertThat(error)
418- .extracting(a-> a.get("msg"))
419- .as("expect warning for wiki title")
420- .isEqualTo("Wiki title contains invalid characters."));
424+ .extracting(a-> a.get("msg"))
425+ .as("expect warning for wiki title")
426+ .isEqualTo("Wiki title contains invalid characters.")
427+ );
421428 checker().wrapAssertion(()-> Assertions.assertThat(error)
422- .extracting(a-> a.get("severity"))
423- .as("expect error severity")
424- .isEqualTo("Error"));
429+ .extracting(a-> a.get("severity"))
430+ .as("expect error severity")
431+ .isEqualTo("Error")
432+ );
425433 checker().wrapAssertion(()-> Assertions.assertThat(error)
426- .extracting(a-> a.get("field"))
427- .as("expect title field to be the source of the error")
428- .isEqualTo("title"));
434+ .extracting(a-> a.get("field"))
435+ .as("expect title field to be the source of the error")
436+ .isEqualTo("title")
437+ );
429438 }
430439 }
431440
@@ -456,46 +465,49 @@ public void testRenameWebPartWiki() throws Exception
456465 var wikiHelper = new WikiHelper(this);
457466 new PortalHelper(this).addWebPart("Wiki");
458467 Locator wikiWebPartLoc = Locator.tagWithClass("div", "panel-portal")
459- .withDescendant(Locator.tagWithAttribute("h3", "title", wikiTitle))
460- .descendant(Locator.tagWithText("p", "content for wiki webpart rename"));
468+ .withDescendant(Locator.tagWithAttribute("h3", "title", wikiTitle))
469+ .descendant(Locator.tagWithText("p", "content for wiki webpart rename"));
461470
462471 // configure the webPart to use the wiki created above
463472 wikiHelper.clickChooseAPage();
464473 var selectedPageOption = getSelectedOptionText(Locator.name("name"));
465474 checker().withScreenshot("unexpected_selected_page")
466- .wrapAssertion(()-> Assertions.assertThat(selectedPageOption)
467- .as("expect our wiki to be selected")
468- .startsWith(wikiName));
475+ .wrapAssertion(()-> Assertions.assertThat(selectedPageOption)
476+ .as("expect our wiki to be selected")
477+ .startsWith(wikiName)
478+ );
469479 wikiHelper.saveChosenPage();
470480
471481 // verify the webpart's content is our expected content
472482 checker().withScreenshot("unexpected_wiki_content")
473- .awaiting(Duration.ofSeconds(1), ()-> Assertions.assertThat(wikiWebPartLoc.existsIn(getDriver()))
474- .as("expect our wiki content to be present")
475- .isTrue());
483+ .awaiting(Duration.ofSeconds(1), ()-> Assertions.assertThat(wikiWebPartLoc.existsIn(getDriver()))
484+ .as("expect our wiki content to be present")
485+ .isTrue()
486+ );
476487
477488 // Now edit the wiki, give it a new name, with an alias
478489 var wikiConfigPage = wikiHelper.manageWikiConfiguration();
479490 wikiConfigPage.rename("webPartNewWikiName", true)
480- .save();
491+ .save();
481492
482493 // verify the expected content is still present
483494 checker().withScreenshot("unexpected_wiki_content_after_rename")
484- .awaiting(Duration.ofSeconds(1), ()-> Assertions.assertThat(wikiWebPartLoc.existsIn(getDriver()))
485- .as("expect our wiki content to be present")
486- .isTrue());
495+ .awaiting(Duration.ofSeconds(1), ()-> Assertions.assertThat(wikiWebPartLoc.existsIn(getDriver()))
496+ .as("expect our wiki content to be present")
497+ .isTrue()
498+ );
487499 }
488500
489501 protected void verifyWikiPagePresent()
490502 {
491503 waitForText(WIKI_CHECK_CONTENT);
492- assertTextPresent(WIKI_PAGE_ALTTITLE );
504+ assertTextPresent(WIKI_PAGE_ALT_TITLE );
493505 }
494506
495507 protected void doTestInlineEditor()
496508 {
497509 Locator.XPathLocator inlineEditor = Locator.xpath("//div[@class='labkey-inline-editor']")
498- .withDescendant(Locator.tagWithClassContaining("div", "tox-edit-area"));
510+ .withDescendant(Locator.tagWithClassContaining("div", "tox-edit-area"));
499511
500512 log("** test inline wiki webpart editor");
501513 goToProjectHome();
@@ -542,12 +554,13 @@ protected void doTestInlineEditor()
542554
543555 protected void setInlineEditorContent(String editorId, String content)
544556 {
545- executeScript("if (!tinymce) {throw 'tinymce API is not available'}" +
546- "editor = tinymce.get(arguments[0]);" +
547- "if (!editor) {throw 'No tinymce instance: ' + arguments[0];}" +
548- "editor.setContent(arguments[1]);" +
549- "editor.setDirty(true);" // Explicitly setDirty as the setContent doesn't by default
550- , editorId, content);
557+ executeScript(
558+ "if (!tinymce) {throw 'tinymce API is not available'}" +
559+ "editor = tinymce.get(arguments[0]);" +
560+ "if (!editor) {throw 'No tinymce instance: ' + arguments[0];}" +
561+ "editor.setContent(arguments[1]);" +
562+ "editor.setDirty(true);" // Explicitly setDirty as the setContent doesn't by default
563+ , editorId, content);
551564 log(String.format("Content [%1$s] set on editor: %2$s", content, editorId));
552565 }
553566
0 commit comments