[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/availability/condition/grade/tests/behat/ -> availability_grade.feature (source)

   1  @availability @availability_grade
   2  Feature: availability_grade
   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 | email         |
  13        | teacher1 | [email protected] |
  14        | student1 | [email protected] |
  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 an assignment.
  32      And I add a "Assignment" to section "1" and I fill the form with:
  33        | Assignment name     | A1 |
  34        | Description         | x  |
  35        | Online text         | 1  |
  36  
  37      # Add a Page with a grade condition for 'any grade'.
  38      And I add a "Page" to section "2"
  39      And I set the following fields to these values:
  40        | Name         | P2 |
  41        | Description  | x  |
  42        | Page content | x  |
  43      And I expand all fieldsets
  44      And I click on "Add restriction..." "button"
  45      And I click on "Grade" "button" in the "Add restriction..." "dialogue"
  46      And I click on ".availability-item .availability-eye img" "css_element"
  47      And I set the field "Grade" to "A1"
  48      And I press "Save and return to course"
  49  
  50      # Add a Page with a grade condition for 50%.
  51      And I add a "Page" to section "3"
  52      And I set the following fields to these values:
  53        | Name         | P3 |
  54        | Description  | x  |
  55        | Page content | x  |
  56      And I expand all fieldsets
  57      And I click on "Add restriction..." "button"
  58      And I click on "Grade" "button" in the "Add restriction..." "dialogue"
  59      And I click on ".availability-item .availability-eye img" "css_element"
  60      And I set the field "Grade" to "A1"
  61      And I click on "min" "checkbox" in the ".availability-item" "css_element"
  62      And I set the field "Minimum grade percentage (inclusive)" to "50"
  63      And I press "Save and return to course"
  64  
  65      # Add a Page with a grade condition for 10%.
  66      And I add a "Page" to section "4"
  67      And I set the following fields to these values:
  68        | Name         | P4 |
  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 "Grade" "button" in the "Add restriction..." "dialogue"
  74      And I click on ".availability-item .availability-eye img" "css_element"
  75      And I set the field "Grade" to "A1"
  76      And I click on "min" "checkbox" in the ".availability-item" "css_element"
  77      And I set the field "Minimum grade percentage (inclusive)" to "10"
  78      And I press "Save and return to course"
  79  
  80      # Log in as student without a grade yet.
  81      When I log out
  82      And I log in as "student1"
  83      And I follow "Course 1"
  84  
  85      # Do the assignment.
  86      And I follow "A1"
  87      And I click on "Add submission" "button"
  88      And I set the field "Online text" to "Q"
  89      And I click on "Save changes" "button"
  90      And I follow "C1"
  91  
  92      # None of the pages should appear (check assignment though).
  93      Then I should not see "P2" in the "region-main" "region"
  94      And I should not see "P3" in the "region-main" "region"
  95      And I should not see "P4" in the "region-main" "region"
  96      And I should see "A1" in the "region-main" "region"
  97  
  98      # Log back in as teacher.
  99      When I log out
 100      And I log in as "teacher1"
 101      And I follow "Course 1"
 102  
 103      # Give the assignment 40%.
 104      And I follow "A1"
 105      And I follow "View/grade all submissions"
 106      # Pick the grade link in the row that has [email protected] in it.
 107      And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = '[email protected]']]/img" "xpath_element"
 108      And I set the field "Grade out of 100" to "40"
 109      And I click on "Save changes" "button"
 110  
 111      # Log back in as student.
 112      And I log out
 113      And I log in as "student1"
 114      And I follow "Course 1"
 115  
 116      # Check pages are visible.
 117      Then I should see "P2" in the "region-main" "region"
 118      And I should see "P4" in the "region-main" "region"
 119      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