[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/availability/condition/date/tests/behat/ -> availability_date.feature (source)

   1  @availability @availability_date
   2  Feature: availability_date
   3    In order to control student access to activities
   4    As a teacher
   5    I need to set date 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      # Add a Page with a date condition that does match (from the past).
  32      And I add a "Page" to section "1"
  33      And I set the following fields to these values:
  34        | Name         | Page 1 |
  35        | Description  | Test   |
  36        | Page content | Test   |
  37      And I expand all fieldsets
  38      And I click on "Add restriction..." "button"
  39      And I click on "Date" "button" in the "Add restriction..." "dialogue"
  40      And I click on ".availability-item .availability-eye img" "css_element"
  41      And I set the field "year" to "2013"
  42      And I press "Save and return to course"
  43  
  44      # Add a Page with a date condition that doesn't match (until the past).
  45      And I add a "Page" to section "2"
  46      And I set the following fields to these values:
  47        | Name         | Page 2 |
  48        | Description  | Test   |
  49        | Page content | Test   |
  50      And I expand all fieldsets
  51      And I click on "Add restriction..." "button"
  52      And I click on "Date" "button" in the "Add restriction..." "dialogue"
  53      And I click on ".availability-item .availability-eye img" "css_element"
  54      And I set the field "Direction" to "until"
  55      And I set the field "year" to "2013"
  56      And I press "Save and return to course"
  57  
  58      # Log back in as student.
  59      When I log out
  60      And I log in as "student1"
  61      And I follow "Course 1"
  62  
  63      # Page 1 should appear, but page 2 does not.
  64      Then I should see "Page 1" in the "region-main" "region"
  65      And I should not see "Page 2" in the "region-main" "region"


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