Skip to content

Commit c3b9de3

Browse files
Improve QC folder plot controls (#1120)
1 parent 04e0e3f commit c3b9de3

File tree

14 files changed

+469
-355
lines changed

14 files changed

+469
-355
lines changed

resources/views/configureQCGroups.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
LABKEY.QueryWebPart.standardButtons.print,
6161
LABKEY.QueryWebPart.standardButtons.pageSize,
6262
{
63-
text: 'Mark As Included',
63+
text: 'Include',
6464
requiresSelection: 'true',
6565
handler: markPrecursorAsIncludedHandler
6666
},
6767
{
68-
text: 'Mark As Excluded',
68+
text: 'Exclude',
6969
requiresSelection: 'true',
7070
handler: markPrecursorAsExcludedHandler
7171
}

src/org/labkey/targetedms/view/qcTrendPlotReport.jsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
String plotPanelId = "tiledPlotPanel-" + uid;
5757
String plotPaginationPanelId = "plotPaginationPanel-" + uid;
5858
%>
59-
59+
<!-- Help ExtJS plot controls reliably grab the width they need -->
60+
<div style="height: 1px; width: 1250px;"></div>
6061
<div id="<%=h(reportPanelId)%>"></div>
6162
<div id="<%=h(plotPaginationPanelId)%>" class="plotPaginationHeaderPanel"></div>
6263
<div id="<%=h(plotPanelId)%>" class="tiledPlotPanel"></div>

test/src/org/labkey/test/components/targetedms/QCPlotsWebPart.java

Lines changed: 97 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import org.labkey.test.Locators;
2121
import org.labkey.test.WebDriverWrapper;
2222
import org.labkey.test.components.BodyWebPart;
23-
import org.labkey.test.components.ext4.Checkbox;
2423
import org.labkey.test.components.ext4.ComboBox;
24+
import org.labkey.test.components.ext4.RadioButton;
2525
import org.labkey.test.components.ext4.Window;
2626
import org.labkey.test.util.Ext4Helper;
2727
import org.labkey.test.util.LogMethod;
@@ -252,22 +252,44 @@ public Set<QCPlotType> getCurrentQCPlotTypes()
252252

253253
public void setGroupXAxisValuesByDate(boolean check)
254254
{
255-
if (elementCache().groupedXCheckbox.get() != check)
255+
if (isGroupXAxisValuesByDateChecked() != check)
256256
{
257-
doAndWaitForUpdate(() -> elementCache().groupedXCheckbox.set(check));
257+
if (check)
258+
doAndWaitForUpdate(() -> elementCache().xAxisGroupingDateRadio.check());
259+
else
260+
doAndWaitForUpdate(() -> elementCache().xAxisGroupingReplicateRadio.check());
258261
}
259262
}
260263

261264
public boolean isGroupXAxisValuesByDateChecked()
262265
{
263-
return elementCache().groupedXCheckbox.isChecked();
266+
try
267+
{
268+
return elementCache().xAxisGroupingDateRadio.isSelected();
269+
}
270+
catch (NoSuchElementException | StaleElementReferenceException e)
271+
{
272+
// Fallback: if radios are not present yet, assume unchecked
273+
return false;
274+
}
264275
}
265276

266277
public void setShowAllPeptidesInSinglePlot(boolean check)
267278
{
268-
if (elementCache().singlePlotCheckbox.get() != check)
279+
// 'check' means show all series combined in a single plot
280+
try
269281
{
270-
doAndWaitForUpdate(() -> elementCache().singlePlotCheckbox.set(check));
282+
if (isShowAllPeptidesInSinglePlotChecked() != check)
283+
{
284+
if (check)
285+
doAndWaitForUpdate(() -> elementCache().plotsCombinedRadio.check());
286+
else
287+
doAndWaitForUpdate(() -> elementCache().plotsPerPrecursorRadio.check());
288+
}
289+
}
290+
catch (NoSuchElementException | StaleElementReferenceException e)
291+
{
292+
// Fallback: ignore if control not present yet
271293
}
272294
}
273295

@@ -282,32 +304,63 @@ public void setShowAllPeptidesInSinglePlot(boolean check, int expectedPlotCount)
282304

283305
public void setShowExcludedPoints(boolean check)
284306
{
285-
elementCache().showExcludedCheckbox.set(check);
307+
if (check)
308+
{
309+
elementCache().excludedReplicatesShow.check();
310+
}
311+
else
312+
{
313+
elementCache().excludedReplicatesHide.check();
314+
}
286315
}
287316

288317
public boolean isShowExcludedPointsChecked()
289318
{
290-
return elementCache().showExcludedCheckbox.isChecked();
319+
return elementCache().excludedReplicatesShow.isChecked();
291320
}
292321

293322
public void setShowReferenceGuideSet(boolean check)
294323
{
295-
elementCache().showReferenceGuideSet.set(check);
324+
if (isShowReferenceGuideSetChecked() != check)
325+
{
326+
if (check)
327+
{
328+
elementCache().referenceGuideSetShow.check();
329+
}
330+
else
331+
{
332+
elementCache().referenceGuideSetHide.check();
333+
}
334+
}
296335
}
297336

298337
public void setShowExcludedPrecursors(boolean check)
299338
{
300-
elementCache().showExcludedPrecursors.set(check);
339+
if (check)
340+
{
341+
elementCache().excludedPrecursorsShow.check();
342+
}
343+
else
344+
{
345+
elementCache().excludedPrecursorsHide.check();
346+
}
301347
}
302348

303349
public boolean isShowReferenceGuideSetChecked()
304350
{
305-
return elementCache().showReferenceGuideSet.isChecked();
351+
return elementCache().referenceGuideSetShow.isChecked();
306352
}
307353

308354
public boolean isShowAllPeptidesInSinglePlotChecked()
309355
{
310-
return elementCache().singlePlotCheckbox.isChecked();
356+
try
357+
{
358+
return elementCache().plotsCombinedRadio.isSelected();
359+
}
360+
catch (NoSuchElementException | StaleElementReferenceException e)
361+
{
362+
return false;
363+
}
311364
}
312365

313366
public QCPlotsWebPart saveAsDefaultView()
@@ -323,11 +376,6 @@ public QCPlotsWebPart revertToDefaultView()
323376
return this;
324377
}
325378

326-
public void applyRange()
327-
{
328-
doAndWaitForUpdate(() -> elementCache().applyRangeButton.click());
329-
}
330-
331379
public void waitForPlots(Integer plotCount)
332380
{
333381
if (plotCount > 0)
@@ -341,6 +389,11 @@ public void waitForPlots(Integer plotCount)
341389
}
342390
}
343391

392+
public boolean isCombinedPlotControlVisible()
393+
{
394+
return elementCache().plotsCombinedRadio.isDisplayed();
395+
}
396+
344397
public List<QCPlot> getPlots()
345398
{
346399
return elementCache().findSeriesPanels().stream().map(QCPlot::new).toList();
@@ -374,7 +427,7 @@ public void filterQCPlotsToInitialData(int expectedPlotCount, boolean resetForm)
374427
resetInitialQCPlotFields();
375428
}
376429

377-
filterQCPlots("2013-08-09", "2013-08-27", expectedPlotCount);
430+
filterQCPlots("2013-08-09", "2013-08-27", resetForm);
378431
}
379432

380433
@LogMethod
@@ -391,13 +444,18 @@ public void resetInitialQCPlotFields()
391444
}
392445

393446
@LogMethod
394-
public void filterQCPlots(@LoggedParam String startDate, @LoggedParam String endDate, int expectedPlotCount)
447+
public void filterQCPlots(@LoggedParam String startDate, @LoggedParam String endDate, boolean waitForPlotsToRefresh)
395448
{
396449
setDateRangeOffset(DateRangeOffset.CUSTOM);
397450
setStartDate(startDate);
398-
setEndDate(endDate);
399-
applyRange();
400-
waitForPlots(expectedPlotCount);
451+
if (waitForPlotsToRefresh)
452+
{
453+
doAndWaitForUpdate(() -> setEndDate(endDate));
454+
}
455+
else
456+
{
457+
setEndDate(endDate);
458+
}
401459
}
402460

403461
public int getGuideSetTrainingRectCount()
@@ -871,17 +929,24 @@ public class Elements extends BodyWebPart<?>.ElementCache
871929

872930
ComboBox qcPlotTypeCombo = new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("qc-plot-type-with-y-options")
873931
.findWhenNeeded(this).setMatcher(Ext4Helper.TextMatchTechnique.CONTAINS).setMultiSelect(true);
874-
Checkbox groupedXCheckbox = new Checkbox(Locator.css("#grouped-x-field input")
875-
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));
876-
Checkbox singlePlotCheckbox = new Checkbox(Locator.css("#peptides-single-plot input")
877-
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));
878-
Checkbox showExcludedCheckbox = new Checkbox(Locator.css("#show-excluded-points input")
879-
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));
880-
Checkbox showReferenceGuideSet = new Checkbox(Locator.css("#show-oorange-gs input")
881-
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));
882-
Checkbox showExcludedPrecursors = new Checkbox(Locator.css("#show-excluded-precursors input")
883-
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT));
932+
WebElement groupedXPerReplicate = Locator.css("#grouped-x-field input[value=replicate]").findWhenNeeded(this);
933+
934+
RadioButton xAxisGroupingReplicateRadio = new RadioButton.RadioButtonFinder().withLabel("per replicate").findWhenNeeded(getDriver());
935+
RadioButton xAxisGroupingDateRadio = new RadioButton.RadioButtonFinder().withLabel("per date").findWhenNeeded(getDriver());
936+
937+
RadioButton plotsCombinedRadio = new RadioButton.RadioButtonFinder().withLabel("combined").findWhenNeeded(getDriver());
938+
RadioButton plotsPerPrecursorRadio = new RadioButton.RadioButtonFinder().withLabel("per precursor").findWhenNeeded(getDriver());
939+
940+
// These have the same label as another group, but are first in the page
941+
RadioButton excludedReplicatesShow = new RadioButton.RadioButtonFinder().withLabel("show").findWhenNeeded(getDriver());
942+
RadioButton excludedReplicatesHide = new RadioButton.RadioButtonFinder().withLabel("hide").findWhenNeeded(getDriver());
943+
944+
// Note that these two won't work with the isChecked() call but they have the same labels as the ones above so we can't simply check by label
945+
RadioButton excludedPrecursorsShow = new RadioButton(Locator.id("excluded-precursors-show").findWhenNeeded(getDriver()));
946+
RadioButton excludedPrecursorsHide = new RadioButton(Locator.id("excluded-precursors-hide").findWhenNeeded(getDriver()));
884947

948+
RadioButton referenceGuideSetShow = new RadioButton.RadioButtonFinder().withLabel("always show").findWhenNeeded(getDriver());
949+
RadioButton referenceGuideSetHide = new RadioButton.RadioButtonFinder().withLabel("when in date range").findWhenNeeded(getDriver());
885950

886951
WebElement plotPanel = Locator.css("div.tiledPlotPanel").findWhenNeeded(this);
887952
WebElement paginationPanel = Locator.css("div.plotPaginationHeaderPanel").findWhenNeeded(this);

