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