Skip to content

Commit

Permalink
MDL-71817 calendar: behat changes for calendar block
Browse files Browse the repository at this point in the history
This commit does few things:

1) Remove unnecessary "I hover over today in the calendar"
steps as it's not necessary to hover onto the day to see the events
any more.

2) Replace "I follow This month" steps to "I follow Full calendar"

3) Update i_create_a_calendar_event_with_form_data() to use the new
fullcalendar lang string.
  • Loading branch information
lameze committed Jul 22, 2021
1 parent 73a14b1 commit b013390
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 48 deletions.
13 changes: 2 additions & 11 deletions blocks/calendar_month/tests/behat/block_calendar_month.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Feature: Enable the calendar block in a course and test it's functionality
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Calendar" block
And I hover over today in the calendar
Then I should see "Site Event"

@javascript
Expand All @@ -53,7 +52,6 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_name | Course Event |
And I am on "Course 1" course homepage
And I follow "Hide site events"
And I hover over today in the calendar
Then I should not see "Site Event"
And I should see "Course Event"

Expand All @@ -66,7 +64,6 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_eventtype | Course |
| id_name | Course Event |
When I am on "Course 1" course homepage
And I hover over today in the calendar
Then I should see "Course Event"

@javascript
Expand All @@ -83,7 +80,6 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_name | User Event |
And I am on "Course 1" course homepage
And I follow "Hide course events"
And I hover over today in the calendar
Then I should not see "Course Event"
And I should see "User Event"

Expand All @@ -96,7 +92,6 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_eventtype | User |
| id_name | User Event |
When I am on "Course 1" course homepage
And I hover over today in the calendar
Then I should see "User Event"

@javascript
Expand All @@ -113,7 +108,6 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_name | User Event |
When I am on "Course 1" course homepage
And I follow "Hide user events"
And I hover over today in the calendar
Then I should not see "User Event"
And I should see "Course Event"

Expand All @@ -136,7 +130,7 @@ Feature: Enable the calendar block in a course and test it's functionality
And I press "Save and display"
And I turn editing mode on
And I add the "Calendar" block
And I click on "This month" "link"
And I click on "Full calendar" "link"
And I click on "New event" "button"
And I set the following fields to these values:
| id_eventtype | Group |
Expand All @@ -147,12 +141,10 @@ Feature: Enable the calendar block in a course and test it's functionality
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
And I hover over today in the calendar
And I should see "Group Event"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I hover over today in the calendar
And I should not see "Group Event"

