From 37199940575ecfdf75a9e057dd80079f387baf23 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 12 Dec 2014 10:19:13 +0800 Subject: [PATCH] MDL-48569 profile: behat test for user full profile access --- user/tests/behat/view_full_profile.feature | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 user/tests/behat/view_full_profile.feature diff --git a/user/tests/behat/view_full_profile.feature b/user/tests/behat/view_full_profile.feature new file mode 100644 index 00000000000..dc38c54bc42 --- /dev/null +++ b/user/tests/behat/view_full_profile.feature @@ -0,0 +1,65 @@ +@core @core_user +Feature: Access to full profiles of users + In order to allow visibility of full profiles + As an admin + I need to set global permission or disable forceloginforprofiles + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@asd.com | + | student2 | Student | 2 | student2@asd.com | + | teacher1 | Teacher | 1 | teacher1@asd.com | + And the following "courses" exist: + | fullname | shortname | format | + | Course 1 | C1 | topics | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + | student2 | C1 | student | + | teacher1 | C1 | editingteacher | + + Scenario: Viewing full profiles with default settings + When I log in as "student1" + And I follow "Course 1" + # Another student's full profile is not visible + And I navigate to "Participants" node in "Current course > C1" + And I follow "Student 2" + Then I should not see "Full profile" + # Teacher's full profile is visible + And I navigate to "Participants" node in "Current course > C1" + And I follow "Teacher 1" + And I follow "Full profile" + And I should see "First access to site" + # Own full profile is visible + And I follow "Course 1" + And I navigate to "Participants" node in "Current course > C1" + And I click on "Student 1" "link" in the "#participants" "css_element" + And I follow "Full profile" + And I should see "First access to site" + + @javascript + Scenario: Viewing full profiles with forceloginforprofiles off + Given I log in as "admin" + And I set the following administration settings values: + | Force users to log in for profiles | 0 | + And I log out + When I log in as "student1" + And I follow "Course 1" + And I navigate to "Participants" node in "Current course > C1" + And I follow "Student 2" + And I follow "Full profile" + Then I should see "First access to site" + + @javascript + Scenario: Viewing full profiles with global permission + Given I log in as "admin" + And I set the following system permissions of "Authenticated user" role: + | moodle/user:viewdetails | Allow | + And I log out + When I log in as "student1" + And I follow "Course 1" + And I navigate to "Participants" node in "Current course > C1" + And I follow "Student 2" + And I follow "Full profile" + Then I should see "First access to site" -- 2.11.4.GIT