From 985e48cc4c8b698db0d66965345c990a2507cf67 Mon Sep 17 00:00:00 2001 From: Karl Lum Date: Fri, 24 May 2024 15:12:26 -0700 Subject: [PATCH] Consolidate curated group workflows (#652) --- .../cds/view/template/ConnectorTemplate.jsp | 1 + .../components/cds/ActiveFilterDialog.java | 3 +- .../test/pages/cds/GroupDetailsPage.java | 2 +- .../labkey/test/pages/cds/MAbDataGrid.java | 2 +- .../test/tests/cds/CDSGroupBaseTest.java | 8 +- .../labkey/test/tests/cds/CDSGroupTest.java | 2 - .../org/labkey/test/tests/cds/CDSMAbTest.java | 36 +- .../test/tests/cds/CDSStudyTooltipTest.java | 13 +- .../org/labkey/test/util/cds/CDSHelper.java | 63 +- theme/connector/panel/_FilterPanel.scss | 6 +- webapp/Connector/extapp.lib.xml | 1 + webapp/Connector/src/app/view/Group.js | 14 +- webapp/Connector/src/controller/Group.js | 495 ++++------ .../src/view/AbstractFilterStatus.js | 150 +++ webapp/Connector/src/view/FilterStatus.js | 171 +--- webapp/Connector/src/view/GroupSave.js | 911 +++--------------- webapp/Connector/src/view/GroupSummary.js | 8 +- webapp/Connector/src/view/MabStatus.js | 168 +++- 18 files changed, 695 insertions(+), 1359 deletions(-) create mode 100644 webapp/Connector/src/view/AbstractFilterStatus.js diff --git a/src/org/labkey/cds/view/template/ConnectorTemplate.jsp b/src/org/labkey/cds/view/template/ConnectorTemplate.jsp index bd31a8316..898b2d46b 100644 --- a/src/org/labkey/cds/view/template/ConnectorTemplate.jsp +++ b/src/org/labkey/cds/view/template/ConnectorTemplate.jsp @@ -247,6 +247,7 @@ // Application Views srcPath + "/view/Selection.js", srcPath + "/view/DetailStatus.js", + srcPath + "/view/AbstractFilterStatus.js", srcPath + "/view/FilterStatus.js", srcPath + "/view/InfoPane.js", srcPath + "/view/GridPane.js", diff --git a/test/src/org/labkey/test/components/cds/ActiveFilterDialog.java b/test/src/org/labkey/test/components/cds/ActiveFilterDialog.java index 70c98eb3f..ef42cb90a 100644 --- a/test/src/org/labkey/test/components/cds/ActiveFilterDialog.java +++ b/test/src/org/labkey/test/components/cds/ActiveFilterDialog.java @@ -151,6 +151,7 @@ public class ElementCache extends Component.ElementCache final Locator errorMsg = Locator.tagWithClass("div", "errormsg"); Input groupName = new Input(Locator.name("groupname").findWhenNeeded(_activeFilterDialogEl), getDriver()); Input groupDescription = new Input(Locator.textarea("groupdescription").findWhenNeeded(_activeFilterDialogEl), getDriver()); - Checkbox sharedGroup = new Checkbox(Locator.xpath("//input[contains(@id,'creategroupshared')]").findWhenNeeded(getDriver())); + Checkbox sharedGroup = new Checkbox(Locator.xpath("//table[contains(@class, 'group-shared-checkbox')]/descendant::input[contains(@type, 'button')]") + .findWhenNeeded(getDriver())); } } diff --git a/test/src/org/labkey/test/pages/cds/GroupDetailsPage.java b/test/src/org/labkey/test/pages/cds/GroupDetailsPage.java index cf050ab83..ab0068a52 100644 --- a/test/src/org/labkey/test/pages/cds/GroupDetailsPage.java +++ b/test/src/org/labkey/test/pages/cds/GroupDetailsPage.java @@ -70,7 +70,7 @@ protected GroupDetailsPage.ElementCache newElementCache() protected class ElementCache extends LabKeyPage.ElementCache { private final WebElement groupName = Locator.tagWithClass("div", "studyname").refindWhenNeeded(this); - private final WebElement groupDesc = Locator.tagWithId("table", "group-description-id").refindWhenNeeded(this); + private final WebElement groupDesc = Locator.tagWithClass("table", "group-description").refindWhenNeeded(this); private final Locator.XPathLocator groupModuleGrid = Locator.tagWithClassContaining("div", "groupslearnmodulegrid"); private final WebElement editDetails = Locator.linkWithText("Edit details").findWhenNeeded(this); diff --git a/test/src/org/labkey/test/pages/cds/MAbDataGrid.java b/test/src/org/labkey/test/pages/cds/MAbDataGrid.java index fc1a3b763..bc5d144f7 100644 --- a/test/src/org/labkey/test/pages/cds/MAbDataGrid.java +++ b/test/src/org/labkey/test/pages/cds/MAbDataGrid.java @@ -154,7 +154,7 @@ public boolean isCheckAllPresent() public void clearAllFilters() { - Optional clearAllFilterBtn = CDSHelper.Locators.cdsButtonLocator("clear", "mabfilterclear").findOptionalElement(getDriver()); + Optional clearAllFilterBtn = CDSHelper.Locators.cdsButtonLocator("clear", "filter-clear-btn").findOptionalElement(getDriver()); clearAllFilterBtn.ifPresent(webElement -> elementCache().mabGrid.doAndWaitForRowUpdate(webElement::click)); Locator.tagWithClass("div", "filtered-column").waitForElementToDisappear(this, WAIT_FOR_PAGE); diff --git a/test/src/org/labkey/test/tests/cds/CDSGroupBaseTest.java b/test/src/org/labkey/test/tests/cds/CDSGroupBaseTest.java index 25d4da44a..4e03fa40d 100644 --- a/test/src/org/labkey/test/tests/cds/CDSGroupBaseTest.java +++ b/test/src/org/labkey/test/tests/cds/CDSGroupBaseTest.java @@ -67,9 +67,9 @@ public void verifySharedGroups() //Create a group. _composeGroup(); //saveGroup verifies that the shared group checkbox is not present. - boolean result = cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], true, false, isMab()); + boolean result = cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], true, false); assertFalse("Updating shared status of " + (isMab() ? "mab " : "") + "group should fail.", result); - result = cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], false, false, isMab()); + result = cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], false, false); assertTrue("Failed to update " + (isMab() ? "mab " : "") + "group", result); cds.goToAppHome(); cds.deleteGroupFromSummaryPage(privateGroupOneName); @@ -77,7 +77,7 @@ public void verifySharedGroups() _impersonateRole("Editor"); _composeGroup(); - result = cds.saveGroup(privateGroupTwoName, PRIVATE_GROUP_NAME_DESCRIPTION[1], true, false, isMab()); + result = cds.saveGroup(privateGroupTwoName, PRIVATE_GROUP_NAME_DESCRIPTION[1], true, false); assertTrue("Failed to create new shared " + (isMab() ? "mab " : "") + "group as Editor.", result); cds.goToAppHome(); cds.deleteGroupFromSummaryPage(privateGroupTwoName); @@ -111,7 +111,7 @@ public void verifySharedGroups() //As an editor, make a shared group and a private group _impersonateUser(NEW_USER_ACCOUNTS[0]); _composeGroup(); - cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], false, false, isMab()); + cds.saveGroup(privateGroupOneName, PRIVATE_GROUP_NAME_DESCRIPTION[0], false, false); // TODO: Fix/Update with the new Active filters workflow -- Use 'Edit group', update the group name with sharedGroupName, make it shared > Save menu > Update this group // cds.saveGroup(sharedGroupName, "", true, false, isMab()); diff --git a/test/src/org/labkey/test/tests/cds/CDSGroupTest.java b/test/src/org/labkey/test/tests/cds/CDSGroupTest.java index 633acd468..e55f875ec 100644 --- a/test/src/org/labkey/test/tests/cds/CDSGroupTest.java +++ b/test/src/org/labkey/test/tests/cds/CDSGroupTest.java @@ -228,7 +228,6 @@ public void testSaveAsNewGroup() detailsPage.deleteGroup(); cds.viewLearnAboutPage(LearnTab.GROUPS); - refresh(); Assert.assertFalse("Deleted group is still present " + ASSAY_GROUP_NAME, isElementPresent(Locator.tagWithText("h2", ASSAY_GROUP_NAME))); } @@ -282,7 +281,6 @@ public void verifyApplyingGroups() .saveGroup(); log("Verifying Multi filter group"); - refresh(); cds.viewLearnAboutPage(LearnTab.GROUPS); click(Locator.tagWithText("h2", multiFilterGroup)); detailsPage = new GroupDetailsPage(getDriver()); diff --git a/test/src/org/labkey/test/tests/cds/CDSMAbTest.java b/test/src/org/labkey/test/tests/cds/CDSMAbTest.java index be526c091..648f660a0 100644 --- a/test/src/org/labkey/test/tests/cds/CDSMAbTest.java +++ b/test/src/org/labkey/test/tests/cds/CDSMAbTest.java @@ -545,6 +545,7 @@ public void testMabInfoPane() ip.clickClose(); ip.clickMabStudiesCount(); + CDSStudyTooltipTest.dismissTooltip(this); log("Check Studies list."); expectedHasDataInMAbGrid = new ArrayList<>(); @@ -638,6 +639,7 @@ public void testMabInfoPane() ip.clickClose(); ip.clickMabStudiesCount(); + CDSStudyTooltipTest.dismissTooltip(this); log("Check Studies list."); expectedHasDataInMAbGrid = new ArrayList<>(); @@ -906,17 +908,16 @@ public void verifyMabAndSubjectGroups() log("Compose a shared and a private mab group"); _composeGroup(); - cds.saveGroup(mabPrivateGroup, null, false, true, true); + cds.saveGroup(mabPrivateGroup, null, false, true); CDSHelper.NavigationLink.MABGRID.makeNavigationSelection(this); MAbDataGrid grid = new MAbDataGrid(this); grid.clearAllFilters(); grid.setFacet(MAB_COL,false,"2F5", "A14"); - cds.saveGroup(mabPublicGroup, null, true, true, true); + cds.saveGroup(mabPublicGroup, null, true, true); log("Verify mAb and subject groups listing"); cds.goToAppHome(); - refresh(); //TODO: Newly saved groups should be available without refresh, this is a bug that needs to be fixed. waitForText("My saved groups and plots", "Curated groups and plots"); if (isElementPresent(CDSHelper.Locators.getPrivateGroupLoc(subjectPrivateGroup)) && isElementPresent(CDSHelper.Locators.getSharedGroupLoc(mabPublicGroup))) @@ -958,34 +959,5 @@ public void verifyMabAndSubjectGroups() grid = new MAbDataGrid(this); Assert.assertTrue(MAB_COL + " should have been filtered", grid.isColumnFiltered(MAB_COL)); Assert.assertFalse(STUDIES_COL + " should not have been filtered", grid.isColumnFiltered(STUDIES_COL)); - - log("Replace a mab group"); - grid.clearAllFilters(); - grid.setFacet(SPECIES_COL,false,"llama"); - waitAndClick(CDSHelper.Locators.cdsButtonLocator("save", "mabfiltersave")); - waitAndClick(CDSHelper.Locators.cdsButtonLocator("replace an existing group")); - - log("Verify mab filter can only replace existing mab groups"); - Locator.XPathLocator listGroup = Locator.tagWithClass("div", "save-label"); - waitForElement(listGroup.withText(mabPrivateGroup)); - waitForElement(listGroup.withText(mabPublicGroup)); - Locator badList = listGroup.withText(subjectPublicGroup); - Assert.assertFalse("Subject fitler shouldn't be listed for mab replace", isElementPresent(badList)); - waitAndClick(listGroup.withText(mabPublicGroup)); - click(CDSHelper.Locators.cdsButtonLocator("Save", "groupupdatesave")); - - log("Verify replaced mab group"); - grid.clearAllFilters(); - cds.goToAppHome(); - sleep(2000); - click(CDSHelper.Locators.getSharedGroupLoc(mabPublicGroup)); - sleep(2000); - CDSHelper.NavigationLink.MABGRID.makeNavigationSelection(this); - grid = new MAbDataGrid(this); - - Assert.assertTrue(SPECIES_COL + " should have been filtered", grid.isColumnFiltered(SPECIES_COL)); - Assert.assertFalse(MAB_COL + " should not have been filtered", grid.isColumnFiltered(MAB_COL)); - Assert.assertFalse(STUDIES_COL + " should not have been filtered", grid.isColumnFiltered(STUDIES_COL)); } - } diff --git a/test/src/org/labkey/test/tests/cds/CDSStudyTooltipTest.java b/test/src/org/labkey/test/tests/cds/CDSStudyTooltipTest.java index 0b9d43e66..b6f75044c 100644 --- a/test/src/org/labkey/test/tests/cds/CDSStudyTooltipTest.java +++ b/test/src/org/labkey/test/tests/cds/CDSStudyTooltipTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.labkey.test.Locator; +import org.labkey.test.WebDriverWrapper; import org.labkey.test.pages.cds.DataGrid; import org.labkey.test.pages.cds.LearnGrid; import org.labkey.test.pages.cds.LearnGrid.LearnTab; @@ -133,13 +134,13 @@ public void validateToolTip(WebElement el, String toolTipExpected) .ifPresent(WebElement::click); // Move the mouse off of the element that shows the tool tip, and then wait for the tool tip to disappear. - dismissTooltip(); + dismissTooltip(this); } private String triggerToolTip(WebElement el) { // Move the mouse to the top left corner of the page and make sure there are no popups visible. - dismissTooltip(); + dismissTooltip(this); return waitFor(() -> { // Move the mouse over the element. @@ -157,11 +158,11 @@ private String triggerToolTip(WebElement el) }, 2_000); } - public void dismissTooltip() + public static void dismissTooltip(WebDriverWrapper webDriver) { - shortWait().withMessage("Failed to dismiss tooltip").until(wd -> { - mouseOver(Locator.xpath(CDSHelper.LOGO_IMG_XPATH)); - WebElement bubble = Locator.css(".hopscotch-bubble").findWhenNeeded(getDriver()); + webDriver.shortWait().withMessage("Failed to dismiss tooltip").until(wd -> { + webDriver.mouseOver(Locator.xpath(CDSHelper.LOGO_IMG_XPATH)); + WebElement bubble = Locator.css(".hopscotch-bubble").findWhenNeeded(webDriver.getDriver()); return !bubble.isDisplayed() || bubble.getLocation().getY() <= 0; // Hidden, non-existent, or in the corner will suffice }); } diff --git a/test/src/org/labkey/test/util/cds/CDSHelper.java b/test/src/org/labkey/test/util/cds/CDSHelper.java index 7d199abaf..e5d04d4e1 100644 --- a/test/src/org/labkey/test/util/cds/CDSHelper.java +++ b/test/src/org/labkey/test/util/cds/CDSHelper.java @@ -840,86 +840,51 @@ public boolean saveGroup(String name, @Nullable String description, boolean shar public boolean saveGroup(String name, @Nullable String description, boolean shared, boolean skipWaitForBar) { - return saveGroup(name, description, shared, skipWaitForBar, false); - } - - public boolean saveGroup(String name, @Nullable String description, boolean shared, boolean skipWaitForBar, boolean isMab) - { - if (isMab) { - _test.click(Locators.cdsButtonLocator("save", "mabfiltersave")); - } - else { - _test.click(Locator.tagWithId("a", "filter-save-as-group-btn-id")); - } - + _test.click(Ext4Helper.Locators.ext4Button("Save as a group")); if (_test.isElementPresent(Locators.cdsButtonLocator("create a new group"))) { _test.click(Locators.cdsButtonLocator("create a new group")); } - if (isMab) { - Locator.linkWithText("replace an existing group").waitForElement(_test.getDriver(), CDS_WAIT); - } - else { - _test.waitForElement(Locator.name("groupname")); - } - - Locator.XPathLocator shareGroupCheckbox = Locator.xpath("//input[contains(@id,'creategroupshared')]"); - - if (isMab) { - shareGroupCheckbox = Locator.xpath("//input[contains(@id,'mabcreategroupshared')]"); - } + _test.waitForElement(Locator.name("groupname").notHidden()); + Locator shareGroupCheckbox = Locator.xpath("//table[contains(@class, 'group-shared-checkbox')]/descendant::input[contains(@type, 'button')]").notHidden(); if (shared) { - if (_test.isElementVisible(shareGroupCheckbox)) + if (_test.isElementPresent(shareGroupCheckbox)) { - _test._ext4Helper.checkCheckbox(shareGroupCheckbox); + _test.click(shareGroupCheckbox); } else { //Expected failure. The user attempts to save, but does not have sufficient permissions. - _test.click(Locators.cdsButtonLocator("Cancel", "groupcancelcreate")); + _test.click(Locators.cdsButtonLocator("Cancel", "groupcancelcreate").notHidden()); return false; } } - if (isMab) { - _test.setFormElement(Locator.name("mabgroupname"), name); - if (null != description) - _test.setFormElement(Locator.name("mabgroupdescription"), description); - } - else { - _test.setFormElement(Locator.name("groupname"), name); - if (null != description) - _test.setFormElement(Locator.name("groupdescription"), description); - } + _test.setFormElement(Locator.name("groupname").notHidden(), name); + if (null != description) + _test.setFormElement(Locator.name("groupdescription").notHidden(), description); String saveBtnLocatorName; - if (isMab) - saveBtnLocatorName = "Save"; - else - saveBtnLocatorName = "Save group"; + saveBtnLocatorName = "Save group"; _test.sleep(1000); if (skipWaitForBar) { - _test.click(Locators.cdsButtonLocator(saveBtnLocatorName, "groupcreatesave")); + _test.click(Locators.cdsButtonLocator(saveBtnLocatorName, "groupcreatesave").notHidden()); } else { applyAndMaybeWaitForBars(aVoid -> { - _test.click(Locators.cdsButtonLocator(saveBtnLocatorName, "groupcreatesave")); + _test.click(Locators.cdsButtonLocator(saveBtnLocatorName, "groupcreatesave").notHidden()); return null; }); } // verify group save messaging //ISSUE 19997 - if (isMab) - _test.waitForElement(Locator.xpath("//div[contains(@class, 'x-window-swmsg')]//div[contains(text(), 'saved')]")); - else - _test.waitForElement(Locator.tagWithId("div", "savedgroupname-id").notHidden()); - + _test.waitForElement(Locator.tagWithClass("div", "savedgroup-label-container").notHidden()); _test.log("Saving '" + name + "' group was success!"); return true; @@ -1213,7 +1178,7 @@ public void clearFilters() public void clearFilters(boolean skipWaitForBar) { - final WebElement clearButton = _test.waitForElement(Locators.cdsButtonLocator("clear", "filter-clear-btn")); + final WebElement clearButton = _test.waitForElement(Locators.cdsButtonLocator("clear", "filter-clear-btn").notHidden()); if (skipWaitForBar) { diff --git a/theme/connector/panel/_FilterPanel.scss b/theme/connector/panel/_FilterPanel.scss index 4d4c76f98..b9d572383 100644 --- a/theme/connector/panel/_FilterPanel.scss +++ b/theme/connector/panel/_FilterPanel.scss @@ -278,10 +278,11 @@ ul.indent li { .groupsave-cancel-save-btns { display: flex; - height: 24px; + height: 25px; justify-content: center; align-items: center; gap: 5px; + background: #ebebeb; .cancel-save-btns { width: 71px; @@ -300,14 +301,13 @@ ul.indent li { color: #FFF !important; display: flex; width: 72px; - height: 25px; + height: 24px; justify-content: center; align-items: center; .x-btn-inner { color: #FFF !important; text-align: center; - height: 25px; font-size: 11px; font-style: normal; font-weight: 400; diff --git a/webapp/Connector/extapp.lib.xml b/webapp/Connector/extapp.lib.xml index 36a73f8db..4f4e37b45 100644 --- a/webapp/Connector/extapp.lib.xml +++ b/webapp/Connector/extapp.lib.xml @@ -103,6 +103,7 @@