Skip to content

Commit 2cfeba4

Browse files
Additional test coverage for study crosstab reports (#2518)
1 parent 25a9395 commit 2cfeba4

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

src/org/labkey/test/tests/DataReportsTest.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ public void doQueryReportTests()
244244
@Test
245245
public void doCrosstabViewTest()
246246
{
247-
String reportName = "TestReport";
247+
String reportName = "TestReport" + TRICKY_CHARACTERS;
248+
String reportName2 = "ATotallyDifferentReport" + TRICKY_CHARACTERS;
248249

249250
clickAndWait(Locator.linkWithText("DEM-1: Demographics"));
250251

@@ -254,19 +255,40 @@ public void doCrosstabViewTest()
254255
selectOptionByText(Locator.name("statField"), "Visit");
255256
clickButton("Submit");
256257

257-
String[] row3 = new String[] {"Male", "2", "9", "3", "14"};
258-
assertTableRowsEqual("report", 3, new String[][] {row3});
258+
assertTableRowsEqual("report", 3, new String[][] {new String[] {"Male", "2", "9", "3", "14"}});
259259

260260
setFormElement(Locator.name("label"), reportName);
261261
clickButton("Save");
262262

263+
// Now visit the report and check that it renders correctly
263264
clickFolder("My Study");
264-
assertTextPresent(reportName);
265265
clickAndWait(Locator.linkWithText(reportName));
266-
267266
assertTableCellTextEquals("report", 2, 0, "Female");
268267

268+
clickFolder("My Study");
269+
clickAndWait(Locator.linkWithText("DEM-1: Demographics"));
270+
DataRegionTable.DataRegion(getDriver()).find().goToReport("Create Crosstab Report");
271+
// Test rendering of date values, both in headers and in cells
272+
selectOptionByValue(Locator.name("rowField"), "DEMdt");
273+
selectOptionByValue(Locator.name("colField"), "DEMhisp");
274+
selectOptionByText(Locator.name("statField"), "1.Date of Birth");
275+
clickButton("Submit");
276+
277+
// Try saving with a duplicate name
278+
setFormElement(Locator.name("label"), reportName);
279+
clickButton("Save");
280+
assertTextPresent("There is already a report with the name of");
281+
setFormElement(Locator.name("label"), reportName2);
282+
clickButton("Save");
283+
284+
// Now visit the second report and check that it renders correctly
285+
clickFolder("My Study");
286+
clickAndWait(Locator.linkWithText(reportName2));
287+
assertTableRowsEqual("report", 3, new String[][] {new String[] {"2006-01-01 00:00:00.0", "1", "0", "1"}});
288+
assertTableRowsEqual("report", 14, new String[][] {new String[] {"2006-02-01 00:00:00.0", "3", "1", "4"}});
289+
269290
deleteReport(reportName);
291+
deleteReport(reportName2);
270292
}
271293

272294
@Test

0 commit comments

Comments
 (0)