[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 @availability @availability_profile 2 Feature: availability_profile 3 In order to control student access to activities 4 As a teacher 5 I need to set profile conditions which prevent student access 6 7 Background: 8 Given the following "courses" exist: 9 | fullname | shortname | format | enablecompletion | 10 | Course 1 | C1 | topics | 1 | 11 And the following "users" exist: 12 | username | email | 13 | teacher1 | t@example.com | 14 | student1 | s@example.com | 15 And the following "course enrolments" exist: 16 | user | course | role | 17 | teacher1 | C1 | editingteacher | 18 | student1 | C1 | student | 19 20 @javascript 21 Scenario: Test condition 22 # Basic setup. 23 Given I log in as "teacher1" 24 And I am on site homepage 25 And I follow "Course 1" 26 And I turn editing mode on 27 28 # Add 29 And I add a "Page" to section "1" 30 And I set the following fields to these values: 31 | Name | P1 | 32 | Description | x | 33 | Page content | x | 34 And I expand all fieldsets 35 And I click on "Add restriction..." "button" 36 And I click on "User profile" "button" 37 And I set the field "User profile field" to "Email address" 38 And I set the field "Value to compare against" to "s@example.com" 39 And I click on ".availability-item .availability-eye img" "css_element" 40 And I click on "Save and return to course" "button" 41 42 # Add 43 And I add a "Page" to section "2" 44 And I set the following fields to these values: 45 | Name | P2 | 46 | Description | x | 47 | Page content | x | 48 And I expand all fieldsets 49 And I click on "Add restriction..." "button" 50 And I click on "User profile" "button" 51 And I set the field "User profile field" to "Email address" 52 And I set the field "Value to compare against" to "q@example.com" 53 And I click on ".availability-item .availability-eye img" "css_element" 54 And I click on "Save and return to course" "button" 55 56 # Log back in as student. 57 When I log out 58 And I log in as "student1" 59 And I am on site homepage 60 And I follow "Course 1" 61 62 # I see P1 but not P2. 63 Then I should see "P1" in the "region-main" "region" 64 And I should not see "P2" in the "region-main" "region" 65 66 @javascript 67 Scenario: Test with custom user profile field 68 # Add custom field. 69 Given I log in as "admin" 70 And I navigate to "User profile fields" node in "Site administration > Users > Accounts" 71 And I set the field "datatype" to "Text input" 72 And I set the following fields to these values: 73 | Short name | superfield | 74 | Name | Super field | 75 And I click on "Save changes" "button" 76 77 # Set field value for user. 78 And I navigate to "Browse list of users" node in "Site administration > Users > Accounts" 79 And I click on "a[title=Edit]" "css_element" in the "s@example.com" "table_row" 80 And I expand all fieldsets 81 And I set the field "Super field" to "Bananaman" 82 And I click on "Update profile" "button" 83 84 # Set Page activity which has requirement on this field. 85 And I am on site homepage 86 And I follow "Course 1" 87 And I turn editing mode on 88 And I add a "Page" to section "1" 89 And I set the following fields to these values: 90 | Name | P1 | 91 | Description | x | 92 | Page content | x | 93 And I expand all fieldsets 94 And I click on "Add restriction..." "button" 95 And I click on "User profile" "button" 96 And I set the following fields to these values: 97 | User profile field | Super field | 98 | Value to compare against | Bananaman | 99 And I click on ".availability-item .availability-eye img" "css_element" 100 And I click on "Save and return to course" "button" 101 102 # Edit it again and check the setting still works. 103 When I follow "P1" 104 And I navigate to "Edit settings" node in "Page module administration" 105 And I expand all fieldsets 106 Then the field "User profile field" matches value "Super field" 107 And the field "Value to compare against" matches value "Bananaman" 108 109 # Log out and back in as student. Should be able to see activity. 110 And I log out 111 And I log in as "student1" 112 And I am on site homepage 113 And I follow "Course 1" 114 Then I should see "P1" in the "region-main" "region"
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |