[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_lesson
   2  Feature: In a lesson activity, teacher can edit lesson's pages
   3    In order to modify an existing lesson
   4    As a teacher
   5    I need to edit pages in the lesson
   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      And I add a "Lesson" to section "1" and I fill the form with:
  23        | Name | Test lesson name |
  24        | Description | Test lesson description |
  25      And I follow "Test lesson name"
  26      And I follow "Add a content page"
  27      And I set the following fields to these values:
  28        | Page title | First page name |
  29        | Page contents | First page contents |
  30        | id_answer_editor_0 | Next page |
  31        | id_jumpto_0 | Next page |
  32      And I press "Save page"
  33      And I select "Add a content page" from the "qtype" singleselect
  34      And I set the following fields to these values:
  35        | Page title | Second page name |
  36        | Page contents | Second page contents |
  37        | id_answer_editor_0 | Previous page |
  38        | id_jumpto_0 | Previous page |
  39        | id_answer_editor_1 | Next page |
  40        | id_jumpto_1 | Next page |
  41      And I press "Save page"
  42      And I follow "Expanded"
  43      And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
  44      And I set the field "Select a question type" to "Numerical"
  45      And I press "Add a question page"
  46      And I set the following fields to these values:
  47        | Page title | Hardest question ever |
  48        | Page contents | 1 + 1? |
  49        | id_answer_editor_0 | 2 |
  50        | id_response_editor_0 | Correct answer |
  51        | id_jumpto_0 | End of lesson |
  52        | id_score_0 | 1 |
  53        | id_answer_editor_1 | 1 |
  54        | id_response_editor_1 | Incorrect answer |
  55        | id_jumpto_1 | Second page name |
  56        | id_score_1 | 0 |
  57      And I press "Save page"
  58  
  59    Scenario: Edit lesson content page
  60      Given I click on "//th[normalize-space(.)='Second page name']/descendant::a[2]" "xpath_element"
  61      When I set the following fields to these values:
  62        | Page title | Modified second page |
  63        | Page contents | Modified contents |
  64        | id_answer_editor_0 | Forward |
  65        | id_jumpto_0 |Next page |
  66        | id_answer_editor_1 | Backward |
  67        | id_jumpto_1 | Previous page |
  68      And I press "Save page"
  69      Then I should see "Modified second page"
  70      And I should not see "Second page name"
  71      And I log out
  72      And I log in as "student1"
  73      And I follow "Course 1"
  74      And I follow "Test lesson name"
  75      And I should see "First page contents"
  76      And I press "Next page"
  77      And I should see "Modified contents"
  78      And I should not see "Second page contents"
  79      And I press "Backward"
  80      And I should see "First page contents"
  81      And I press "Next page"
  82      And I should see "Modified contents"
  83      And I press "Forward"
  84      And I should see "1 + 1?"
  85      And I set the following fields to these values:
  86        | Your answer | 2 |
  87      And I press "Submit"
  88      And I should see "Correct answer"
  89      And I should not see "Incorrect answer"
  90      And I press "Continue"
  91      And I should see "Congratulations - end of lesson reached"
  92      And I should see "Your score is 1 (out of 1)."
  93  
  94    Scenario: Edit lesson question page
  95      Given I click on "//th[normalize-space(.)='Hardest question ever']/descendant::a[2]" "xpath_element"
  96      When I set the following fields to these values:
  97        | Page title | New hardest question |
  98        | Page contents | 1 + 2? |
  99        | id_answer_editor_0 | 2 |
 100        | id_response_editor_0 | Your answer is incorrect |
 101        | id_jumpto_0 | End of lesson |
 102        | id_score_0 | 0 |
 103        | id_answer_editor_1 | 3 |
 104        | id_response_editor_1 | Your answer is correct |
 105        | id_jumpto_1 | End of lesson |
 106        | id_score_1 | 1 |
 107      And I press "Save page"
 108      Then I should see "New hardest question"
 109      And I should not see "Hardest question ever"
 110      And I log out
 111      And I log in as "student1"
 112      And I follow "Course 1"
 113      And I follow "Test lesson name"
 114      And I should see "First page contents"
 115      And I press "Next page"
 116      And I should see "Second page contents"
 117      And I press "Next page"
 118      And I should see "1 + 2?"
 119      And I should not see "1 + 1?"
 120      And I set the following fields to these values:
 121        | Your answer | 3 |
 122      And I press "Submit"
 123      And I should see "Your answer is correct"
 124      And I should not see "Incorrect answer"
 125      And I press "Continue"
 126      And I should see "Congratulations - end of lesson reached"
 127      And I should see "Your score is 1 (out of 1)."


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