[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

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

   1  @mod @mod_lesson
   2  Feature: In a lesson activity, teacher can add embedded images in questions answers and responses
   3    As a teacher
   4    I need to add questions with images in answers and responses
   5  
   6    @javascript @_file_upload
   7    Scenario: questions with images in answers and responses
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | teacher1 | Teacher | 1 | [email protected] |
  11        | student1 | Student | 1 | [email protected] |
  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 navigate to "My private files" node in "My profile"
  21      And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
  22      And I click on "Save changes" "button"
  23      When I am on homepage
  24      And I follow "Course 1"
  25      And I turn editing mode on
  26      And I add a "Lesson" to section "1" and I fill the form with:
  27        | Name | Test lesson name |
  28        | Description | Test lesson description |
  29      And I follow "Test lesson name"
  30      And I follow "Add a question page"
  31      And I set the field "Select a question type" to "Multichoice"
  32      And I press "Add a question page"
  33      And I set the following fields to these values:
  34        | Page title | Multichoice question |
  35        | Page contents | What animal is an amphibian? |
  36        | id_answer_editor_0 | Frog |
  37        | id_response_editor_0 | Correct answer |
  38        | id_jumpto_0 | Next page |
  39        | id_score_0 | 1 |
  40        | id_answer_editor_1 | Cat |
  41        | id_response_editor_1 | Incorrect answer |
  42        | id_jumpto_1 | This page |
  43        | id_score_1 | 0 |
  44        | id_answer_editor_2 | Dog |
  45        | id_response_editor_2 | Incorrect answer |
  46        | id_jumpto_2 | This page |
  47        | id_score_2 | 0 |
  48      And I click on "Image" "button" in the "#fitem_id_answer_editor_2" "css_element"
  49      And I click on "Browse repositories..." "button"
  50      And I click on "Private files" "link"
  51      And I click on "moodle_logo.jpg" "link"
  52      And I click on "Select this file" "button"
  53      And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
  54      And I click on "Save image" "button"
  55      And I press "Save page"
  56      And I set the field "qtype" to "Question"
  57      And I set the field "Select a question type" to "True/false"
  58      And I press "Add a question page"
  59      And I set the following fields to these values:
  60        | Page title | Next question |
  61        | Page contents | Paper is made from trees. |
  62        | id_answer_editor_0 | True |
  63        | id_response_editor_0 | Correct |
  64        | id_jumpto_0 | Next page |
  65        | id_answer_editor_1 | False |
  66        | id_response_editor_1 | Wrong |
  67        | id_jumpto_1 | This page |
  68      And I click on "Image" "button" in the "#fitem_id_response_editor_0" "css_element"
  69      And I click on "Browse repositories..." "button"
  70      And I click on "Private files" "link"
  71      And I click on "moodle_logo.jpg" "link"
  72      And I click on "Select this file" "button"
  73      And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
  74      And I click on "Save image" "button"
  75      And I press "Save page"
  76      And I log out
  77      And I log in as "student1"
  78      And I follow "Course 1"
  79      When I follow "Test lesson name"
  80      Then I should see "What animal is an amphibian?"
  81      And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
  82      And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
  83      And I set the following fields to these values:
  84        | Cat | 1 |
  85      And I press "Submit"
  86      And I should see "Incorrect answer"
  87      And I press "Continue"
  88      And I should see "Paper is made from trees."
  89      And I set the following fields to these values:
  90        | True | 1 |
  91      And I press "Submit"
  92      And I should see "Correct"
  93      And I should not see "Wrong"
  94      And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist in the ".correctanswer" "css_element"
  95      And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".correctanswer" "css_element"
  96      And I press "Continue"
  97      And I should see "Congratulations - end of lesson reached"
  98      And I should see "Your score is 1 (out of 2)."


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