Skip to content
Merged
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
10 changes: 10 additions & 0 deletions src/org/labkey/test/components/SaveChartDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

import org.labkey.test.Locator;
import org.labkey.test.WebDriverWrapper;
import org.labkey.test.components.ext4.Checkbox;
import org.labkey.test.components.ext4.RadioButton;
import org.labkey.test.components.ext4.Window;
import org.labkey.test.pages.TimeChartWizard;
import org.labkey.test.selenium.LazyWebElement;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

import static org.labkey.test.components.ext4.Checkbox.Ext4Checkbox;

public class SaveChartDialog extends Window<SaveChartDialog.Elements>
{
private static final Locator DIALOG_LOC = Locator.byClass("chart-wizard-dialog").append(Locator.byClass("save-chart-panel"));
Expand Down Expand Up @@ -99,6 +102,12 @@ public SaveChartDialog setViewableBy(ViewableBy visibility)
return this;
}

public SaveChartDialog setInherit(boolean checked)
{
elementCache().inheritCheckbox.set(checked);
return this;
}

public TimeChartWizard clickCancel()
{
clickButton("Cancel", true);
Expand Down Expand Up @@ -152,6 +161,7 @@ protected class Elements extends Window.ElementCache
private final RadioButton autoThumbnail = new RadioButton.RadioButtonFinder().withLabel("Auto-generate").findWhenNeeded(this);
private final RadioButton allReaders = new RadioButton.RadioButtonFinder().withLabel("All readers").findWhenNeeded(this);
private final RadioButton onlyMe = new RadioButton.RadioButtonFinder().withLabel("Only me").findWhenNeeded(this);
private final Checkbox inheritCheckbox = Ext4Checkbox().withLabel("Make this report available in child folders").findWhenNeeded(this);
}

public enum ViewableBy
Expand Down
12 changes: 12 additions & 0 deletions src/org/labkey/test/components/react/QueryChartDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ public boolean getShared()
return elementCache().sharedCheckbox.get();
}

public QueryChartDialog setInheritable(boolean checked)
{
elementCache().inheritableCheckbox.set(checked);
return this;
}

public boolean getInheritable()
{
return elementCache().inheritableCheckbox.get();
}

// field selects

