[ Index ]

PHP Cross Reference of Unnamed Project

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


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1