Proyectos de Subversion Moodle

Rev

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