Skip to content

Commit fedd23d

Browse files
authored
Create QC annotation directly from plots (#1147)
1 parent 2dccc33 commit fedd23d

File tree

2 files changed

+366
-6
lines changed

2 files changed

+366
-6
lines changed

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

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.labkey.test.SortDirection;
2727
import org.labkey.test.TestFileUtils;
2828
import org.labkey.test.components.ext4.RadioButton;
29+
import org.labkey.test.components.ext4.Window;
2930
import org.labkey.test.components.html.SiteNavBar;
3031
import org.labkey.test.components.targetedms.GuideSet;
3132
import org.labkey.test.components.targetedms.QCAnnotationTypeWebPart;
@@ -255,6 +256,7 @@ public void testQCAnnotations()
255256
QCPlotsWebPart qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
256257
qcPlotsWebPart.filterQCPlotsToInitialData(PRECURSORS.length, true);
257258
checkForCorrectAnnotations("Individual Plots", qcPlotsWebPart);
259+
verifyAddAnnotationsFromQCPlots();
258260
}
259261

260262
@Test
@@ -1056,4 +1058,87 @@ private void checkForCorrectAnnotations(String plotType, QCPlotsWebPart qcPlotsW
10561058
assertEquals("Wrong annotations in " + plotType + ":" + plot.getPrecursor(), expectedAnnotations, plotAnnotations);
10571059
}
10581060
}
1061+
1062+
private void verifyAddAnnotationsFromQCPlots()
1063+
{
1064+
log("Testing add annotation from QC plots");
1065+
PanoramaDashboard qcDashboard = new PanoramaDashboard(this);
1066+
QCPlotsWebPart qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
1067+
1068+
// Hover over the add annotation button and verify tooltip
1069+
Locator addAnnotationButton = Locator.tagWithClass("path", "add-annotation");
1070+
scrollIntoView(addAnnotationButton);
1071+
mouseOver(addAnnotationButton);
1072+
1073+
// Click the add annotation button
1074+
click(addAnnotationButton);
1075+
Window<?> addAnnotationDialog = new Window.WindowFinder(getDriver()).withTitle("Add Annotation").waitFor();
1076+
1077+
// Select an annotation type
1078+
_ext4Helper.selectComboBoxItem(Ext4Helper.Locators.formItemWithInputNamed("annotationType"), Ext4Helper.TextMatchTechnique.CONTAINS, instrumentChange.getType());
1079+
1080+
// Enter comment
1081+
String testComment = "Test annotation from QC plot";
1082+
setFormElement(Locator.name("description"), testComment);
1083+
1084+
// Click the save button
1085+
addAnnotationDialog.clickButton("Save", true);
1086+
_ext4Helper.waitForMaskToDisappear();
1087+
1088+
// Wait for the plots to refresh
1089+
refresh();
1090+
qcDashboard = new PanoramaDashboard(this);
1091+
qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
1092+
qcPlotsWebPart.waitForReady();
1093+
1094+
// Verify the annotation appears in the QC plots
1095+
QCHelper.Annotation testAnnotation = new QCHelper.Annotation(instrumentChange.getType(), testComment);
1096+
List<QCPlot> qcPlots = qcPlotsWebPart.getPlots();
1097+
boolean annotationFound = false;
1098+
for (QCPlot plot : qcPlots)
1099+
{
1100+
List<QCHelper.Annotation> annotations = plot.getAnnotations();
1101+
for (QCHelper.Annotation annotation : annotations)
1102+
{
1103+
if (annotation.getType().equals(testAnnotation.getType()) &&
1104+
annotation.getDescription().equals(testAnnotation.getDescription()))
1105+
{
1106+
annotationFound = true;
1107+
break;
1108+
}
1109+
}
1110+
if (annotationFound)
1111+
break;
1112+
}
1113+
assertTrue("Newly added annotation should appear in QC plots", annotationFound);
1114+
1115+
Locator deleteAnnotation = Locator.tagWithClass("path", "annotation");
1116+
mouseOver(deleteAnnotation);
1117+
click(deleteAnnotation);
1118+
addAnnotationDialog = new Window.WindowFinder(getDriver()).withTitle("Edit Annotation").waitFor();
1119+
addAnnotationDialog.clickButton("Delete", 0);
1120+
waitForText("Are you sure you want to delete this annotation?");
1121+
clickButton("Yes", 0);
1122+
_ext4Helper.waitForMaskToDisappear();
1123+
1124+
refresh();
1125+
qcPlotsWebPart = qcDashboard.getQcPlotsWebPart();
1126+
annotationFound = false;
1127+
qcPlots = qcPlotsWebPart.getPlots();
1128+
for (QCPlot plot : qcPlots)
1129+
{
1130+
List<QCHelper.Annotation> annotations = plot.getAnnotations();
1131+
for (QCHelper.Annotation annotation : annotations)
1132+
{
1133+
if (annotation.getType().equals(testAnnotation.getType()) &&
1134+
annotation.getDescription().equals(testAnnotation.getDescription()))
1135+
{
1136+
annotationFound = true;
1137+
break;
1138+
}
1139+
}
1140+
}
1141+
assertFalse("Newly deleted annotation should not appear in QC plots", annotationFound);
1142+
}
1143+
10591144
}

0 commit comments

Comments
 (0)