Skip to content

Commit 480b10b

Browse files
Use applyExpectingError pattern
1 parent 342c6b7 commit 480b10b

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,17 @@ public String getEndDate()
7272
return elementCache().endDate.get();
7373
}
7474

75-
public PeptideSummaryWebPart apply(boolean wait)
75+
public PeptideSummaryWebPart apply()
7676
{
77-
if (wait)
78-
{
79-
doAndWaitForElementToRefresh(() -> elementCache().applyButton.findElement(this).click(),
80-
elementCache().heatmapLoc, getWrapper().defaultWaitForPage);
81-
}
82-
else
83-
{
84-
elementCache().applyButton.findElement(this).click();
85-
}
77+
doAndWaitForElementToRefresh(() -> elementCache().applyButton.findElement(this).click(),
78+
elementCache().heatmapLoc, getWrapper().defaultWaitForPage);
79+
return this;
80+
}
8681

82+
public PeptideSummaryWebPart applyExpectingError(String error)
83+
{
84+
elementCache().applyButton.findElement(this).click();
85+
getWrapper().assertTextPresent(error);
8786
return this;
8887
}
8988

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,13 @@ public void testHeatMapColorAndValues()
8787

8888
log("Verify invalid date combos produce helpful errors");
8989
peptideSummaryHeatMap.setCustomDateRange("2013-08-15", "2013-08-01");
90-
peptideSummaryHeatMap.apply(false);
91-
assertTextPresent("Please choose a start date that is before the end date.");
90+
peptideSummaryHeatMap.applyExpectingError("Please choose a start date that is before the end date.");
9291
peptideSummaryHeatMap.setCustomDateRange(null, "2013-08-01");
93-
peptideSummaryHeatMap.apply(false);
94-
assertTextPresent("Please select both start and end dates.");
92+
peptideSummaryHeatMap.applyExpectingError("Please select both start and end dates.");
9593

9694
log("Verify Custom date range");
9795
peptideSummaryHeatMap.setCustomDateRange("2013-08-01", "2013-08-15");
98-
peptideSummaryHeatMap.apply(true);
96+
peptideSummaryHeatMap.apply();
9997
verifyDataCustomRange(peptideSummaryHeatMap);
10098

10199
log("Verify Custom -> standard -> custom toggling");

0 commit comments

Comments
 (0)