Skip to content

Commit

Permalink
Consolidate curated group workflows (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-klum authored May 24, 2024
1 parent 3573333 commit 985e48c
Show file tree
Hide file tree
Showing 18 changed files with 695 additions and 1,359 deletions.
1 change: 1 addition & 0 deletions src/org/labkey/cds/view/template/ConnectorTemplate.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
}
2 changes: 1 addition & 1 deletion test/src/org/labkey/test/pages/cds/GroupDetailsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/src/org/labkey/test/pages/cds/MAbDataGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public boolean isCheckAllPresent()

public void clearAllFilters()
{
Optional<WebElement> clearAllFilterBtn = CDSHelper.Locators.cdsButtonLocator("clear", "mabfilterclear").findOptionalElement(getDriver());
Optional<WebElement> 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);
Expand Down
8 changes: 4 additions & 4 deletions test/src/org/labkey/test/tests/cds/CDSGroupBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ 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);
_stopImpersonatingRole();

_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);
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 0 additions & 2 deletions test/src/org/labkey/test/tests/cds/CDSGroupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
Expand Down Expand Up @@ -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());
Expand Down
36 changes: 4 additions & 32 deletions test/src/org/labkey/test/tests/cds/CDSMAbTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ public void testMabInfoPane()
ip.clickClose();

ip.clickMabStudiesCount();
CDSStudyTooltipTest.dismissTooltip(this);
log("Check Studies list.");

expectedHasDataInMAbGrid = new ArrayList<>();
Expand Down Expand Up @@ -638,6 +639,7 @@ public void testMabInfoPane()
ip.clickClose();

ip.clickMabStudiesCount();
CDSStudyTooltipTest.dismissTooltip(this);
log("Check Studies list.");

expectedHasDataInMAbGrid = new ArrayList<>();
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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));
}

}
13 changes: 7 additions & 6 deletions test/src/org/labkey/test/tests/cds/CDSStudyTooltipTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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
});
}
Expand Down
63 changes: 14 additions & 49 deletions test/src/org/labkey/test/util/cds/CDSHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions theme/connector/panel/_FilterPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions webapp/Connector/extapp.lib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<!-- Application Views -->
<script path="Connector/src/view/DetailStatus.js"/>
<script path="Connector/src/view/Selection.js"/>
<script path="Connector/src/view/AbstractFilterStatus.js"/>
<script path="Connector/src/view/FilterStatus.js"/>
<script path="Connector/src/view/InfoPane.js"/>
<script path="Connector/src/view/GridPane.js"/>
Expand Down
14 changes: 10 additions & 4 deletions webapp/Connector/src/app/view/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,16 @@ Ext.define('Connector.app.view.Group', {

this.on('show', function(){
if (this.reloadStoreOnShow){
//console.log('reloading group slice');
this.getStore().loadSlice();
this.renderLoadingMask();
this.reloadStoreOnShow = false;
if (!this.loadDataTask) {
this.loadDataTask = new Ext.util.DelayedTask(function() {
//console.log('reloading group slice');
this.getStore().removeAll();
this.getStore().loadSlice();
this.renderLoadingMask();
this.reloadStoreOnShow = false;
});
}
this.loadDataTask.delay(300, undefined, this);
}
}, this);

Expand Down
Loading

0 comments on commit 985e48c

Please sign in to comment.