Skip to content

Commit

Permalink
MDL-80151 behat: add calendar step to navigate to specific view
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Dec 18, 2023
1 parent 513f3b0 commit 2321dc3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions calendar/tests/behat/behat_calendar.php
Expand Up @@ -179,4 +179,21 @@ public function i_am_viewing_site_calendar() {
$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]);
}
}
2 changes: 1 addition & 1 deletion mod/chat/tests/behat/chat_calendar_events.feature
Expand Up @@ -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
Expand Down

0 comments on commit 2321dc3

Please sign in to comment.