[ Index ]

PHP Cross Reference of Unnamed Project

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


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