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 @javascript @editor_tiny
2
Feature: In a lesson activity, a teacher can duplicate a lesson page
3
  In order to duplicate a lesson page
4
  As a teacher
5
  I need to add content to a 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 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
 
31
  Scenario: Duplicate content page with an image.
32
    When I am on the "Test lesson name" "lesson activity" page
33
    And I follow "Add a content page"
34
    And I set the following fields to these values:
35
      | Page title | First page name |
36
      | Page contents | First page contents |
37
      | id_answer_editor_0 | Next page |
38
      | id_jumpto_0 | Next page |
39
      | id_answer_editor_1 | Previous page |
40
      | id_jumpto_1 | Previous page |
41
    And I click on "Image" "button" in the "Page contents" "form_row"
42
    And I click on "Browse repositories" "button"
43
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
44
    And I click on "moodle_logo.jpg" "link"
45
    And I click on "Select this file" "button"
46
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the logo"
47
    And I click on "Save" "button" in the "Image details" "dialogue"
48
    And I press "Save page"
49
    And I follow "Duplicate page: First page name"
50
    Then I should see "Inserted page: First page name"
51
    And I follow "Update page: First page name"
52
    And I set the field "Page title" to "Introduction page"
53
    And I press "Save page"
54
    And I follow "Update page: First page name"
55
    Then I should see "First page name"
56
    And I switch to the "Page contents" TinyMCE editor iframe
57
    Then "//*[contains(@data-id, 'id_contents_editor')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
58
 
59
  Scenario: Duplicate question page with image in answer.
60
    When I am on the "Test lesson name" "lesson activity" page
61
    And I follow "Add a question page"
62
    And I set the field "Select a question type" to "True/false"
63
    And I press "Add a question page"
64
    And I set the following fields to these values:
65
      | Page title | True false with an image in the answer |
66
      | Page contents | Select the picture |
67
      | id_answer_editor_0 | Answer text |
68
      | id_response_editor_0 | Correct answer |
69
      | id_jumpto_0 | End of lesson |
70
      | id_score_0 | 1 |
71
      | id_answer_editor_1 | 1 |
72
      | id_response_editor_1 | Incorrect answer |
73
      | id_jumpto_1 | This page |
74
      | id_score_1 | 0 |
75
    And I click on "Image" "button" in the "//*[@id='id_answer_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
76
    And I click on "Browse repositories" "button"
77
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
78
    And I click on "moodle_logo.jpg" "link"
79
    And I click on "Select this file" "button"
80
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the logo"
81
    And I click on "Save" "button" in the "Image details" "dialogue"
82
    And I press "Save page"
83
    And I follow "Duplicate page: True false with an image in the answer"
84
    Then I should see "Inserted page: True false with an image in the answer"
85
    And I follow "Update page: True false with an image in the answer"
86
    And I set the field "Page title" to "First true false"
87
    And I press "Save page"
88
    And I follow "Update page: True false with an image in the answer"
89
    Then I should see "True false with an image in the answer"
90
    And I switch to the "Page contents" TinyMCE editor iframe
91
    Then I should see "Select the picture"
92
    And I switch to the main frame
93
    And I switch to the "Answer" TinyMCE editor iframe
94
    Then "//*[contains(@data-id, 'id_answer_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
95
 
96
  Scenario: Duplicate question page with image in feedback.
97
    When I am on the "Test lesson name" "lesson activity" page
98
    And I follow "Add a question page"
99
    And I set the field "Select a question type" to "True/false"
100
    And I press "Add a question page"
101
    And I set the following fields to these values:
102
      | Page title | True false with an image in the feedback |
103
      | Page contents | Select the picture |
104
      | id_answer_editor_0 | Answer text |
105
      | id_response_editor_0 | Correct answer |
106
      | id_jumpto_0 | End of lesson |
107
      | id_score_0 | 1 |
108
      | id_answer_editor_1 | 1 |
109
      | id_response_editor_1 | Incorrect answer |
110
      | id_jumpto_1 | This page |
111
      | id_score_1 | 0 |
112
    And I click on "Image" "button" in the "//*[@id='id_response_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
113
    And I click on "Browse repositories" "button"
114
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
115
    And I click on "moodle_logo.jpg" "link"
116
    And I click on "Select this file" "button"
117
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the logo"
118
    And I click on "Save" "button" in the "Image details" "dialogue"
119
    And I press "Save page"
120
    And I follow "Duplicate page: True false with an image in the feedback"
121
    Then I should see "Inserted page: True false with an image in the feedback"
122
    And I follow "Update page: True false with an image in the feedback"
123
    And I set the field "Page title" to "First true false"
124
    And I press "Save page"
125
    And I follow "Update page: True false with an image in the feedback"
126
    Then I should see "True false with an image in the feedback"
127
    And I switch to the "Page contents" TinyMCE editor iframe
128
    Then I should see "Select the picture"
129
    And I switch to the main frame
130
    And I switch to the "Response" TinyMCE editor iframe
131
    Then "//*[contains(@data-id, 'id_response_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist