[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/lesson/tests/behat/ -> lesson_navigation.feature (source)

   1  @mod @mod_lesson
   2  Feature: In a lesson activity, students can navigate through a series of pages in various ways depending upon their answers to questions
   3    In order to create a lesson with conditional paths
   4    As a teacher
   5    I need to add pages and questions with links between them
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | teacher1 | Teacher | 1 | teacher1@example.com |
  11        | student1 | Student | 1 | student1@example.com |
  12      And the following "courses" exist:
  13        | fullname | shortname | category |
  14        | Course 1 | C1 | 0 |
  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 "teacher1"
  20      And I follow "Course 1"
  21      And I turn editing mode on
  22  
  23    Scenario: Student navigation with pages and questions
  24      Given I add a "Lesson" to section "1" and I fill the form with:
  25        | Name | Test lesson name |
  26        | Description | Test lesson description |
  27      And I follow "Test lesson name"
  28      And I follow "Add a content page"
  29      And I set the following fields to these values:
  30        | Page title | First page name |
  31        | Page contents | First page contents |
  32        | id_answer_editor_0 | Next page |
  33        | id_jumpto_0 | Next page |
  34      And I press "Save page"
  35      And I select "Add a content page" from the "qtype" singleselect
  36      And I set the following fields to these values:
  37        | Page title | Second page name |
  38        | Page contents | Second page contents |
  39        | id_answer_editor_0 | Previous page |
  40        | id_jumpto_0 | Previous page |
  41        | id_answer_editor_1 | Next page |
  42        | id_jumpto_1 | Next page |
  43      And I press "Save page"
  44      And I follow "Expanded"
  45      And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
  46      And I set the field "Select a question type" to "Numerical"
  47      And I press "Add a question page"
  48      And I set the following fields to these values:
  49        | Page title | Hardest question ever |
  50        | Page contents | 1 + 1? |
  51        | id_answer_editor_0 | 2 |
  52        | id_response_editor_0 | Correct answer |
  53        | id_jumpto_0 | End of lesson |
  54        | id_score_0 | 1 |
  55        | id_answer_editor_1 | 1 |
  56        | id_response_editor_1 | Incorrect answer |
  57        | id_jumpto_1 | Second page name |
  58        | id_score_1 | 0 |
  59      And I press "Save page"
  60      And I log out
  61      And I log in as "student1"
  62      And I follow "Course 1"
  63      When I follow "Test lesson name"
  64      Then I should see "First page contents"
  65      And I press "Next page"
  66      And I should see "Second page contents"
  67      And I should not see "First page contents"
  68      And I press "Previous page"
  69      And I should see "First page contents"
  70      And I should not see "Second page contents"
  71      And I press "Next page"
  72      And I should see "Second page contents"
  73      And I press "Next page"
  74      And I should see "1 + 1?"
  75      And I set the following fields to these values:
  76        | Your answer | 1 |
  77      And I press "Submit"
  78      And I should see "Incorrect answer"
  79      And I press "Continue"
  80      And I should see "Second page name"
  81      And I press "Next page"
  82      And I should see "1 + 1?"
  83      And I set the following fields to these values:
  84        | Your answer | 2 |
  85      And I press "Submit"
  86      And I should see "Maximum number of attempts reached - Moving to next page"
  87      And I press "Continue"
  88      And I should see "Congratulations - end of lesson reached"
  89      And I should see "Your score is 0 (out of 1)."
  90  
  91    Scenario: Student reattempts a question until out of attempts
  92      Given I add a "Lesson" to section "1" and I fill the form with:
  93        | Name | Test lesson name |
  94        | Description | Test lesson description |
  95        | id_review | Yes |
  96        | id_maxattempts | 3 |
  97      And I follow "Test lesson name"
  98      And I follow "Add a question page"
  99      And I set the following fields to these values:
 100        | id_qtype | True/false |
 101      And I press "Add a question page"
 102      And I set the following fields to these values:
 103        | Page title | Test question |
 104        | Page contents | Test content |
 105        | id_answer_editor_0 | right |
 106        | id_answer_editor_1 | wrong |
 107      And I press "Save page"
 108      And I log out
 109      And I log in as "student1"
 110      And I follow "Course 1"
 111      When I follow "Test lesson name"
 112      Then I should see "Test content"
 113      And I set the following fields to these values:
 114        | wrong | 1 |
 115      And I press "Submit"
 116      And I should see "You have 2 attempt(s) remaining"
 117      And I press "Yes, I'd like to try again"
 118      And I should see "Test content"
 119      And I set the following fields to these values:
 120        | wrong | 1 |
 121      And I press "Submit"
 122      And I should see "You have 1 attempt(s) remaining"
 123      And I press "Yes, I'd like to try again"
 124      And I should see "Test content"
 125      And I set the following fields to these values:
 126        | wrong | 1 |
 127      And I press "Submit"
 128      And I should not see "Yes, I'd like to try again"
 129      And I press "Continue"
 130      And I should see "Congratulations - end of lesson reached"


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