Commit 6972c504 authored by Rebecca Blundell's avatar Rebecca Blundell
Browse files

Bug 1711277 - Add a step to check dates

This commit adds a step for checking the date is in a page element
It takes a date as accepted by strtodate(), and an optional format
which can be a language string set by langconfig.php or a php date()

Change-Id: I8a5e57ab6cfb8e2d9fa05b44ff71fa9724d695d9
parent 5374019d
......@@ -1428,4 +1428,23 @@ JS;
fwrite(STDOUT, "\n\033[93m DEBUG: $text\033[0m\n\n");
* Takes a date in a format strtotime() can take and looks for it
* in the specified css element. The default format searched for is
* dd Month YYYY, hh:mm AM/PM. You can pass another format as a string
* defined in langconfig.php or directly as a php date() format.
* @Then I should see the date :date in the :element element
* @Then I should see the date :date in the :element element with the format :format
public function i_should_see_date($date, $element, $format = 'strftimedatetime') {
if (string_exists($format, 'langconfig')) {
$date = format_date(strtotime($date), $format);
else {
$date = date($format, strtotime($date));
$this->assertSession()->elementTextContains('css', $element, $date);
......@@ -33,5 +33,5 @@ Scenario: Adding collection to group (Bug 1448807)
Then I should see "Access rules were updated for 1 page"
And I choose "Groups" from main menu
And I follow "group 01"
And I should see "Updated" in the "#sharedcollectionlist" element
# the formats "strftimedate" and "j F Y" both resolve to dd Month YYYY, which is wanted here.
And I should see the date "today" in the "#sharedcollectionlist" element with the format "strftimedate"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment