From 26e8b4a0fa44fe77e8b3a43fad90db016a69042c Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sat, 17 Apr 2021 00:45:55 +0200 Subject: [PATCH] MDL-71364 behat: fix randomness causes by "now" advancing Some recent tests do set a date time element to ##now## or tomorrow and, immediately after that the look if, effectively, ##now## and #tomorrow# have been set (with minutes resolution). Problem is that, between the field is set and the field is verified, it can happen that the time advances to next minute (from H:M:59 to H:M+1:00) and then the assertion fails. To avoid this, we could have lowered the resolution to be hours... but that doesn't solve the problem just makes it to happen less often. So, instead of that... we are setting the 2 now and tomorrow cases to be "today noon" and "tomorrow noon" (12:00:00) so we ensure they won't be ever in the risk of jumping of minute. --- lib/tests/behat/datetime_any.feature | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/tests/behat/datetime_any.feature b/lib/tests/behat/datetime_any.feature index cb18187d13b..9c0b8b23b9b 100644 --- a/lib/tests/behat/datetime_any.feature +++ b/lib/tests/behat/datetime_any.feature @@ -22,12 +22,12 @@ Feature: Any day / month / year combination in date form elements works ok. Then I should see "" in the "Due date" "table_row" Examples: - | initial_date | final_date | date_result | case_explanation (times Australia/Perth) | - | ##now## | ##tomorrow## | ##tomorrow##%A, %d %B %Y, %I:%M## | change of day, any day, back and forth | - | ##tomorrow## | ##now## | ##now##%A, %d %B %Y, %I:%M## | | - | 1617256800 | 1617170400 | Wednesday, 31 March 2021, 2:00 | change of month, back and forth | - | 1617170400 | 1617256800 | Thursday, 1 April 2021, 2:00 | | - | 1740808800 | 1709186400 | Thursday, 29 February 2024, 2:00 | change of month, leap year, back and forth | - | 1709186400 | 1740808800 | Saturday, 1 March 2025, 2:00 | | - | 1577858400 | 1577772000 | Tuesday, 31 December 2019, 2:00 | change of year, back and forth | - | 1577772000 | 1577858400 | Wednesday, 1 January 2020, 2:00 | | + | initial_date | final_date | date_result | case_explanation (times Australia/Perth) | + | ##today## | ##tomorrow noon## | ##tomorrow noon##%A, %d %B %Y, %I:%M## | change of day, any day, back and forth | + | ##tomorrow## | ##today noon## | ##today noon##%A, %d %B %Y, %I:%M## | | + | 1617256800 | 1617170400 | Wednesday, 31 March 2021, 2:00 | change of month, back and forth | + | 1617170400 | 1617256800 | Thursday, 1 April 2021, 2:00 | | + | 1740808800 | 1709186400 | Thursday, 29 February 2024, 2:00 | change of month, leap year, back and forth | + | 1709186400 | 1740808800 | Saturday, 1 March 2025, 2:00 | | + | 1577858400 | 1577772000 | Tuesday, 31 December 2019, 2:00 | change of year, back and forth | + | 1577772000 | 1577858400 | Wednesday, 1 January 2020, 2:00 | |