Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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 @editor_tiny
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 the following "activity" exists:
20
      | course   | C1               |
21
      | activity | lesson           |
22
      | name     | Test lesson name |
23
    And the following "blocks" exist:
24
      | blockname     | contextlevel | reference | pagetypepattern | defaultregion |
25
      | private_files | System       | 1         | my-index        | side-post     |
26
    And the following "user private files" exist:
27
      | user     | filepath                                  | filename        |
28
      | teacher1 | mod/lesson/tests/fixtures/moodle_logo.jpg | moodle_logo.jpg |
29
    And I log in as "teacher1"
30
    When I am on the "Test lesson name" "lesson activity" page
31
    And I follow "Add a question page"
32
    And I set the field "Select a question type" to "Multichoice"
33
    And I press "Add a question page"
34
    And I set the following fields to these values:
35
      | Page title | Multichoice question |
36
      | Page contents | What animal is an amphibian? |
37
      | id_answer_editor_0 | Frog |
38
      | id_response_editor_0 | Correct answer |
39
      | id_jumpto_0 | Next page |
40
      | id_score_0 | 1 |
41
      | id_answer_editor_1 | Cat |
42
      | id_response_editor_1 | Incorrect answer |
43
      | id_jumpto_1 | This page |
44
      | id_score_1 | 0 |
45
      | id_answer_editor_2 | <p></p><p>Dog</p> |
46
      | id_response_editor_2 | Incorrect answer |
47
      | id_jumpto_2 | This page |
48
      | id_score_2 | 0 |
49
    And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_answer_editor_2']]" "xpath_element"
50
    And I click on "Browse repositories" "button"
51
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
52
    And I click on "moodle_logo.jpg" "link"
53
    And I click on "Select this file" "button"
54
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the logo"
55
    And I click on "Save" "button" in the "Image details" "dialogue"
56
    And I press "Save page"
57
    And I set the field "qtype" to "Add a question page"
58
    And I set the field "Select a question type" to "True/false"
59
    And I press "Add a question page"
60
    And I set the following fields to these values:
61
      | Page title | Next question |
62
      | Page contents | Paper is made from trees. |
63
      | id_answer_editor_0 | True |
64
      | id_response_editor_0 | <p></p><p>Correct</p> |
65
      | id_jumpto_0 | Next page |
66
      | id_answer_editor_1 | False |
67
      | id_response_editor_1 | Wrong |
68
      | id_jumpto_1 | This page |
69
    And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_response_editor_0']]" "xpath_element"
70
    And I click on "Browse repositories" "button"
71
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
72
    And I click on "moodle_logo.jpg" "link"
73
    And I click on "Select this file" "button"
74
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the logo"
75
    And I click on "Save" "button" in the "Image details" "dialogue"
76
    And I press "Save page"
77
    When I am on the "Test lesson name" "lesson activity" page logged in as student1
78
    Then I should see "What animal is an amphibian?"
79
    And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
80
    And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
81
    And I set the following fields to these values:
82
      | Cat | 1 |
83
    And I press "Submit"
84
    And I should see "Incorrect answer"
85
    And I press "Continue"
86
    And I should see "Paper is made from trees."
87
    And I set the following fields to these values:
88
      | True | 1 |
89
    And I press "Submit"
90
    And I should see "Correct"
91
    And I should not see "Wrong"
92
    And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist in the ".correctanswer" "css_element"
93
    And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".correctanswer" "css_element"
94
    And I press "Continue"
95
    And I should see "Congratulations - end of lesson reached"
96
    And I should see "Your score is 1 (out of 2)."