| 1 |
efrain |
1 |
@editor @editor_tiny @tiny_media @javascript
|
|
|
2 |
Feature: Use the TinyMCE editor to upload an image
|
|
|
3 |
In order to work with images
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to upload and manipulate images
|
|
|
6 |
|
|
|
7 |
Scenario: Clicking on the Image button in the TinyMCE editor opens the image dialog
|
|
|
8 |
Given I log in as "admin"
|
|
|
9 |
And I open my profile in edit mode
|
|
|
10 |
When I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
11 |
Then "Insert image" "dialogue" should exist
|
|
|
12 |
|
|
|
13 |
Scenario: Browsing repositories in the TinyMCE editor opens the image dialog and shows the FilePicker
|
|
|
14 |
Given I log in as "admin"
|
|
|
15 |
And I open my profile in edit mode
|
|
|
16 |
When I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
17 |
And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
|
|
|
18 |
Then "File picker" "dialogue" should exist
|
|
|
19 |
|
| 1441 |
ariadna |
20 |
Scenario: Focus returns to the correct location after closing a nested FilePicker
|
|
|
21 |
Given I log in as "admin"
|
|
|
22 |
And I open my profile in edit mode
|
|
|
23 |
When I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
24 |
And I press "Browse repositories"
|
|
|
25 |
When I press the escape key
|
|
|
26 |
Then the focused element is "Browse repositories" "button"
|
|
|
27 |
|
| 1 |
efrain |
28 |
@_file_upload @test_tiny
|
|
|
29 |
Scenario: Browsing repositories in the TinyMCE editor shows the FilePicker and upload url image
|
|
|
30 |
Given I log in as "admin"
|
|
|
31 |
And I open my profile in edit mode
|
|
|
32 |
When I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
33 |
And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
|
|
|
34 |
And I upload "/lib/editor/tiny/tests/behat/fixtures/tinyscreenshot.png" to the file picker for TinyMCE
|
|
|
35 |
# Note: This needs to be replaced with a label.
|
|
|
36 |
Then ".tiny_image_preview" "css_element" should be visible
|
|
|
37 |
|
|
|
38 |
@_file_upload
|
|
|
39 |
Scenario: Insert image to the TinyMCE editor
|
|
|
40 |
Given I log in as "admin"
|
|
|
41 |
And I open my profile in edit mode
|
|
|
42 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
43 |
And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
|
|
|
44 |
And I upload "lib/editor/tiny/tests/behat/fixtures/moodle-logo.png" to the file picker for TinyMCE
|
| 11 |
efrain |
45 |
And I set the field "How would you describe this image to someone who can't see it?" to "It's the Moodle"
|
| 1 |
efrain |
46 |
And I click on "Save" "button" in the "Image details" "dialogue"
|
|
|
47 |
When I select the "img" element in position "0" of the "Description" TinyMCE editor
|
|
|
48 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
| 11 |
efrain |
49 |
Then the field "How would you describe this image to someone who can't see it?" matches value "It's the Moodle"
|
| 1 |
efrain |
50 |
# Note: This needs to be replaced with a label.
|
|
|
51 |
And ".tiny_image_preview" "css_element" should be visible
|
|
|
52 |
|
|
|
53 |
@_file_upload
|
|
|
54 |
Scenario: Resizing the image uses the original and custom sizes and the keep proportion checkbox
|
|
|
55 |
Given I log in as "admin"
|
|
|
56 |
And I open my profile in edit mode
|
|
|
57 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
58 |
And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
|
|
|
59 |
And I upload "lib/editor/tiny/tests/behat/fixtures/moodle-logo.png" to the file picker for TinyMCE
|
|
|
60 |
And I click on "This image is decorative only" "checkbox"
|
|
|
61 |
And I click on "Save" "button" in the "Image details" "dialogue"
|
|
|
62 |
When I select the "img" element in position "0" of the "Description" TinyMCE editor
|
|
|
63 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
64 |
Then the field "Original size" matches value "1"
|
|
|
65 |
And I click on "Custom size" "radio"
|
|
|
66 |
Then the field "Keep proportion" matches value "1"
|
|
|
67 |
And I click on "Keep proportion" "checkbox"
|
|
|
68 |
And I set the field "Width" to "102"
|
|
|
69 |
And I click on "Save" "button" in the "Image details" "dialogue"
|
|
|
70 |
When I select the "img" element in position "0" of the "Description" TinyMCE editor
|
|
|
71 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
72 |
Then the field "Custom size" matches value "1"
|
|
|
73 |
And the field "Width" matches value "102"
|
|
|
74 |
And the field "Keep proportion" matches value "0"
|
| 1441 |
ariadna |
75 |
|
|
|
76 |
@_file_upload
|
|
|
77 |
Scenario: Set the alt text to the maximum and below the maximum length
|
|
|
78 |
Given I log in as "admin"
|
|
|
79 |
And I open my profile in edit mode
|
|
|
80 |
And I click on the "Image" button for the "Description" TinyMCE editor
|
|
|
81 |
And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
|
|
|
82 |
And I upload "/lib/editor/tiny/tests/behat/fixtures/tinyscreenshot.png" to the file picker for TinyMCE
|
|
|
83 |
When I set the field "How would you describe this image to someone who can't see it?" to "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet."
|
|
|
84 |
Then I should see "750" in the "#currentcount" "css_element"
|
|
|
85 |
And I set the field "How would you describe this image to someone who can't see it?" to "Lorem ipsum dolor sit amet."
|
|
|
86 |
And I should see "27" in the "#currentcount" "css_element"
|
|
|
87 |
|
|
|
88 |
@javascript
|
|
|
89 |
Scenario: Permissions can be configured to control access to media
|
|
|
90 |
Given the following "users" exist:
|
|
|
91 |
| username | firstname | lastname | email |
|
|
|
92 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
93 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
94 |
And the following "courses" exist:
|
|
|
95 |
| fullname | shortname | format |
|
|
|
96 |
| Course 1 | C1 | topics |
|
|
|
97 |
And the following "roles" exist:
|
|
|
98 |
| name | shortname | description | archetype |
|
|
|
99 |
| Custom teacher | custom1 | Limited permissions | editingteacher |
|
|
|
100 |
And the following "course enrolments" exist:
|
|
|
101 |
| user | course | role |
|
|
|
102 |
| teacher1 | C1 | editingteacher |
|
|
|
103 |
| teacher2 | C1 | custom1 |
|
|
|
104 |
And the following "activity" exists:
|
|
|
105 |
| activity | assign |
|
|
|
106 |
| course | C1 |
|
|
|
107 |
| name | Test assignment |
|
|
|
108 |
And the following "permission overrides" exist:
|
|
|
109 |
| capability | permission | role | contextlevel | reference |
|
|
|
110 |
| tiny/media:use | Prohibit | custom1 | Course | C1 |
|
|
|
111 |
# Check plugin access as a role with prohibited permissions.
|
|
|
112 |
And I log in as "teacher2"
|
|
|
113 |
And I am on the "Test assignment" Activity page
|
|
|
114 |
And I navigate to "Settings" in current page administration
|
|
|
115 |
When I click on the "Insert" menu item for the "Activity instructions" TinyMCE editor
|
|
|
116 |
Then I should not see "Multimedia"
|
|
|
117 |
# Check plugin access as a role with allowed permissions.
|
|
|
118 |
And I log in as "teacher1"
|
|
|
119 |
And I am on the "Test assignment" Activity page
|
|
|
120 |
And I navigate to "Settings" in current page administration
|
|
|
121 |
And I click on the "Insert" menu item for the "Activity instructions" TinyMCE editor
|
|
|
122 |
And I should see "Multimedia"
|