Skip to content

Commit 78dd7d7

Browse files
balu836balavengaiah.matam
andauthored
Fixed future data avoiding weekends and bank holidays (#46)
* added exception wait time out to handle tolerant methods * applied the changes as mentioned in the review comments for tolerant methods * Changed the method to package private to not expose this method * Added test to validate the tolerant method without passing wait time for method * changed the variable names for the TolerantAction object as mentioned * futureDataAvoidingWeekendsAndBankHolidays issue which need to avoid weekends when adding bank holidays count * added overload method for tolerantItemByIndex and tolerantItemByHtmlValueAttribute * resolved conflicts * changed from private package to public Co-authored-by: balavengaiah.matam <[email protected]>
1 parent 2d27654 commit 78dd7d7

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/main/java/uk/co/evoco/testdata/Dates.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public static String futureDataAvoidingWeekendsAndBankHolidays(
9898
bankHolidayCount++;
9999
}
100100
}
101-
futureDateTime = futureDateTime.plusDays(bankHolidayCount);
101+
futureDateTime=DateTime.parse(
102+
futureDateAvoidingWeekends(
103+
futureDateTime.toString(dateTimeFormatter),
104+
bankHolidayCount,
105+
dateFormat), dateTimeFormatter).toDateTime();
102106
return futureDateTime.toString(dateTimeFormatter);
103107
}
104108

src/main/java/uk/co/evoco/webdriver/utils/SelectBoxUtils.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public final class SelectBoxUtils extends TolerantInteraction {
1515

1616
/**
1717
* Selects an option that has a matching value attribute in the Options tag markup
18-
*
1918
* @param selectBox active WebElement, already located
2019
* @param htmlValue HTML value attribute
2120
*/
@@ -92,4 +91,27 @@ public static void tolerantItemByVisibleText(WebElement webElement, String visib
9291
TestConfigHelper.get().getTolerantActionWaitTimeoutInSeconds());
9392
}
9493

94+
/**
95+
* @param webElement active WebElement, already located
96+
* @param index index in order of display
97+
* @throws Throwable any unhandled or un-tolerated exception
98+
*/
99+
public static void tolerantItemByIndex(WebElement webElement, int index) throws Throwable {
100+
new SendKeysUtils().tolerantInteraction(
101+
webElement, SelectBoxInteractionType.BY_INDEX, Optional.empty(), Optional.of(index),
102+
TestConfigHelper.get().getTolerantActionWaitTimeoutInSeconds());
103+
}
104+
105+
/**
106+
* @param webElement active WebElement, already located
107+
* @param htmlValue HTML value attribute
108+
* @throws Throwable any unhandled or un-tolerated exception
109+
*/
110+
public static void tolerantItemByHtmlValueAttribute(WebElement webElement, String htmlValue)
111+
throws Throwable {
112+
new SendKeysUtils().tolerantInteraction(
113+
webElement, SelectBoxInteractionType.BY_VALUE, Optional.of(htmlValue), Optional.empty(),
114+
TestConfigHelper.get().getTolerantActionWaitTimeoutInSeconds());
115+
}
116+
95117
}

0 commit comments

Comments
 (0)