MOBILE-4009 course: Add behats to test guest access

main
Pau Ferrer Ocaña 2023-06-28 15:40:44 +02:00
parent 73addbf42e
commit 4e2cb51c53
2 changed files with 84 additions and 35 deletions

View File

@ -442,41 +442,6 @@ Feature: Test basic usage of one course in app
And I should find "Test scorm name" in the app And I should find "Test scorm name" in the app
And I should find "Test workshop name" in the app And I should find "Test workshop name" in the app
@lms_from4.0
Scenario: Guest access
Given I entered the course "Course 1" as "teacher1" in the app
And I press "Course summary" in the app
And I press "Open in browser" in the app
And I switch to the browser tab opened by the app
And I log in as "teacher1"
And I click on "Participants" "link"
And I select "Enrolment methods" from the "jump" singleselect
And I click on "Enable" "icon" in the "Guest access" "table_row"
And I close the browser tab opened by the app
Given I entered the app as "student2"
When I press "Site home" in the app
And I press "Available courses" in the app
And I press "Course 1" in the app
Then I should find "Course summary" in the app
And I should find "Course" in the app
When I press "View course" "ion-button" in the app
Then the header should be "Course 1" in the app
And I should find "Choice course 1" in the app
And I should find "assignment" in the app
And I should find "Test forum name" in the app
And I should find "Test chat name" in the app
And I should find "Web links" in the app
And I should find "Test feedback name" in the app
And I should find "Test glossary" in the app
And I should find "Quiz 1" in the app
And I should find "Test survey name" in the app
And I should find "Test wiki name" in the app
And I should find "Test lesson name" in the app
And I should find "Test scorm name" in the app
And I should find "Test workshop name" in the app
Scenario: View blocks on drawer Scenario: View blocks on drawer
Given the following "blocks" exist: Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion | configdata | | blockname | contextlevel | reference | pagetypepattern | defaultregion | configdata |

View File

@ -0,0 +1,84 @@
@core @core_course @app @javascript @enrol @enrol_guest
Feature: Test basic usage of guest access course in app
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | teacher | teacher1@example.com |
| student1 | Student | student | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | section |
| assign | C1 | assign1 | assignment | Test assignment description | 1 | 1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| wiki | Test wiki name | Test wiki | C1 | wiki | 0 |
@lms_from4.0
Scenario: Guest access without password (student)
Given I log in as "teacher1"
And I am on the "Course 1" "enrolment methods" page
And I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
And I press "Save changes"
And I entered the app as "student1"
When I press "Site home" in the app
And I press "Available courses" in the app
And I press "Course 1" in the app
Then I should find "Course summary" in the app
And I should find "Course" in the app
When I press "View course" "ion-button" in the app
Then the header should be "Course 1" in the app
And I should find "assignment" in the app
And I should find "Test wiki name" in the app
When I press "assignment" in the app
Then I should not find "Add submission" in the app
@lms_from4.3
Scenario: Guest access with password (student)
Given I log in as "teacher1"
And I am on the "Course 1" "enrolment methods" page
And I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
| Password | moodle_rules |
And I press "Save changes"
And I entered the app as "student1"
When I press "Site home" in the app
And I press "Available courses" in the app
And I press "Course 1" in the app
Then I should find "Course summary" in the app
And I should find "Course" in the app
And I should find "Guest access requires password" in the app
When I press "View course" "ion-button" in the app
And I set the following fields to these values in the app:
| Password | wrong |
And I press "Submit" "ion-button" in the app
Then I should find "Incorrect access password, please try again" in the app
# Show the hint.
Given the following config values are set as admin:
| showhint | 1 | enrol_guest |
When I press "Submit" "ion-button" in the app
Then I should find "That access password was incorrect, please try again" in the app
When I set the following fields to these values in the app:
| Password | moodle_rules |
And I press "Submit" "ion-button" in the app
Then the header should be "Course 1" in the app
And I should find "assignment" in the app
And I should find "Test wiki name" in the app
When I press "assignment" in the app
Then I should not find "Add submission" in the app