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
@editor @editor_tiny @tiny_link @_file_upload
2
Feature: Add links to TinyMCE
3
  To write rich text - I need to add links.
4
 
5
  @javascript
6
  Scenario: Insert a link
7
    Given the following "blocks" exist:
8
      | blockname     | contextlevel | reference | pagetypepattern | defaultregion |
9
      | private_files | System       | 1         | my-index        | side-post     |
10
    And I log in as "admin"
11
    And I follow "Manage private files..."
12
    And I upload "lib/editor/tiny/tests/behat/fixtures/moodle-logo.png" file to "Files" filemanager
13
    And I click on "Save changes" "button"
14
    And I open my profile in edit mode
15
    And I set the field "Description" to "Super cool"
16
    When I select the "p" element in position "0" of the "Description" TinyMCE editor
17
    And I click on the "Link" button for the "Description" TinyMCE editor
18
    Then the field "Text to display" matches value "Super cool"
19
    And I click on "Browse repositories..." "button" in the "Create link" "dialogue"
20
    And I select "Private files" repository in file picker
21
    And I click on "moodle-logo.png" "link"
22
    And I click on "Select this file" "button"
23
    And I click on "Update profile" "button"
24
    And I follow "Preferences" in the user menu
25
    And I follow "Editor preferences"
26
    And I set the field "Text editor" to "Plain text area"
27
    And I press "Save changes"
28
    And I click on "Edit profile" "link" in the "region-main" "region"
29
    And I should see "Super cool</a>"
30
 
31
  @javascript
32
  Scenario: Insert a link without providing text to display
33
    Given I log in as "admin"
34
    When I open my profile in edit mode
35
    And I click on the "Link" button for the "Description" TinyMCE editor
36
    And I set the field "URL" to "https://moodle.org/"
37
    Then the field "Text to display" matches value "https://moodle.org/"
38
    And I click on "Create link" "button" in the "Create link" "dialogue"
39
    And the field "Description" matches value "<p><a href=\"https://moodle.org/\">https://moodle.org/</a></p>"
40
    And I select the "a" element in position "0" of the "Description" TinyMCE editor
41
    And I click on the "Link" button for the "Description" TinyMCE editor
42
    And the field "Text to display" matches value "https://moodle.org/"
43
    And the field "URL" matches value "https://moodle.org/"
44
    And I click on "Close" "button" in the "Create link" "dialogue"
45
 
46
  @javascript
47
  Scenario: Insert a link with providing text to display
48
    Given I log in as "admin"
49
    When I open my profile in edit mode
50
    And I click on "Link" "button"
51
    And I set the field "Text to display" to "Moodle - Open-source learning platform"
52
    And I set the field "Enter a URL" to "https://moodle.org/"
53
    And I click on "Create link" "button" in the "Create link" "dialogue"
54
    Then the field "Description" matches value "<p><a href=\"https://moodle.org/\">Moodle - Open-source learning platform</a></p>"
55
    And I select the "a" element in position "0" of the "Description" TinyMCE editor
56
    And I click on the "Link" button for the "Description" TinyMCE editor
57
    And the field "Text to display" matches value "Moodle - Open-source learning platform"
58
    And the field "Enter a URL" matches value "https://moodle.org/"
59
    And I click on "Close" "button" in the "Create link" "dialogue"
60
 
61
  @javascript
62
  Scenario: Edit a link that already had a custom text to display
63
    Given I log in as "admin"
64
    And I follow "Preferences" in the user menu
65
    And I follow "Editor preferences"
66
    And I set the field "Text editor" to "Plain text area"
67
    And I press "Save changes"
68
    And I click on "Edit profile" "link" in the "region-main" "region"
69
    And I set the field "Description" to "<a href=\"https://moodle.org/\">Moodle - Open-source learning platform</a>"
70
    And I click on "Update profile" "button"
71
    And I follow "Preferences" in the user menu
72
    And I follow "Editor preferences"
73
    And I set the field "Text editor" to "TinyMCE editor"
74
    And I press "Save changes"
75
    When I click on "Edit profile" "link" in the "region-main" "region"
76
    Then the field "Description" matches value "<p><a href=\"https://moodle.org/\">Moodle - Open-source learning platform</a></p>"
77
    And I select the "a" element in position "0" of the "Description" TinyMCE editor
78
    And I click on the "Link" button for the "Description" TinyMCE editor
79
    And the field "Text to display" matches value "Moodle - Open-source learning platform"
80
    And the field "Enter a URL" matches value "https://moodle.org/"
81
 
82
  @javascript
83
  Scenario: Insert and update link in the TinyMCE editor
