From e07619348146ce29419e7190919523ef01d40a3a Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Mon, 15 Sep 2025 15:34:32 -0700 Subject: [PATCH 1/8] Export full search index as text --- .../labkey/test/tests/search/SearchTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 48423dbc326..e6e44ae568c 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -41,9 +41,11 @@ import org.labkey.test.util.Maps; import org.labkey.test.util.PortalHelper; import org.labkey.test.util.SearchHelper; +import org.labkey.test.util.TextSearcher; import org.labkey.test.util.WikiHelper; import org.labkey.test.util.search.SearchAdminAPIHelper; import org.labkey.test.util.search.SearchResultsQueue; +import org.openqa.selenium.support.ui.ExpectedConditions; import java.io.File; import java.io.IOException; @@ -234,6 +236,7 @@ protected void doVerifySteps() renameFolderAndReSearch(); moveFolderAlterListsAndReSearch(); deleteFolderAndVerifyNoResults(); + exportSearchIndexAndVerifyResults(); } @LogMethod @@ -457,6 +460,22 @@ private void deleteFolderAndVerifyNoResults() _searchHelper.verifyNoSearchResults(); } + @LogMethod + private void exportSearchIndexAndVerifyResults() + { + goToAdminConsole() + .clickFullTextSearch(); + clickAndWait(Locator.linkWithText("Export index contents")); + Locator exportTxtBtnLoc = Locator.tagWithClass("a", "labkey-button").withText("Export to Text"); + shortWait().until(ExpectedConditions.elementToBeClickable(exportTxtBtnLoc)); + var indexFile = clickAndWaitForDownload(exportTxtBtnLoc); + + TextSearcher tsvSearcher = new TextSearcher(indexFile); + assertTextPresent(tsvSearcher, "Panda", "Black Bear", "Owlbear", "BoarQPine", "Folder Apple", "pdf_sample.pdf", + "docx_sample.docx", "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", + "12345", "Urinalysis"); + } + @Override public void runApiTests() { From 6c3c34ca62efae2425590995a99eba727a00e0e3 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Mon, 15 Sep 2025 16:10:22 -0700 Subject: [PATCH 2/8] verify index has at least 2k lines --- .../labkey/test/tests/search/SearchTest.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index e6e44ae568c..9f05daf5d37 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -57,6 +57,7 @@ import java.util.Map; import java.util.Set; +import static org.labkey.test.TestFileUtils.getFileRowCount; import static org.labkey.test.util.PermissionsHelper.MemberType.group; import static org.labkey.test.util.SearchHelper.getUnsearchableValue; @@ -178,7 +179,7 @@ private Set getSearchResultsProjects(String q) throws IOException, Comma } @Test - public void testSearch() + public void testSearch() throws IOException, CommandException { SearchAdminAPIHelper.setDirectoryType(directoryType(), getDriver()); doCreateSteps(); @@ -228,14 +229,14 @@ private void addSearchableLists() @Override @LogMethod - protected void doVerifySteps() + protected void doVerifySteps() throws IOException, CommandException { _searchHelper.verifySearchResults("/" + getProjectName() + "/" + getFolderName()); testAdvancedSearchScope(); testAdvancedSearchCategoryFilters(); - renameFolderAndReSearch(); - moveFolderAlterListsAndReSearch(); - deleteFolderAndVerifyNoResults(); +// renameFolderAndReSearch(); +// moveFolderAlterListsAndReSearch(); +// deleteFolderAndVerifyNoResults(); exportSearchIndexAndVerifyResults(); } @@ -461,7 +462,7 @@ private void deleteFolderAndVerifyNoResults() } @LogMethod - private void exportSearchIndexAndVerifyResults() + private void exportSearchIndexAndVerifyResults() throws IOException { goToAdminConsole() .clickFullTextSearch(); @@ -471,9 +472,14 @@ private void exportSearchIndexAndVerifyResults() var indexFile = clickAndWaitForDownload(exportTxtBtnLoc); TextSearcher tsvSearcher = new TextSearcher(indexFile); - assertTextPresent(tsvSearcher, "Panda", "Black Bear", "Owlbear", "BoarQPine", "Folder Apple", "pdf_sample.pdf", + assertTextPresent(tsvSearcher, "Panda", "Black Bear", "Owlbear", "BoarQPine", "Folder Apple", "pdf_sample.pdf", "docx_sample.docx", "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", "12345", "Urinalysis"); + int fileRowCount = getFileRowCount(indexFile); + checker().wrapAssertion(() -> Assertions.assertThat(fileRowCount) + .as("expect minimum 2000 rows") + .isGreaterThan(2000)); + } @Override From 7cee042fa6720edfd2a0128db248e4198aa7be1d Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Mon, 15 Sep 2025 16:23:50 -0700 Subject: [PATCH 3/8] undo comment --- study/test/src/org/labkey/test/tests/search/SearchTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 9f05daf5d37..561945c3cfc 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -234,9 +234,9 @@ protected void doVerifySteps() throws IOException, CommandException _searchHelper.verifySearchResults("/" + getProjectName() + "/" + getFolderName()); testAdvancedSearchScope(); testAdvancedSearchCategoryFilters(); -// renameFolderAndReSearch(); -// moveFolderAlterListsAndReSearch(); -// deleteFolderAndVerifyNoResults(); + renameFolderAndReSearch(); + moveFolderAlterListsAndReSearch(); + deleteFolderAndVerifyNoResults(); exportSearchIndexAndVerifyResults(); } From d95ad19f7d0000c572a7261f57d36dc5f1ac9109 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Tue, 16 Sep 2025 11:34:33 -0700 Subject: [PATCH 4/8] reorder export to occur before folder delete --- study/test/src/org/labkey/test/tests/search/SearchTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 561945c3cfc..633ff525b63 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -236,8 +236,8 @@ protected void doVerifySteps() throws IOException, CommandException testAdvancedSearchCategoryFilters(); renameFolderAndReSearch(); moveFolderAlterListsAndReSearch(); - deleteFolderAndVerifyNoResults(); exportSearchIndexAndVerifyResults(); + deleteFolderAndVerifyNoResults(); } @LogMethod From 73c414bead9c3a08e8af9f48b12430f79aea1b1f Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Tue, 16 Sep 2025 13:35:44 -0700 Subject: [PATCH 5/8] Take out texts that aren't reliable --- study/test/src/org/labkey/test/tests/search/SearchTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 633ff525b63..1dff04ffa5f 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -472,9 +472,9 @@ private void exportSearchIndexAndVerifyResults() throws IOException var indexFile = clickAndWaitForDownload(exportTxtBtnLoc); TextSearcher tsvSearcher = new TextSearcher(indexFile); - assertTextPresent(tsvSearcher, "Panda", "Black Bear", "Owlbear", "BoarQPine", "Folder Apple", "pdf_sample.pdf", - "docx_sample.docx", "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", - "12345", "Urinalysis"); + assertTextPresent(tsvSearcher, "Black Bear", "Owlbear","pdf_sample.pdf", "docx_sample.docx", + "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", + "Urinalysis"); int fileRowCount = getFileRowCount(indexFile); checker().wrapAssertion(() -> Assertions.assertThat(fileRowCount) .as("expect minimum 2000 rows") From 63e4f8ccdd02d47787e23375c3d3bdce85ef0ea7 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Wed, 17 Sep 2025 10:55:01 -0700 Subject: [PATCH 6/8] assert minimum 300 rows in index --- study/test/src/org/labkey/test/tests/search/SearchTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 1dff04ffa5f..827724d5125 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -477,8 +477,8 @@ private void exportSearchIndexAndVerifyResults() throws IOException "Urinalysis"); int fileRowCount = getFileRowCount(indexFile); checker().wrapAssertion(() -> Assertions.assertThat(fileRowCount) - .as("expect minimum 2000 rows") - .isGreaterThan(2000)); + .as("expect minimum 300 rows") + .isGreaterThan(300)); } From 7e83f66bf6a65d1db8fa16c61a64111e6c003bb4 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Wed, 17 Sep 2025 15:18:53 -0700 Subject: [PATCH 7/8] cr feedback --- study/test/src/org/labkey/test/tests/search/SearchTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 827724d5125..4cdf3deb6f6 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -472,7 +472,7 @@ private void exportSearchIndexAndVerifyResults() throws IOException var indexFile = clickAndWaitForDownload(exportTxtBtnLoc); TextSearcher tsvSearcher = new TextSearcher(indexFile); - assertTextPresent(tsvSearcher, "Black Bear", "Owlbear","pdf_sample.pdf", "docx_sample.docx", + assertTextPresent(tsvSearcher, "CPS-1: Screening Chemistry Panel", "Black Bear", "Owlbear","pdf_sample.pdf", "docx_sample.docx", "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", "Urinalysis"); int fileRowCount = getFileRowCount(indexFile); From 205564f76dd090bc7d594f87f8155607a99d68ed Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Wed, 17 Sep 2025 15:22:34 -0700 Subject: [PATCH 8/8] missed changes --- .../test/src/org/labkey/test/tests/search/SearchTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/study/test/src/org/labkey/test/tests/search/SearchTest.java b/study/test/src/org/labkey/test/tests/search/SearchTest.java index 4cdf3deb6f6..d5b1e4c5d5b 100644 --- a/study/test/src/org/labkey/test/tests/search/SearchTest.java +++ b/study/test/src/org/labkey/test/tests/search/SearchTest.java @@ -179,7 +179,7 @@ private Set getSearchResultsProjects(String q) throws IOException, Comma } @Test - public void testSearch() throws IOException, CommandException + public void testSearch() throws IOException { SearchAdminAPIHelper.setDirectoryType(directoryType(), getDriver()); doCreateSteps(); @@ -229,7 +229,7 @@ private void addSearchableLists() @Override @LogMethod - protected void doVerifySteps() throws IOException, CommandException + protected void doVerifySteps() throws IOException { _searchHelper.verifySearchResults("/" + getProjectName() + "/" + getFolderName()); testAdvancedSearchScope(); @@ -474,8 +474,8 @@ private void exportSearchIndexAndVerifyResults() throws IOException TextSearcher tsvSearcher = new TextSearcher(indexFile); assertTextPresent(tsvSearcher, "CPS-1: Screening Chemistry Panel", "Black Bear", "Owlbear","pdf_sample.pdf", "docx_sample.docx", "InlineFile.html", "verifyAssay", "Roquefort", "Brie", "Study 001", "Folder Banana", "Sample", - "Urinalysis"); - int fileRowCount = getFileRowCount(indexFile); + "Urinalysis", "EVC-1: Enrollment Vaccination", "SIL-1: Social Impact Log"); + var fileRowCount = getFileRowCount(indexFile); checker().wrapAssertion(() -> Assertions.assertThat(fileRowCount) .as("expect minimum 300 rows") .isGreaterThan(300));