MDL-59602 course: Use course navigation for course nav test
[moodle.git] / course / tests / behat / navigate_course_list.feature
CommitLineData
314a2210
MG
1@core @core_course
2Feature: Browse course list and return back from enrolment page
3 In order to navigate between course list consistently
4 As a user
5 I need to be able to return back from enrolment page
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | user1 | User | 1 | user1@example.com |
11 | user2 | User | 2 | user2@example.com |
314a2210
MG
12 And the following "categories" exist:
13 | name | category | idnumber |
14 | Sample category | 0 | CAT1 |
15 And the following "courses" exist:
16 | fullname | shortname | category |
17 | Sample course | C1 | 0 |
18 | Course 1 | COURSE1 | CAT1 |
19
314a2210
MG
20 Scenario: A user can return to the category page from enrolment page
21 When I log in as "user2"
e5287f9b 22 And I am on course index
314a2210
MG
23 And I follow "Miscellaneous"
24 And I follow "Sample course"
25 And I press "Continue"
26 Then I should see "Courses" in the ".breadcrumb-nav" "css_element"
27 And I click on "Courses" "link" in the ".breadcrumb-nav" "css_element"
28 And I follow "Sample category"
197e2bca 29 And I am on "Course 1" course homepage
314a2210
MG
30 And I press "Continue"
31 And I should see "Sample category" in the ".breadcrumb-nav" "css_element"
32
33 @javascript
34 Scenario: A user can return to the previous page from enrolment page by clicking navigation links
7a12a02d
MG
35 Given I log in as "admin"
36 And I am on site homepage
37 And I turn editing mode on
38 And I add the "Navigation" block if not present
39 And I configure the "Navigation" block
40 And I set the following fields to these values:
41 | Page contexts | Display throughout the entire site |
42 And I press "Save changes"
43 And I log out
314a2210 44 When I log in as "user2"
353e7876 45 And I open my profile in edit mode
314a2210
MG
46 And I expand "Courses" node
47 And I expand "Sample category" node
b4a4fa6a 48 And I follow "Course 1"
314a2210
MG
49 And I press "Continue"
50 Then I should see "Edit profile" in the ".breadcrumb-nav" "css_element"
51
314a2210
MG
52 Scenario: User can return to the choice activity from enrolment page
53 Given the following "roles" exist:
54 | name | shortname | description | archetype |
55 | Non-enrolled | custom1 | My custom role 1 | user |
56 And the following "role assigns" exist:
57 | user | role | contextlevel | reference |
58 | user1 | custom1 | Course | C1 |
59 And the following "activities" exist:
60 | activity | name | intro | course | idnumber |
61 | choice | Test choice | Test choice description | C1 | choice1 |
62 And I log in as "admin"
63 And I set the following system permissions of "Non-enrolled" role:
64 | capability | permission |
65 | moodle/course:view | Allow |
66 And I log out
67 When I log in as "user1"
e5287f9b 68 And I am on course index
314a2210
MG
69 And I follow "Miscellaneous"
70 And I follow "Sample course"
71 And I follow "Test choice"
72 And I should see "Sorry, only enrolled users are allowed to make choices."
73 And I press "Enrol me in this course"
74 And I press "Continue"
75 Then I should see "Test choice" in the ".breadcrumb-nav" "css_element"