MDL-67586 core_course: Recommended modules frontend
[moodle.git] / course / tests / behat / activity_chooser.feature
CommitLineData
37cf89b3
P
1@core @core_course @javascript
2Feature: Display and choose from the available activities in course
3 In order to add activities to a course
4 As a teacher
5 I should be enabled to choose from a list of available activities and also being able to read their summaries.
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher | Teacher | 1 | teacher@example.com |
11 And the following "courses" exist:
12 | fullname | shortname | format |
13 | Course | C | topics |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher | C | editingteacher |
17 And I log in as "teacher"
18 And I am on "Course" course homepage with editing mode on
19
20 Scenario: The available activities are displayed to the teacher in the activity chooser
21 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
22 Then I should see "Add an activity or resource" in the ".modal-title" "css_element"
23 And I should see "Assignment" in the ".modal-body" "css_element"
24
25 Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
26 Given I click on "Add an activity or resource" "button" in the "Topic 3" "section"
27 When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
28 Then I should see "Adding a new Assignment"
29 And I set the following fields to these values:
30 | Assignment name | Test Assignment Topic 3 |
31 And I press "Save and return to course"
32 Then I should see "Test Assignment Topic 3" in the "Topic 3" "section"
33
34 Scenario: The teacher can choose to add an activity from the activity summary in the activity chooser
35 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
36 When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
37 When I click on "Add a new Assignment" "link" in the "help" "core_course > Activity chooser screen"
38 Then I should see "Adding a new Assignment"
39
40 Scenario: Show summary
41 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
42 When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
43 Then I should see "Assignment" in the "help" "core_course > Activity chooser screen"
44 And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
45
46 Scenario: Hide summary
47 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
48 When I click on "Information about the Assignment activity" "button" in the "modules" "core_course > Activity chooser screen"
49 And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "help" "core_course > Activity chooser screen"
50 And I should see "Back" in the "help" "core_course > Activity chooser screen"
51 When I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
52 Then "modules" "core_course > Activity chooser screen" should exist
53 And "help" "core_course > Activity chooser screen" should not exist
54 And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
55 And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
c58c23d6 56
e04b4be6
MM
57 Scenario: View recommended activities
58 When I log out
59 And I log in as "admin"
60 And I am on site homepage
61 And I navigate to "Courses > Recommended activities" in site administration
62 And I click on ".activity-recommend-checkbox" "css_element" in the "Book" "table_row"
63 # Setup done, lets check it works with a teacher.
64 And I log out
65 And I log in as "teacher"
66 And I am on "Course" course homepage with editing mode on
67 And I open the activity chooser
68 Then I should see "Recommended" in the "Add an activity or resource" "dialogue"
69 And I click on "Recommended" "link" in the "Add an activity or resource" "dialogue"
70 And I should see "Book" in the "recommended" "core_course > Activity chooser tab"