@javascript
Expand All @@ -178,7 +170,7 @@ Feature: Enable the calendar block in a course and test it's functionality
| id_eventtype | Course |
| id_name | Course Event 1 |
And I am on "Course 1" course homepage
And I click on "This month" "link"
And I click on "Full calendar" "link"
And I click on "New event" "button"
And I set the following fields to these values:
| id_eventtype | Group |
Expand All @@ -190,6 +182,5 @@ Feature: Enable the calendar block in a course and test it's functionality
Then I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Hide group events"
And I hover over today in the calendar
And I should not see "Group Event 1"
And I should see "Course Event 1"
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ Feature: Enable the calendar block in a course
Then I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Calendar" block
And I hover over today in the calendar
And I should see "Site Event"
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ Feature: View a site event on the dashboard
| id_name | Site Event |
And I log out
When I log in as "student1"
And I hover over today in the calendar
Then I should see "Site Event"
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Feature: Enable the calendar block on the site front page
And I log out
When I log in as "student1"
And I am on site homepage
And I hover over today in the calendar
Then I should see "Site Event"
2 changes: 1 addition & 1 deletion calendar/tests/behat/behat_calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class behat_calendar extends behat_base {
*/
public function i_create_a_calendar_event_with_form_data($data) {
// Go to current month page.
$this->execute("behat_general::click_link", get_string('monththis', 'calendar'));
$this->execute("behat_general::click_link", get_string('fullcalendar', 'calendar'));

// Create event.
$this->i_create_a_calendar_event($data);
Expand Down
32 changes: 16 additions & 16 deletions calendar/tests/behat/calendar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ Feature: Perform basic calendar functionality
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
And I should see "Really awesome event!"
And I log out
And I log in as "student2"
And I follow "This month"
And I follow "Full calendar"
And I should see "Really awesome event!"

@javascript
Expand All @@ -61,13 +61,13 @@ Feature: Perform basic calendar functionality
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
And I click on "Really awesome event!" "link"
And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
And I click on "Close" "button"
And I log out
And I log in as "student2"
And I follow "This month"
And I follow "Full calendar"
Then I should not see "Really awesome event!"

@javascript
Expand All @@ -82,7 +82,7 @@ Feature: Perform basic calendar functionality
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
Then I follow "Really awesome event!"

@javascript
Expand All @@ -95,7 +95,7 @@ Feature: Perform basic calendar functionality
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
Then I should not see "Really awesome event!"

@javascript
Expand All @@ -106,7 +106,7 @@ Feature: Perform basic calendar functionality
| Event title | Really awesome event! |
| Description | Come join this awesome event, sucka! |
And I am on "Course 1" course homepage
When I follow "This month"
When I follow "Full calendar"
And I click on "Really awesome event!" "link"
And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
And I click on "Delete event" "button"
Expand All @@ -122,7 +122,7 @@ Feature: Perform basic calendar functionality
| Description | Come join this awesome event, sucka! |
| Location | Cube office |
And I am on "Course 1" course homepage
When I follow "This month"
When I follow "Full calendar"
And I click on "Really awesome event!" "link"
And ".location-content" "css_element" should exist
And I should see "Cube office"
Expand All @@ -144,7 +144,7 @@ Feature: Perform basic calendar functionality
And the following "activities" exist:
| activity | course | idnumber | name | intro | timeopen | timeclose |
| choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
When I follow "This month"
When I follow "Full calendar"
Then I should see "Test choice opens"
And I should see "Test choice closes"
When I click on "Test choice opens" "link"
Expand All @@ -155,7 +155,7 @@ Feature: Perform basic calendar functionality
And I wait to be redirected
Then I should see "Test choice"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
When I click on "Test choice closes" "link"
Then "Delete" "button" should not exist in the "Test choice closes" "dialogue"
And "Edit" "button" should not exist in the "Test choice closes" "dialogue"
Expand All @@ -168,12 +168,12 @@ Feature: Perform basic calendar functionality
Scenario: Attempt to create event without fill required fields should display validation errors
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
And I click on "New event" "button"
When I click on "Save" "button"
Then I should see "Required" in the "Event title" "form_row"
And I am on homepage
And I follow "This month"
And I follow "Full calendar"
And I click on "New event" "button"
And I set the field "Event title" to "Really awesome event!"
And I set the field "Type of event" to "Course"
Expand All @@ -187,7 +187,7 @@ Feature: Perform basic calendar functionality
And I click on "New event" "button"
Then the field "Type of event" matches value "User"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
When I click on "New event" "button"
Then the field "Type of event" matches value "Course"

Expand Down Expand Up @@ -223,7 +223,7 @@ Feature: Perform basic calendar functionality
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
And I click on "Close" "button"
Expand All @@ -235,15 +235,15 @@ Feature: Perform basic calendar functionality
And I log out
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"

@javascript @accessibility
Scenario: The calendar page must be accessible
Given I log in as "student1"
And I am on "Course 1" course homepage
When I follow "This month"
When I follow "Full calendar"
Then the page should meet accessibility standards
And the page should meet "wcag131, wcag143, wcag412" accessibility standards
And the page should meet accessibility standards with "wcag131, wcag143, wcag412" extra tests
2 changes: 1 addition & 1 deletion calendar/tests/behat/calendar_lookahead.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Limit displayed upcoming events
Given I am on "Course 1" course homepage with editing mode on
And I add the "Calendar" block
And I add the "Upcoming events" block
And I follow "This month"
And I follow "Full calendar"
And I click on "a.next" "css_element"
And I click on "a.next" "css_element"
When I create a calendar event:
Expand Down
12 changes: 6 additions & 6 deletions calendar/tests/behat/export.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@ Feature: Export calendar events
And I log in as "student1"

Scenario: Viewing calendar export options
Given I follow "This month"
Given I follow "Full calendar"
When I click on "Export calendar" "link"
Then I should see "All events"
And I should see "Events related to courses"
And I should see "Events related to groups"
And I should see "My personal events"

Scenario: Generating calendar URL for all events
Given I follow "This month"
Given I follow "Full calendar"
And I click on "Export calendar" "link"
And I set the field "All events" to "1"
And I set the field "Recent and next 60 days" to "1"
When I click on "Get calendar URL" "button"
Then the "value" attribute of "Calendar URL" "field" should contain "&preset_what=all&"

Scenario: Generating calendar URL for course events
Given I follow "This month"
Given I follow "Full calendar"
And I click on "Export calendar" "link"
And I set the field "Events related to courses" to "1"
And I set the field "Recent and next 60 days" to "1"
When I click on "Get calendar URL" "button"
Then the "value" attribute of "Calendar URL" "field" should contain "&preset_what=courses&"

Scenario: Generating calendar URL for group events
Given I follow "This month"
Given I follow "Full calendar"
And I click on "Export calendar" "link"
And I set the field "Events related to groups" to "1"
And I set the field "Recent and next 60 days" to "1"
When I click on "Get calendar URL" "button"
Then the "value" attribute of "Calendar URL" "field" should contain "&preset_what=groups&"

Scenario: Generating calendar URL for category events
Given I follow "This month"
Given I follow "Full calendar"
And I click on "Export calendar" "link"
And I set the field "Events related to categories" to "1"
And I set the field "Recent and next 60 days" to "1"
When I click on "Get calendar URL" "button"
Then the "value" attribute of "Calendar URL" "field" should contain "&preset_what=categories&"

Scenario: Generating calendar URL for user events
Given I follow "This month"
Given I follow "Full calendar"
And I click on "Export calendar" "link"
And I set the field "My personal events" to "1"
And I set the field "Recent and next 60 days" to "1"
Expand Down
12 changes: 4 additions & 8 deletions calendar/tests/behat/minicalendar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Open calendar popup

@javascript
Scenario: I view calendar details of a day with multiple events
Given I follow "This month"
Given I follow "Full calendar"
And I create a calendar event:
| Type of event | site |
| Event title | Event 1:1 |
Expand All @@ -27,23 +27,19 @@ Feature: Open calendar popup
| Type of event | site |
| Event title | Event 1:2 |
| timestart[day] | 1 |
And I reload the page
When I hover over day "1" of this month in the calendar
When I reload the page
Then I should see "Event 1:1"
And I should see "Event 1:2"
And I follow "Home"
And I hover over day "1" of this month in the calendar
And I should see "Event 1:1"
And I should see "Event 1:2"

@javascript
Scenario: I view calendar details for today
Given I follow "This month"
And I create a calendar event:
Given I follow "Full calendar"
When I create a calendar event:
| Type of event | site |
| Event title | Today's event |
When I hover over today in the calendar
Then I should see "Today's event"
And I follow "Home"
And I hover over today in the calendar
And I should see "Today's event"
2 changes: 1 addition & 1 deletion lib/tests/behat/action_modal.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: Close modals by clicking outside them
@javascript
Scenario: The popup closes when clicked on dead space - Modal
Given I log in as "admin"
And I follow "This month"
And I follow "Full calendar"
And I press "New event"
When I click on "[data-region='modal-container']" "css_element"
# The modal does not close becaue it contains a form.
Expand Down
2 changes: 1 addition & 1 deletion mod/assign/tests/behat/set_availability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Feature: Set availability dates for an assignment
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "This month"
And I follow "Full calendar"
When I hover over day "2" of this month in the calendar
Then I should see "C1: Assignment name is due"

Expand Down

0 comments on commit b013390

Please sign in to comment.