MDL-71500 calendar_threemonth: add behat step and coverage
This commit is contained in:
@@ -77,6 +77,30 @@ class behat_calendar extends behat_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click a specific day in the calendar.
|
||||
*
|
||||
* @Given /^I click day "(?P<dayofmonth>\d+)" of this month in the calendar$/
|
||||
* @param int $day The day of the current month
|
||||
*/
|
||||
public function i_click_day_of_this_month_in_calendar($day) {
|
||||
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
|
||||
// The current month table.
|
||||
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
|
||||
|
||||
// Strings for the class cell match.
|
||||
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
|
||||
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
|
||||
$daycell = "td[{$cellclasses}]";
|
||||
$dayofmonth = "a[{$daycontains}]";
|
||||
|
||||
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
|
||||
$this->execute("behat_general::wait_until_the_page_is_ready");
|
||||
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
|
||||
$this->execute("behat_general::wait_until_the_page_is_ready");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hover over a specific day in the calendar.
|
||||
*
|
||||
@@ -96,8 +120,7 @@ class behat_calendar extends behat_base {
|
||||
|
||||
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
|
||||
$this->execute("behat_general::wait_until_the_page_is_ready");
|
||||
$this->execute("behat_general::i_hover", array($xpath, "xpath_element"));
|
||||
|
||||
$this->execute("behat_general::i_hover", [$xpath, "xpath_element"]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,23 @@ Feature: Open calendar popup
|
||||
And I should see "Event 1:1"
|
||||
And I should see "Event 1:2"
|
||||
|
||||
@javascript
|
||||
Scenario: I view a day event then another day event
|
||||
Given I follow "This month"
|
||||
And I create a calendar event:
|
||||
| Type of event | site |
|
||||
| Event title | Event 3:1 |
|
||||
| timestart[day] | 3 |
|
||||
And I create a calendar event:
|
||||
| Type of event | site |
|
||||
| Event title | Event 4:1 |
|
||||
| timestart[day] | 4 |
|
||||
And I reload the page
|
||||
When I click day "3" of this month in the calendar
|
||||
Then I should see "Event 3:1" in the ".eventlist" "css_element"
|
||||
And I click day "4" of this month in the calendar
|
||||
And I should see "Event 4:1" in the ".eventlist" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario: I view calendar details for today
|
||||
Given I follow "This month"
|
||||
|
||||
Reference in New Issue
Block a user