11 |
efrain |
1 |
@editor @editor_atto @atto @atto_image
|
1 |
efrain |
2 |
Feature: Add images to Atto
|
|
|
3 |
To write rich text - I need to add images.
|
|
|
4 |
|
|
|
5 |
@javascript
|
|
|
6 |
Scenario: Insert an image
|
11 |
efrain |
7 |
Given the following "user private file" exists:
|
|
|
8 |
| user | admin |
|
|
|
9 |
| filepath | lib/editor/atto/tests/fixtures/moodle-logo.png |
|
1 |
efrain |
10 |
And I log in as "admin"
|
|
|
11 |
And I open my profile in edit mode
|
|
|
12 |
When I set the field "Description" to "<p>Image test</p>"
|
|
|
13 |
And I select the text in the "Description" Atto editor
|
|
|
14 |
And I click on "Insert or edit image" "button"
|
|
|
15 |
And I click on "Browse repositories..." "button"
|
|
|
16 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
17 |
And I click on "moodle-logo.png" "link"
|
|
|
18 |
And I click on "Select this file" "button"
|
|
|
19 |
And I set the field "Describe this image for someone who cannot see it" to "It's the Moodle"
|
|
|
20 |
# Wait for the page to "settle".
|
|
|
21 |
And I wait until the page is ready
|
|
|
22 |
And the field "Width" matches value "204"
|
|
|
23 |
And the field "Height" matches value "61"
|
|
|
24 |
And I set the field "Auto size" to "1"
|
|
|
25 |
And I wait until the page is ready
|
|
|
26 |
And I set the field "Width" to "2040"
|
|
|
27 |
# Trigger blur on the width field.
|
|
|
28 |
And I take focus off "Width" "field"
|
|
|
29 |
And the field "Height" matches value "610"
|
|
|
30 |
And I set the field "Height" to "61"
|
|
|
31 |
# Trigger blur on the height field.
|
|
|
32 |
And I take focus off "Height" "field"
|
|
|
33 |
And the field "Width" matches value "204"
|
|
|
34 |
And I set the field "Auto size" to "0"
|
|
|
35 |
And I wait until the page is ready
|
|
|
36 |
And I set the field "Width" to "123"
|
|
|
37 |
And I set the field "Height" to "456"
|
|
|
38 |
# Trigger blur on the height field.
|
|
|
39 |
And I take focus off "Height" "field"
|
|
|
40 |
And the field "Width" matches value "123"
|
|
|
41 |
And the field "Height" matches value "456"
|
|
|
42 |
And I change window size to "large"
|
|
|
43 |
And I press "Save image"
|
|
|
44 |
And I press "Update profile"
|
|
|
45 |
And I click on "Edit profile" "link" in the "region-main" "region"
|
|
|
46 |
And I select the text in the "Description" Atto editor
|
|
|
47 |
And I click on "Insert or edit image" "button"
|
|
|
48 |
Then the field "Describe this image for someone who cannot see it" matches value "It's the Moodle"
|
|
|
49 |
And the field "Width" matches value "123"
|
|
|
50 |
And the field "Height" matches value "456"
|
|
|
51 |
|
|
|
52 |
@javascript
|
|
|
53 |
Scenario: Manually inserting an image
|
|
|
54 |
Given I log in as "admin"
|
|
|
55 |
And I open my profile in edit mode
|
|
|
56 |
And I set the field "Description" to "<p>Image: <img src='/nothing/here'>.</p>"
|
|
|
57 |
And I select the text in the "Description" Atto editor
|
|
|
58 |
When I click on "Insert or edit image" "button"
|
|
|
59 |
Then the field "Enter URL" matches value "/nothing/here"
|
|
|
60 |
And I set the field "Describe this image for someone who cannot see it" to "Something"
|
|
|
61 |
And I set the field "Width" to "1"
|
|
|
62 |
And I set the field "Height" to "1"
|
|
|
63 |
And I press "Save image"
|
|
|
64 |
And I set the field "Description" to "<p>Image: <img src='/nothing/again' width='123' height='456' alt='Awesome!'>.</p>"
|
|
|
65 |
And I press "Update profile"
|
|
|
66 |
And I click on "Edit profile" "link" in the "region-main" "region"
|
|
|
67 |
And I select the text in the "Description" Atto editor
|
|
|
68 |
And I click on "Insert or edit image" "button"
|
|
|
69 |
And the field "Enter URL" matches value "/nothing/again"
|
|
|
70 |
And the field "Width" matches value "123"
|
|
|
71 |
And the field "Height" matches value "456"
|
|
|
72 |
And the field "Describe this image" matches value "Awesome!"
|
|
|
73 |
|
|
|
74 |
@javascript
|
|
|
75 |
Scenario: Error handling when inserting an image manually
|
|
|
76 |
Given I log in as "admin"
|
|
|
77 |
And I open my profile in edit mode
|
|
|
78 |
And I set the field "Description" to "<p>Image: <img src='/nothing/here'>.</p>"
|
|
|
79 |
And I select the text in the "Description" Atto editor
|
|
|
80 |
When I click on "Insert or edit image" "button"
|
|
|
81 |
Then the field "Enter URL" matches value "/nothing/here"
|
|
|
82 |
And I set the field "Describe this image for someone who cannot see it" to ""
|
|
|
83 |
And I take focus off "Describe this image for someone who cannot see it" "field"
|
|
|
84 |
And I should see "An image must have a description, unless it is marked as decorative only."
|
|
|
85 |
And I set the field "Describe this image for someone who cannot see it" to "Something"
|
|
|
86 |
And I set the field "Enter URL" to ""
|
|
|
87 |
And I press "Save image"
|
|
|
88 |
And I should see "An image must have a URL."
|
|
|
89 |
And I set the field "Enter URL" to "/nothing/here"
|
|
|
90 |
And I set the field "Width" to "1"
|
|
|
91 |
And I set the field "Height" to "1"
|
|
|
92 |
And I press "Save image"
|
|
|
93 |
And I press "Update profile"
|