Skip to content

Commit

Permalink
Simplify the Time Clearing Code (#1906)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-danield authored May 1, 2024
1 parent ce4b178 commit 4b207de
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/org/labkey/test/tests/SurveyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.PortalHelper;
import org.labkey.test.util.WikiHelper;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;

import java.io.File;
Expand Down Expand Up @@ -152,15 +151,11 @@ public void testDateTimeWithExtConfig()
setFormElement(Locator.name(DATETIME_DATE_FIELD_NAME), dateTimeFieldDateValue);
assertEquals("'Date Time Field (date)' not set.", dateTimeFieldDateValue, getFormElement(Locator.name(DATETIME_DATE_FIELD_NAME)));

var dateTimeFieldTimeValue = "12:45";
final WebElement timeInput = Locator.name(DATETIME_TIME_FIELD_NAME).findElement(getDriver());
int attempt = 0;
while (attempt++ < 5 && !"".equals(getFormElement(Locator.name(DATETIME_TIME_FIELD_NAME))))
{
timeInput.clear();
shortWait();
}
assertEquals("'Date Time Field (time)' not cleared.", "", getFormElement(Locator.name(DATETIME_TIME_FIELD_NAME)));
timeInput.click();
timeInput.clear();
waitFor(()->timeInput.getText().isEmpty(), "'Date Time Field (time)' not cleared.",1_000);
var dateTimeFieldTimeValue = "12:45";
timeInput.sendKeys(dateTimeFieldTimeValue);
assertEquals("'Date Time Field (time)' not set.", dateTimeFieldTimeValue, getFormElement(Locator.name(DATETIME_TIME_FIELD_NAME)));

Expand Down

0 comments on commit 4b207de

Please sign in to comment.