Skip to content

Commit 20402de

Browse files
committed
Add WNPRC_EHRTest for Time of Day lovcombo multi-select
Adds testTreatmentTimeOfDayMultiSelect: opens the Treatments task Import Scheduled Treatments dialog, selects multiple Time of Day values in the string-valued lovcombo, and submits. It asserts the selection is retained and reaches the schedule query (alert 'No uncompleted treatments were found.') rather than the pre-fix validation alert 'Must provide room and time of day'. Exercises the LovCombo fix end-to-end. LabKey/internal-issues#1266
1 parent 1632bf8 commit 20402de

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4858,4 +4858,41 @@ public void testCageUIHomeDisplay() throws Exception {
48584858

48594859

48604860
}
4861+
4862+
// https://github.com/LabKey/internal-issues/issues/1266: the "Time of Day" multi-select (lovcombo) must
4863+
// retain string selections so they reach the schedule query. A bogus room makes the query empty, so a
4864+
// passing Submit reaches "No uncompleted treatments were found." instead of the pre-fix "Must provide
4865+
// room and time of day" validation alert.
4866+
@Test
4867+
public void testTreatmentTimeOfDayMultiSelect()
4868+
{
4869+
beginAt(buildURL("ehr", getContainerPath(), "manageTask.view?formtype=Treatments"));
4870+
WebElement titleEl = waitForElement(Locator.xpath("//input[@name='title' and not(contains(@class, 'disabled'))]"), WAIT_FOR_JAVASCRIPT);
4871+
waitForFormElementToEqual(titleEl, "Treatments");
4872+
4873+
log("Open the Import Scheduled Treatments dialog");
4874+
waitAndClick(Locator.extButton("Add Treatments"));
4875+
waitForElement(ExtHelper.Locators.formItemWithLabel("Time of Day:").notHidden(), WAIT_FOR_JAVASCRIPT);
4876+
4877+
log("Enter a (bogus) room and select multiple Time of Day values from the lovcombo");
4878+
_extHelper.setExtFormElementByLabel("Room:", "zz999");
4879+
_extHelper.selectComboBoxItem("Time of Day:", "AM");
4880+
_extHelper.selectComboBoxItem("Time of Day:", "Noon");
4881+
4882+
String selectedTimes = getLovComboValue("Time of Day:");
4883+
Assertions.assertThat(selectedTimes)
4884+
.as("Time of Day lovcombo dropped its selections (Issue 7144)")
4885+
.contains("AM").contains("Noon");
4886+
4887+
log("Submit; the selected times must pass validation and reach the schedule query");
4888+
_extHelper.clickExtButton("", "Submit", 0);
4889+
assertAlert("No uncompleted treatments were found.");
4890+
}
4891+
4892+
private String getLovComboValue(String label)
4893+
{
4894+
WebElement comboEl = ExtHelper.Locators.formItemWithLabel(label).notHidden().findElement(getDriver());
4895+
WebElement input = Locator.xpath(".//input[contains(@class, 'x-form-field')]").findElement(comboEl);
4896+
return getFormElement(input);
4897+
}
48614898
}

0 commit comments

Comments
 (0)