public QueryChartDialog clearFieldValue(String fieldLabel)
Expand Down Expand Up @@ -321,6 +332,7 @@ protected class ElementCache extends ModalDialog.ElementCache
{
final Input nameInput = Input(Locator.input("name"), getDriver()).findWhenNeeded(this);
final Checkbox sharedCheckbox = Checkbox.Checkbox(Locator.input("shared")).findWhenNeeded(this);
final Checkbox inheritableCheckbox = Checkbox.Checkbox(Locator.input("inheritable")).findWhenNeeded(this);

Locator.XPathLocator chartBuilderType = Locator.tagWithClass("div", "chart-builder-type");

Expand Down
16 changes: 13 additions & 3 deletions src/org/labkey/test/tests/DataReportsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,7 @@ public void doAdvancedViewTest()
// Note: Enabling this feature flag requires a server restart
if (TestProperties.isPrimaryUserAppAdmin() || !OptionalFeatureHelper.isOptionalFeatureEnabled(createDefaultConnection(), "enableExternalReport"))
{
BootstrapMenu reportMenu = dataRegion.getReportMenu();
reportMenu.expand();
List<String> menuItems = getTexts(reportMenu.findVisibleMenuItems());
List<String> menuItems = dataRegion.getHeaderMenuOptions("Charts / Reports");
assertThat("App admin shouldn't be able to create an advanced report.", menuItems, not(hasItem(create_advanced_report)));
assertThat("Sanity check failed. Check menu text for advanced report.", menuItems, hasItem("Create Chart"));
// Site admins can still navigate to the externalReport page. It isn't functional though, so skipping this check
Expand Down Expand Up @@ -509,6 +507,18 @@ public void doRReportsTest()

// TODO: Issue 36040: Unable to download PDF for R report run as pipeline job
// verifyReportPdfDownload("study", 4500d);

// delete report and then verify audit events
deleteReport(R_SCRIPTS[0]);
goToSchemaBrowser();
viewQueryData("auditLog", "ReportEvent");
DataRegionTable table = new DataRegionTable("query", this);
table.setFilter("ReportName", "Equals", R_SCRIPTS[0]);
assertEquals("Number of audit events for report not as expected", 3, table.getDataRowCount());
assertEquals("Report name for audit events not as expected", List.of(R_SCRIPTS[0], R_SCRIPTS[0], R_SCRIPTS[0]), table.getColumnDataAsText("ReportName"));
assertEquals("Report key for audit events not as expected", List.of("study/DEM-1", "study/DEM-1", "study/DEM-1"), table.getColumnDataAsText("ReportKey"));
assertEquals("Report type for audit events not as expected", List.of("Study.rReport", "Study.rReport", "Study.rReport"), table.getColumnDataAsText("ReportType"));
assertEquals("Report comment for audit events not as expected", List.of("Report deleted", "Report updated", "Report created"), table.getColumnDataAsText("Comment"));
}

private void verifyReportPdfDownload(String schema, double expectedSize)
Expand Down
64 changes: 61 additions & 3 deletions src/org/labkey/test/tests/visualization/BarPlotTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.labkey.test.components.ChartTypeDialog;
import org.labkey.test.components.ColumnChartRegion;
import org.labkey.test.components.LookAndFeelBarPlot;
import org.labkey.test.components.SaveChartDialog;
import org.labkey.test.pages.TimeChartWizard;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.LabKeyExpectedConditions;
Expand All @@ -35,6 +36,10 @@
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.List;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

@Category({Daily.class, Reports.class, Charting.class, Hosting.class})
@BaseWebDriverTest.ClassTimeout(minutes = 8)
Expand Down Expand Up @@ -73,6 +78,7 @@ protected LookAndFeelBarPlot clickChartLayoutButton()
protected void testPlots()
{
doBasicBarPlotTest();
doInheritedPlotTest();
doGroupedBarPlotTest();
doColumnPlotClickThrough();
doExportOfBarPlot();
Expand Down Expand Up @@ -173,6 +179,53 @@ private void doBasicBarPlotTest()
savePlot(BAR_PLOT_SAVE_NAME, "This is a bar plot from the simple bar plot test.");
}

@LogMethod
private void doInheritedPlotTest()
{
String chartName = "InheritedPlotTest";
String subfolderName = chartName + "Folder";
String SVG_TEXT = "normal\n0\n0.1\n0.2\n0.3\n0.4\n0.5\n0.6\n0.7\n0.8\n0.9\n1\nContainers\nType";

goToProjectHome();
clickFolder(getFolderName());

// create a bar chart on a schema/query that is shared across folders
ChartTypeDialog chartTypeDialog = clickAddChart("core", "Containers");
TimeChartWizard chartWizard = chartTypeDialog.setXAxis("Type").clickApply();
SaveChartDialog saveChartDialog = chartWizard.clickSave();
saveChartDialog.setReportName(chartName);
saveChartDialog.clickSave();
assertSVG(SVG_TEXT);

// create subfolder and initially verify that the chart is not inherited
_containerHelper.createSubfolder(getProjectName() + "/" + getFolderName(), subfolderName, "Collaboration");
clickFolder(subfolderName);
goToSchemaBrowser();
viewQueryData("core", "Containers");
DataRegionTable table = new DataRegionTable("query", this);
List<String> menuItems = table.getHeaderMenuOptions("Charts / Reports");
assertFalse("Report should not be visible in subfolder", menuItems.contains(chartName));

// verify that the chart is inherited when the inherit flag is set
clickFolder(getFolderName());
goToChart(chartName);
chartWizard = openSavedPlotInEditMode(chartName);
saveChartDialog = chartWizard.clickSaveAs();
saveChartDialog.setReportName(chartName + "_Inherited");
saveChartDialog.setInherit(true);
saveChartDialog.clickSave();

clickFolder(subfolderName);
goToSchemaBrowser();
viewQueryData("core", "Containers");
table = new DataRegionTable("query", this);
menuItems = table.getHeaderMenuOptions("Charts / Reports");
assertFalse("Report should not be visible in subfolder", menuItems.contains(chartName));
assertTrue("Inherited report should be visible in subfolder", menuItems.contains(chartName + "_Inherited"));
table.goToReport(chartName + "_Inherited");
assertSVG(SVG_TEXT);
}

@LogMethod
private void doGroupedBarPlotTest()
{
Expand Down Expand Up @@ -292,12 +345,17 @@ private void doExportOfBarPlot()
final String EXPORTED_SCRIPT_CHECK_YAXIS = "Sum of " + BP_DIASTOLIC;

log("Validate that export of the bar plot works.");
goToChart(BAR_PLOT_SAVE_NAME);
export(EXPORTED_SCRIPT_CHECK_TYPE, EXPORTED_SCRIPT_CHECK_XAXIS, EXPORTED_SCRIPT_CHECK_YAXIS);
}

private void goToChart(String chartName)
{
goToProjectHome();
clickFolder(getFolderName());
clickTab("Clinical and Assay Data");
waitForElement(Locator.linkWithText(BAR_PLOT_SAVE_NAME));
clickAndWait(Locator.linkWithText(BAR_PLOT_SAVE_NAME), WAIT_FOR_PAGE);
export(EXPORTED_SCRIPT_CHECK_TYPE, EXPORTED_SCRIPT_CHECK_XAXIS, EXPORTED_SCRIPT_CHECK_YAXIS);
waitForElement(Locator.linkWithText(chartName));
clickAndWait(Locator.linkWithText(chartName), WAIT_FOR_PAGE);
}

@LogMethod
Expand Down