[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/availability/condition/group/tests/behat/ -> availability_group.feature (source)

   1  @availability @availability_group
   2  Feature: availability_group
   3    In order to control student access to activities
   4    As a teacher
   5    I need to set group 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 |
  13        | teacher1 |
  14        | student1 |
  15      And the following "course enrolments" exist:
  16        | user     | course | role           |
  17        | teacher1 | C1     | editingteacher |
  18        | student1 | C1     | student        |
  19      And I log in as "admin"
  20      And I set the following administration settings values:
  21        | Enable conditional access  | 1 |
  22      And I log out
  23  
  24    @javascript
  25    Scenario: Test condition
  26      # Basic setup.
  27      Given I log in as "teacher1"
  28      And I follow "Course 1"
  29      And I turn editing mode on
  30  
  31      # Start to add a Page. If there aren't any groups, there's no Group option.
  32      And I add a "Page" to section "1"
  33      And I expand all fieldsets
  34      And I click on "Add restriction..." "button"
  35      Then "Group" "button" should not exist in the "Add restriction..." "dialogue"
  36      And I click on "Cancel" "button" in the "Add restriction..." "dialogue"
  37  
  38      # Back to course page but add groups.
  39      Given the following "groups" exist:
  40        | name     | course | idnumber |
  41        | G1       | C1     | GI1      |
  42        | G2       | C1     | GI2      |
  43      # This step used to be 'And I follow "C1"', but Chrome thinks the breadcrumb
  44      # is not clickable, so we'll go via the home page instead.
  45      And I am on homepage
  46      And I follow "Course 1"
  47      And I add a "Page" to section "1"
  48      And I expand all fieldsets
  49      And I click on "Add restriction..." "button"
  50      Then "Group" "button" should exist in the "Add restriction..." "dialogue"
  51  
  52      # Page P1 any group.
  53      Given I click on "Group" "button"
  54      And I set the field "Group" to "(Any group)"
  55      And I click on ".availability-item .availability-eye img" "css_element"
  56      And I set the following fields to these values:
  57        | Name         | P1 |
  58        | Description  | x  |
  59        | Page content | x  |
  60      And I click on "Save and return to course" "button"
  61  
  62      # Page P2 with group G1.
  63      And I add a "Page" to section "2"
  64      And I set the following fields to these values:
  65        | Name         | P2 |
  66        | Description  | x  |
  67        | Page content | x  |
  68      And I expand all fieldsets
  69      And I click on "Add restriction..." "button"
  70      And I click on "Group" "button"
  71      And I set the field "Group" to "G1"
  72      And I click on ".availability-item .availability-eye img" "css_element"
  73      And I click on "Save and return to course" "button"
  74  
  75      # Page P3 with group G2
  76      And I add a "Page" to section "3"
  77      And I set the following fields to these values:
  78        | Name         | P3 |
  79        | Description  | x  |
  80        | Page content | x  |
  81      And I expand all fieldsets
  82      And I click on "Add restriction..." "button"
  83      And I click on "Group" "button"
  84      And I set the field "Group" to "G2"
  85      And I click on ".availability-item .availability-eye img" "css_element"
  86      And I click on "Save and return to course" "button"
  87  
  88      # Log back in as student.
  89      When I log out
  90      And I log in as "student1"
  91      And I follow "Course 1"
  92  
  93      # No pages should appear yet.
  94      Then I should not see "P1" in the "region-main" "region"
  95      And I should not see "P2" in the "region-main" "region"
  96      And I should not see "P3" in the "region-main" "region"
  97  
  98      # Add to groups and log out/in again.
  99      Given the following "group members" exist:
 100        | user     | group |
 101        | student1 | GI1   |
 102      And I log out
 103      And I log in as "student1"
 104      And I follow "Course 1"
 105  
 106      # P1 (any groups) and P2 should show but not P3.
 107      Then I should see "P1" in the "region-main" "region"
 108      And I should see "P2" in the "region-main" "region"
 109      And I should not see "P3" in the "region-main" "region"


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1