2020import org .labkey .test .Locators ;
2121import org .labkey .test .WebDriverWrapper ;
2222import org .labkey .test .components .BodyWebPart ;
23- import org .labkey .test .components .ext4 .Checkbox ;
2423import org .labkey .test .components .ext4 .ComboBox ;
24+ import org .labkey .test .components .ext4 .RadioButton ;
2525import org .labkey .test .components .ext4 .Window ;
2626import org .labkey .test .util .Ext4Helper ;
2727import 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 );
0 commit comments