MDL-68846 behat: Avoid asserting AM/PM strings. They are not cross-os
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 27 May 2020 15:55:32 +0000 (17:55 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 27 May 2020 15:55:32 +0000 (17:55 +0200)
The exists/contains steps of behat are case-sensitive, in the other
side, depending of the OS and locales, time functions are not 100%
consistent. See https://bugs.php.net/bug.php?id=76378 for example.

So only solutions are:

1) Create a specific new step performing the checks case insensitively.
2) Avoid making AM / PM part of the checks.

Here we have opted by the 2nd approach, it's not critical part to check.

mod/forum/report/summary/tests/behat/course_summary.feature
mod/forum/report/summary/tests/behat/summary_data_post_dates.feature

index 473bdad..2206b60 100644 (file)
@@ -61,11 +61,11 @@ Feature: Course level forum summary report
     And I navigate to "Forum summary report" in current page administration
     And I should see "Export posts"
     And the following should exist in the "forumreport_summary_table" table:
-    # |                      | Discussions | Replies |                                    |                                   |
-      | First name / Surname | -3-         | -4-     | Earliest post                      | Most recent post                  |
-      | Student 1            | 1           | 1       | Thursday, 28 March 2019, 11:50 AM  | Thursday, 6 June 2019, 6:40 PM    |
-      | Student 2            | 0           | 0       | -                                  | -                                 |
-      | Teacher 1            | 1           | 2       | Wednesday, 27 March 2019, 12:10 PM | Wednesday, 10 July 2019, 9:30 AM  |
+    # |                      | Discussions | Replies |                                 |                                |
+      | First name / Surname | -3-         | -4-     | Earliest post                   | Most recent post               |
+      | Student 1            | 1           | 1       | Thursday, 28 March 2019, 11:50  | Thursday, 6 June 2019, 6:40    |
+      | Student 2            | 0           | 0       | -                               | -                              |
+      | Teacher 1            | 1           | 2       | Wednesday, 27 March 2019, 12:10 | Wednesday, 10 July 2019, 9:30  |
     And the following should not exist in the "forumreport_summary_table" table:
       | First name / Surname |
       | Student 3            |
@@ -77,11 +77,11 @@ Feature: Course level forum summary report
     Then I select "All forums in course" from the "Forum selected" singleselect
     And I should not see "Export posts"
     And the following should exist in the "forumreport_summary_table" table:
-    # |                      | Discussions | Replies |                                    |                                     |
-      | First name / Surname | -3-         | -4-     | Earliest post                      | Most recent post                    |
-      | Student 1            | 2           | 3       | Thursday, 25 January 2018, 4:40 PM | Saturday, 25 January 2020, 11:50 AM |
-      | Student 2            | 0           | 0       | -                                  | -                                   |
-      | Teacher 1            | 4           | 3       | Sunday, 14 January 2018, 9:00 AM   | Thursday, 26 December 2019, 9:30 AM |
+    # |                      | Discussions | Replies |                                 |                                  |
+      | First name / Surname | -3-         | -4-     | Earliest post                   | Most recent post                 |
+      | Student 1            | 2           | 3       | Thursday, 25 January 2018, 4:40 | Saturday, 25 January 2020, 11:50 |
+      | Student 2            | 0           | 0       | -                               | -                                |
+      | Teacher 1            | 4           | 3       | Sunday, 14 January 2018, 9:00   | Thursday, 26 December 2019, 9:30 |
     And the following should not exist in the "forumreport_summary_table" table:
       | First name / Surname |
       | Student 3            |
@@ -95,9 +95,9 @@ Feature: Course level forum summary report
     And I follow "forum1"
     And I navigate to "Forum summary report" in current page administration
     And the following should exist in the "forumreport_summary_table" table:
-    # |                      | Discussions | Replies |                                    |                                    |
-      | First name / Surname | -2-         | -3-     | Earliest post                      | Most recent post                   |
-      | Student 1            | 0           | 1       | Thursday, 25 January 2018, 4:40 PM | Thursday, 25 January 2018, 4:40 PM |
+    # |                      | Discussions | Replies |                                 |                                 |
+      | First name / Surname | -2-         | -3-     | Earliest post                   | Most recent post                |
+      | Student 1            | 0           | 1       | Thursday, 25 January 2018, 4:40 | Thursday, 25 January 2018, 4:40 |
     And the following should not exist in the "forumreport_summary_table" table:
       | First name / Surname |
       | Student 2            |
@@ -110,9 +110,9 @@ Feature: Course level forum summary report
     And the "Forum selected" select box should not contain "forum4"
     Then I select "All forums in course" from the "Forum selected" singleselect
     And the following should exist in the "forumreport_summary_table" table:
-    # |                      | Discussions | Replies |                                    |                                     |
-      | First name / Surname | -2-         | -3-     | Earliest post                      | Most recent post                    |
-      | Student 1            | 2           | 3       | Thursday, 25 January 2018, 4:40 PM | Saturday, 25 January 2020, 11:50 AM |
+    # |                      | Discussions | Replies |                                 |                                  |
+      | First name / Surname | -2-         | -3-     | Earliest post                   | Most recent post                 |
+      | Student 1            | 2           | 3       | Thursday, 25 January 2018, 4:40 | Saturday, 25 January 2020, 11:50 |
     And the following should not exist in the "forumreport_summary_table" table:
       | First name / Surname |
       | Student 2            |
index 07fdff1..783db9f 100644 (file)
@@ -47,9 +47,9 @@ Feature: Post date columns data available
     And I am on "Course 1" course homepage
     And I follow "forum1"
     And I navigate to "Forum summary report" in current page administration
-    Then "Teacher 1" row "Earliest post" column of "forumreport_summary_table" table should contain "Tuesday, 2 January 2018, 9:00 AM"
-    Then "Teacher 1" row "Most recent post" column of "forumreport_summary_table" table should contain "Sunday, 1 September 2019, 7:00 AM"
-    Then "Student 1" row "Earliest post" column of "forumreport_summary_table" table should contain "Wednesday, 27 March 2019, 4:00 AM"
-    Then "Student 1" row "Most recent post" column of "forumreport_summary_table" table should contain "Wednesday, 27 March 2019, 1:00 PM"
+    Then "Teacher 1" row "Earliest post" column of "forumreport_summary_table" table should contain "Tuesday, 2 January 2018, 9:00"
+    Then "Teacher 1" row "Most recent post" column of "forumreport_summary_table" table should contain "Sunday, 1 September 2019, 7:00"
+    Then "Student 1" row "Earliest post" column of "forumreport_summary_table" table should contain "Wednesday, 27 March 2019, 4:00"
+    Then "Student 1" row "Most recent post" column of "forumreport_summary_table" table should contain "Wednesday, 27 March 2019, 1:00"
     Then "Student 2" row "Earliest post" column of "forumreport_summary_table" table should contain "-"
     Then "Student 2" row "Most recent post" column of "forumreport_summary_table" table should contain "-"