MDL-75714 navigation: Cover a couple of situations with behat

- Guest user attempting to access to single-activity course.
- Not enrolled user attempt to access to single-activity course.

Both should, by default, land to the "cannot access/enrol" page.
This commit is contained in:
Eloy Lafuente (stronk7)
2022-09-14 23:35:19 +02:00
parent 8e371f138a
commit d1bf45ec18
@@ -9,6 +9,7 @@ Feature: Activity navigation in a single activity course
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | format | activitytype |
| Course 1 | C1 | singleactivity | forum |
@@ -65,3 +66,13 @@ Feature: Activity navigation in a single activity course
Then "#prev-activity-link" "css_element" should not exist
And "#next-activity-link" "css_element" should not exist
And "Jump to..." "field" should not exist
Scenario: The activity navigation asks for login to guest user
Given I log in as "guest"
When I am on "Course 1" course homepage
Then I should see "Guests cannot access this course. Please log in"
Scenario: The activity navigation asks for login to not enrolled user
Given I log in as "student2"
When I am on "Course 1" course homepage
Then I should see "You cannot enrol yourself in this course"