Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/org/labkey/test/components/ui/grids/ExportMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ public File exportData(GridBar.ExportType exportType, int index)
return getWrapper().doAndWaitForDownload(exportButton::click);
}

public File exportData(GridBar.ExportType exportType, GridBar.ExportHeaderType headerType)
{
WebElement exportButton = getExportMenuItem(exportType, headerType);
return getWrapper().doAndWaitForDownload(exportButton::click);
}

public File exportStorageMap()
{
_menu.expand();
WebElement exportButton = Locator.tag("li")
.withDescendant(Locator.tagWithClass("span", "export-menu-icon"))
.containing("Storage Map (Excel)")
.findElement(this);
return getWrapper().doAndWaitForDownload(exportButton::click);
}

public TabSelectionExportDialog openExcelTabsModal(GridBar.ExportHeaderType headerType)
{
getExportMenuItem(GridBar.ExportType.EXCEL, headerType).click();

return new TabSelectionExportDialog(this.getDriver());
}

public TabSelectionExportDialog openExcelTabsModal()
{
WebElement exportButton = getExportMenuItem(GridBar.ExportType.EXCEL);
Expand All @@ -89,4 +112,14 @@ private WebElement getExportMenuItem(GridBar.ExportType exportType, int index)
_menu.expand();
return Locator.css("span.export-menu-icon").withClass(exportType.buttonCssClass()).findElements(this).get(index);
}

// Header type sections are only labeled when the menu offers more than one header type
private WebElement getExportMenuItem(GridBar.ExportType exportType, GridBar.ExportHeaderType headerType)
{
_menu.expand();
return Locator.tagWithAttribute("li", "role", "heading").containing(headerType.getSectionText())
.followingSibling("li")
.withDescendant(Locator.tagWithClass("span", "export-menu-icon").withClass(exportType.buttonCssClass()))
.findElement(this);
}
}
33 changes: 33 additions & 0 deletions src/org/labkey/test/components/ui/grids/GridBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,26 @@ public File exportData(ExportType exportType, int index)
return elementCache().exportMenu.exportData(exportType, index);
}

public File exportData(ExportType exportType, ExportHeaderType headerType)
{
return elementCache().exportMenu.exportData(exportType, headerType);
}

public File exportStorageMap()
{
return elementCache().exportMenu.exportStorageMap();
}

public TabSelectionExportDialog openExcelTabsModal()
{
return elementCache().exportMenu.openExcelTabsModal();
}

public TabSelectionExportDialog openExcelTabsModal(ExportHeaderType headerType)
{
return elementCache().exportMenu.openExcelTabsModal(headerType);
}

/**
* gets the Pager for the current grid, if it exists.
* If the grid is filtered down to an empty set or if there are no loaded rows, it will not be present
Expand Down Expand Up @@ -413,4 +428,22 @@ public Character getSeparator()
return _separator;
}
}

public enum ExportHeaderType
{
CAPTION("Grid View Labels"),
IMPORT_FIELD("Field Names");

private final String _sectionText;

ExportHeaderType(String sectionText)
{
_sectionText = sectionText;
}

public String getSectionText()
{
return _sectionText;
}
}
}
Loading