MDL-80151 behat: add calendar step to navigate to specific view

This commit is contained in:
Simey Lameze
2023-12-20 16:32:55 +08:00
parent f58df6fa88
commit 5378285a9a
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -179,4 +179,21 @@ class behat_calendar extends behat_base {
$url = new moodle_url('/calendar/view.php', ['view' => 'month']);
$this->execute('behat_general::i_visit', [$url]);
}
/**
* Navigate to a specific view in the calendar.
*
* @Given /^I am viewing calendar in "([^"]+)" view$/
* @param string $view The calendar view ('month', 'day' and 'upcoming') to navigate to.
* @return void
*/
public function i_am_viewing_calendar_in_view(string $view): void {
if (!in_array($view, ['month', 'day', 'upcoming'])) {
throw new Exception("Invalid calendar view. Allowed values are: 'month', 'day' and 'upcoming'");
}
$url = new moodle_url('/calendar/view.php', ['view' => $view]);
$this->execute('behat_general::i_visit', [$url]);
}
}
@@ -22,7 +22,7 @@ Feature: Chat calendar entries
| activity | name | intro | course | idnumber | schedule |
| chat | Test chat name | Test chat description | C1 | chat1 | 0 |
And I log in as "teacher1"
When I follow "Calendar" in the user menu
When I am viewing calendar in "upcoming" view
Then I should not see "Test chat name"
Scenario: Create a chat activity and publish the start date to the calendar