[ Index ]

PHP Cross Reference of Unnamed Project

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 | t@example.com |
  14        | student1 | s@example.com |
  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      # Add an assignment.
  29      And I add a "Assignment" to section "1" and I fill the form with:
  30        | Assignment name     | A1 |
  31        | Description         | x  |
  32        | Online text         | 1  |
  33  
  34      # Add a Page with a grade condition for 'any grade'.
  35      And I add a "Page" to section "2"
  36      And I set the following fields to these values:
  37        | Name         | P2 |
  38        | Description  | x  |
  39        | Page content | x  |
  40      And I expand all fieldsets
  41      And I click on "Add restriction..." "button"
  42      And I click on "Grade" "button" in the "Add restriction..." "dialogue"
  43      And I click on ".availability-item .availability-eye img" "css_element"
  44      And I set the field "Grade" to "A1"
  45      And I press "Save and return to course"
  46  
  47      # Add a Page with a grade condition for 50%.
  48      And I add a "Page" to section "3"
  49      And I set the following fields to these values:
  50        | Name         | P3 |
  51        | Description  | x  |
  52        | Page content | x  |
  53      And I expand all fieldsets
  54      And I click on "Add restriction..." "button"
  55      And I click on "Grade" "button" in the "Add restriction..." "dialogue"
  56      And I click on ".availability-item .availability-eye img" "css_element"
  57      And I set the field "Grade" to "A1"
  58      And I click on "min" "checkbox" in the ".availability-item" "css_element"
  59      And I set the field "Minimum grade percentage (inclusive)" to "50"
  60      And I click on "max" "checkbox" in the ".availability-item" "css_element"
  61      And I set the field "Maximum grade percentage (exclusive)" to "80"
  62      And I press "Save and return to course"
  63  
  64      # Check if disabling a part of the restriction is get saved.
  65      And I open "P3" actions menu
  66      And I click on "Edit settings" "link" in the "P3" activity
  67      And I expand all fieldsets
  68      And I click on "max" "checkbox" in the ".availability-item" "css_element"
  69      And I press "Save and return to course"
  70      And I open "P3" actions menu
  71      And I click on "Edit settings" "link" in the "P3" activity
  72      And I expand all fieldsets
  73      And the field "Maximum grade percentage (exclusive)" matches value ""
  74      And I follow "Course 1"
  75  
  76      # Add a Page with a grade condition for 10%.
  77      And I add a "Page" to section "4"
  78      And I set the following fields to these values:
  79        | Name         | P4 |
  80        | Description  | x  |
  81        | Page content | x  |
  82      And I expand all fieldsets
  83      And I click on "Add restriction..." "button"
  84      And I click on "Grade" "button" in the "Add restriction..." "dialogue"
  85      And I click on ".availability-item .availability-eye img" "css_element"
  86      And I set the field "Grade" to "A1"
  87      And I click on "min" "checkbox" in the ".availability-item" "css_element"
  88      And I set the field "Minimum grade percentage (inclusive)" to "10"
  89      And I press "Save and return to course"
  90  
  91      # Log in as student without a grade yet.
  92      When I log out
  93      And I log in as "student1"
  94      And I am on site homepage
  95      And I follow "Course 1"
  96  
  97      # Do the assignment.
  98      And I follow "A1"
  99      And I click on "Add submission" "button"
 100      And I set the field "Online text" to "Q"
 101      And I click on "Save changes" "button"
 102      And I follow "C1"
 103  
 104      # None of the pages should appear (check assignment though).
 105      Then I should not see "P2" in the "region-main" "region"
 106      And I should not see "P3" in the "region-main" "region"
 107      And I should not see "P4" in the "region-main" "region"
 108      And I should see "A1" in the "region-main" "region"
 109  
 110      # Log back in as teacher.
 111      When I log out
 112      And I log in as "teacher1"
 113      And I am on site homepage
 114      And I follow "Course 1"
 115  
 116      # Give the assignment 40%.
 117      And I follow "A1"
 118      And I follow "View all submissions"
 119      # Pick the grade link in the row that has s@example.com in it.
 120      And I click on "Grade" "link" in the "s@example.com" "table_row"
 121      And I set the field "Grade out of 100" to "40"
 122      And I click on "Save changes" "button"
 123      And I press "Ok"
 124      And I click on "Edit settings" "link"
 125  
 126      # Log back in as student.
 127      And I log out
 128      And I log in as "student1"
 129      And I am on site homepage
 130      And I follow "Course 1"
 131  
 132      # Check pages are visible.
 133      Then I should see "P2" in the "region-main" "region"
 134      And I should see "P4" in the "region-main" "region"
 135      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