[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/availability/condition/grouping/tests/behat/ -> availability_grouping.feature (source)

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


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