test/src/org/labkey/test/tests/panoramapremium/TargetedMSHidePeptidesAndMolecules.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ private void excludePeptideOrMolecule(String folderName, int rowIndex, String ac
128128
DataRegionTable table = gotoIncludeExcludeMenu();
129129
table.checkCheckbox(rowIndex);
130130
if (action.equals("Excluded"))
131-
table.doAndWaitForUpdate(() -> table.clickHeaderButton("Mark As Excluded"));
131+
table.doAndWaitForUpdate(() -> table.clickHeaderButton("Exclude"));
132132
else
133-
table.doAndWaitForUpdate(() -> table.clickHeaderButton("Mark As Included"));
133+
table.doAndWaitForUpdate(() -> table.clickHeaderButton("Include"));
134134
checker().withScreenshot("MarkedAsColumnUpdate_" + folderName).verifyEquals("Marked As column not updated with selection of action", action, table.getDataAsText(rowIndex, "markedAs"));
135135

136136
log("Verifying targetedms.ExcludedPrecursors table gets updated with action");

test/src/org/labkey/test/tests/panoramapremium/TargetedMSQCFolderImportExport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,6 @@ private void excludePrecursors(String projectName, int rowNum)
153153
qcSummaryWebPart.clickMenuItem("Configure Included and Excluded Precursors");
154154
DataRegionTable table = new DataRegionTable.DataRegionFinder(getDriver()).waitFor();
155155
table.checkCheckbox(rowNum);
156-
table.clickHeaderButton("Mark As Excluded");
156+
table.clickHeaderButton("Exclude");
157157
}
158158
}

test/src/org/labkey/test/tests/targetedms/TargetedMSExperimentalQCLinkTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void testLinkExperimentalQC()
153153

154154
String testStartDate = "2013-08-18";
155155
String testEndDate = "2013-08-27";
156-
qcPlotsWebPart.filterQCPlots(testStartDate, testEndDate, 7);
156+
qcPlotsWebPart.filterQCPlots(testStartDate, testEndDate, true);
157157

158158
checker().verifyTrue("The graph is not divided by line separator",
159159
isElementPresent(Locator.tagWithAttribute("line", "class", "separator")));

test/src/org/labkey/test/tests/targetedms/TargetedMSIrtTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public abstract class TargetedMSIrtTest extends TargetedMSTest
3333
private static final String SCHEMA = "targetedms";
3434
private static final String QUERY = "iRTPeptide";
3535

36-
// All tests use varations of this test dataset.
36+
// All tests use variations of this test dataset.
3737
protected static final String SKY_FILE = "iRT Human+Standard Calibrate.zip";
3838
protected static final int PEPTIDE_COUNT = 716;
3939
protected static final double DELTA = 0.00001;

test/src/org/labkey/test/tests/targetedms/TargetedMSPeptideSummaryHeatmapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void testHeatMapColorAndValues()
7676
qcPlotsWebPart = new PanoramaDashboard(this).getQcPlotsWebPart();
7777
qcPlotsWebPart.waitForReady();
7878
assertEquals("Date Range Offset not set to default value", QCPlotsWebPart.DateRangeOffset.LAST_7_DAYS, qcPlotsWebPart.getCurrentDateRangeOffset());
79-
qcPlotsWebPart.filterQCPlots("2013-08-10", "2013-08-15", 7);
79+
qcPlotsWebPart.filterQCPlots("2013-08-10", "2013-08-15", true);
8080

8181
// Now navigate through the link instead of the custom tab and webpart
8282
waitAndClickAndWait(Locator.linkContainingText("View all 47 replicates"));

test/src/org/labkey/test/tests/targetedms/TargetedMSQCGuideSetTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ public void testGuideSetPlotDisplay()
205205
qcPlotsWebPart.setGroupXAxisValuesByDate(false);
206206

207207
// filter plot by start/end date to check reference points without training points in view
208-
qcPlotsWebPart.filterQCPlots("2013-08-19", "2013-08-19", PRECURSORS.length);
208+
qcPlotsWebPart.filterQCPlots("2013-08-19", "2013-08-19", true);
209209
shapeCounts = new ArrayList<>();
210210
shapeCounts.add(Pair.of(SvgShapes.CIRCLE.getPathPrefix(), 14));
211+
qcPlotsWebPart = new QCPlotsWebPart(getDriver());
211212
verifyGuideSetRelatedElementsForPlots(qcPlotsWebPart, 0, shapeCounts, 2);
212213
}
213214

test/src/org/labkey/test/tests/targetedms/TargetedMSQCTest.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import static org.labkey.test.components.targetedms.QCPlotsWebPart.QCPlotType.MetricValue;
6464
import static org.labkey.test.components.targetedms.QCPlotsWebPart.QCPlotType.MovingRange;
6565
import static org.labkey.test.components.targetedms.QCPlotsWebPart.QCPlotType.TrailingCV;
66-
import static org.labkey.test.components.targetedms.QCPlotsWebPart.QCPlotType.TrailingMean;
6766
import static org.labkey.test.util.PermissionsHelper.READER_ROLE;
6867

6968
@Category({})
@@ -190,6 +189,9 @@ private void doInit()
190189
public void preTest()
191190
{
192191
goToProjectHome();
192+
PanoramaDashboard qcDashboard = new PanoramaDashboard(this);
193+
QCPlotsWebPart qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
194+
qcPlotsWebPart.revertToDefaultView();
193195
}
194196

195197
@Test
@@ -346,7 +348,7 @@ public void testQCPlotInputsPersistence()
346348
qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.PERCENT_OF_MEAN);
347349
qcPlotsWebPart.setGroupXAxisValuesByDate(true);
348350
qcPlotsWebPart.setShowAllPeptidesInSinglePlot(true, 1);
349-
qcPlotsWebPart.filterQCPlots(testDateStr, testDateStr, 1);
351+
qcPlotsWebPart.filterQCPlots(testDateStr, testDateStr, true);
350352
int count = qcPlotsWebPart.getPointElements("d", SvgShapes.CIRCLE.getPathPrefix(), true).size();
351353
assertEquals("Unexpected number of points for '" + testDateStr + "'", 21, count);
352354

@@ -543,10 +545,10 @@ public void testBadPlotDateRange()
543545
QCPlotsWebPart qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
544546
qcPlotsWebPart.filterQCPlotsToInitialData(PRECURSORS.length, true);
545547

546-
qcPlotsWebPart.filterQCPlots("2014-08-09", "2014-08-27", 0);
547-
548-
// reset to avoid test case dependency
549-
qcPlotsWebPart.resetInitialQCPlotFields();
548+
qcPlotsWebPart.filterQCPlots("2015-08-09", "2014-08-27", false);
549+
waitForText("Please enter an end date that does not occur before the start date.");
550+
qcPlotsWebPart.filterQCPlots("2014-08-09", "2014-08-27", false);
551+
waitForText("There were no records found");
550552
}
551553

552554
@Test
@@ -697,10 +699,10 @@ public void testRunScopedMetric()
697699
String ticPlotSVGText = qcPlotsWebPart.getSVGPlotText("precursorPlot0");
698700
assertFalse(ticPlotSVGText.isEmpty());
699701

700-
log("Verifying Show All Series Checkbox");
701-
assertElementNotVisible(Locator.tagContainingText("label", "Show All Series in a Single Plot"));
702+
log("Verifying combined/per-precursor plot controls");
703+
assertFalse(qcPlotsWebPart.isCombinedPlotControlVisible());
702704
qcPlotsWebPart.setMetric1Type(QCPlotsWebPart.MetricType.RETENTION);
703-
assertElementVisible(Locator.tagContainingText("label", "Show All Series in a Single Plot"));
705+
assertTrue(qcPlotsWebPart.isCombinedPlotControlVisible());
704706

705707
log("Verifying tic_area information in hover plot");
706708
qcPlotsWebPart.setMetric1Type(QCPlotsWebPart.MetricType.TIC_AREA);

0 commit comments

Comments
 (0)