84
    Given I log in as "admin"
85
    When I open my profile in edit mode
86
    And I click on "Link" "button"
87
    And I set the field "Text to display" to "Moodle - Open-source learning platform"
88
    And I set the field "Enter a URL" to "https://moodle.org/"
89
    And I click on "Create link" "button" in the "Create link" "dialogue"
90
    Then the field "Description" matches value "<p><a href=\"https://moodle.org/\">Moodle - Open-source learning platform</a></p>"
91
    And I select the "a" element in position "0" of the "Description" TinyMCE editor
92
    And I click on the "Link" button for the "Description" TinyMCE editor
93
    And the field "Text to display" matches value "Moodle - Open-source learning platform"
94
    And the field "Enter a URL" matches value "https://moodle.org/"
95
    And I set the field "Enter a URL" to "https://moodle.com/"
96
    And "Create link" "button" should not exist in the "Create link" "dialogue"
97
    And "Update link" "button" should exist in the "Create link" "dialogue"
98
    And I click on "Update link" "button" in the "Create link" "dialogue"
99
    And the field "Description" matches value "<p><a href=\"https://moodle.com/\">Moodle - Open-source learning platform</a></p>"
100
 
101
  @javascript
102
  Scenario: Insert a link for an image using TinyMCE editor
103
    Given I log in as "admin"
104
    And I follow "Private files" in the user menu
105
    And I upload "lib/editor/tiny/tests/behat/fixtures/moodle-logo.png" file to "Files" filemanager
106
    And I click on "Save changes" "button"
107
    And I open my profile in edit mode
108
    And I click on the "Image" button for the "Description" TinyMCE editor
109
    And I click on "Browse repositories" "button" in the "Insert image" "dialogue"
110
    And I select "Private files" repository in file picker
111
    And I click on "moodle-logo.png" "link"
112
    And I click on "Select this file" "button"
113
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the Moodle"
114
    And I click on "Save" "button" in the "Image details" "dialogue"
115
    And I select the "img" element in position "0" of the "Description" TinyMCE editor
116
    And I click on the "Link" button for the "Description" TinyMCE editor
117
    And I set the field "Enter a URL" to "https://moodle.org/"
118
    And I set the field "Text to display" to "Moodle - Open-source learning platform"
119
    And I click on "Update link" "button" in the "Create link" "dialogue"
120
    # TODO: Verify the HTML by the improved code plugin in MDL-75265
121
    And I click on "Update profile" "button"
122
    And I follow "Preferences" in the user menu
123
    And I follow "Editor preferences"
124
    And I set the field "Text editor" to "Plain text area"
125
    And I press "Save changes"
126
    When I click on "Edit profile" "link" in the "region-main" "region"
127
    Then I should see "<a title=\"Moodle - Open-source learning platform\" href=\"https://moodle.org/\"><img"
128
    And I follow "Preferences" in the user menu
129
    And I follow "Editor preferences"
130
    And I set the field "Text editor" to "TinyMCE editor"
131
    And I press "Save changes"
132
    And I click on "Edit profile" "link" in the "region-main" "region"
133
    And I select the "img" element in position "0" of the "Description" TinyMCE editor
134
    And I click on the "Image" button for the "Description" TinyMCE editor
135
    And the field "How would you describe this image to someone who can't see it:" matches value "It's the Moodle"
136
    And I click on "Close" "button" in the "Image details" "dialogue"
137
    And I click on the "Link" button for the "Description" TinyMCE editor
138
    And the field "Text to display" matches value "Moodle - Open-source learning platform"
139
    And the field "Enter a URL" matches value "https://moodle.org/"
140
 
141
  @javascript
142
  Scenario: Unset a link
143
    Given I log in as "admin"
144
    And I follow "Preferences" in the user menu
145
    And I follow "Editor preferences"
146
    And I set the field "Text editor" to "Plain text area"
147
    And I press "Save changes"
148
    And I click on "Edit profile" "link" in the "region-main" "region"
149
    And I set the field "Description" to "<a href=\"https://moodle.org/\">Moodle - Open-source learning platform</a>"
150
    And I click on "Update profile" "button"
151
    And I follow "Preferences" in the user menu
152
    And I follow "Editor preferences"
153
    And I set the field "Text editor" to "TinyMCE editor"
154
    And I press "Save changes"
155
    And I click on "Edit profile" "link" in the "region-main" "region"
156
    And I select the "a" element in position "0" of the "Description" TinyMCE editor
157
    When I click on the "Unlink" button for the "Description" TinyMCE editor
158
    Then the field "Description" matches value "<p>Moodle - Open-source learning platform</p>"