[ Index ]

PHP Cross Reference of Unnamed Project

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 | 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 "Manage private files"
  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 | <p></p><p>Dog</p> |
  45        | id_response_editor_2 | Incorrect answer |
  46        | id_jumpto_2 | This page |
  47        | id_score_2 | 0 |
  48      # Atto needs focus to add image, select empty p tag to do so.
  49      And I select the text in the "id_answer_editor_2" Atto editor
  50      And I click on "Image" "button" in the "#fitem_id_answer_editor_2" "css_element"
  51      And I click on "Browse repositories..." "button"
  52      And I click on "Private files" "link"
  53      And I click on "moodle_logo.jpg" "link"
  54      And I click on "Select this file" "button"
  55      And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
  56      And I click on "Save image" "button"
  57      And I press "Save page"
  58      And I set the field "qtype" to "Question"
  59      And I set the field "Select a question type" to "True/false"
  60      And I press "Add a question page"
  61      And I set the following fields to these values:
  62        | Page title | Next question |
  63        | Page contents | Paper is made from trees. |
  64        | id_answer_editor_0 | True |
  65        | id_response_editor_0 | <p></p><p>Correct</p> |
  66        | id_jumpto_0 | Next page |
  67        | id_answer_editor_1 | False |
  68        | id_response_editor_1 | Wrong |
  69        | id_jumpto_1 | This page |
  70      # Atto needs focus to add image, select empty p tag to do so.
  71      And I select the text in the "id_response_editor_0" Atto editor
  72      And I click on "Image" "button" in the "#fitem_id_response_editor_0" "css_element"
  73      And I click on "Browse repositories..." "button"
  74      And I click on "Private files" "link"
  75      And I click on "moodle_logo.jpg" "link"
  76      And I click on "Select this file" "button"
  77      And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
  78      And I click on "Save image" "button"
  79      And I press "Save page"
  80      And I log out
  81      And I log in as "student1"
  82      And I follow "Course 1"
  83      When I follow "Test lesson name"
  84      Then I should see "What animal is an amphibian?"
  85      And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
  86      And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
  87      And I set the following fields to these values:
  88        | Cat | 1 |
  89      And I press "Submit"
  90      And I should see "Incorrect answer"
  91      And I press "Continue"
  92      And I should see "Paper is made from trees."
  93      And I set the following fields to these values:
  94        | True | 1 |
  95      And I press "Submit"
  96      And I should see "Correct"
  97      And I should not see "Wrong"
  98      And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist in the ".correctanswer" "css_element"
  99      And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".correctanswer" "css_element"
 100      And I press "Continue"
 101      And I should see "Congratulations - end of lesson reached"
 102      And I should see "Your score is 1 (out of 2)."


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