11 |
efrain |
1 |
@editor @editor_tiny @tiny_autosave
|
1 |
efrain |
2 |
Feature: Tiny editor autosave
|
|
|
3 |
In order to prevent data loss
|
|
|
4 |
As a content creator
|
|
|
5 |
I need my content to be saved automatically
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category | groupmode | description | summaryformat |
|
|
|
10 |
| Course 1 | C1 | 0 | 1 | | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| teacher2 | C1 | editingteacher |
|
|
|
19 |
|
|
|
20 |
@javascript
|
|
|
21 |
Scenario: Restore a draft on user profile page
|
|
|
22 |
Given I log in as "teacher1"
|
|
|
23 |
And I open my profile in edit mode
|
|
|
24 |
And I set the field "Description" to "This is my draft"
|
|
|
25 |
And I log out
|
|
|
26 |
When I log in as "teacher1"
|
|
|
27 |
And I open my profile in edit mode
|
|
|
28 |
Then the field "Description" matches value "This is my draft"
|
|
|
29 |
|
|
|
30 |
@javascript
|
|
|
31 |
Scenario: Do not restore a draft if files have been modified
|
11 |
efrain |
32 |
Given the following "user private file" exists:
|
|
|
33 |
| user | teacher2 |
|
|
|
34 |
| filepath | lib/editor/tiny/tests/behat/fixtures/tinyscreenshot.png |
|
|
|
35 |
And I am on the "Course 1" course page logged in as teacher1
|
1 |
efrain |
36 |
And I navigate to "Settings" in current page administration
|
|
|
37 |
And I set the field "Course summary" to "This is my draft"
|
|
|
38 |
And I log out
|
11 |
efrain |
39 |
And I am on the "Course 1" course page logged in as teacher2
|
1 |
efrain |
40 |
And I navigate to "Settings" in current page administration
|
|
|
41 |
And I set the field "Course summary" to "<p>Image test</p>"
|
|
|
42 |
And I select the "p" element in position "1" of the "Course summary" TinyMCE editor
|
|
|
43 |
And I click on the "Image" button for the "Course summary" TinyMCE editor
|
|
|
44 |
And I click on "Browse repositories" "button"
|
|
|
45 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
46 |
And I click on "tinyscreenshot.png" "link"
|
|
|
47 |
And I click on "Select this file" "button"
|
11 |
efrain |
48 |
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 |
49 |
And I click on "Save" "button" in the "Image details" "dialogue"
|
|
|
50 |
And I click on "Save and display" "button"
|
|
|
51 |
When I am on the "Course 1" course page logged in as teacher1
|
|
|
52 |
And I navigate to "Settings" in current page administration
|
|
|
53 |
Then I should not see "This is my draft"
|
|
|
54 |
|
|
|
55 |
@javascript
|
|
|
56 |
Scenario: Do not restore a draft if text has been modified
|
|
|
57 |
Given I am on the "Course 1" course page logged in as teacher1
|
|
|
58 |
And I navigate to "Settings" in current page administration
|
|
|
59 |
And I set the field "Course summary" to "This is my draft"
|
|
|
60 |
And I am on the "Course 1" course page logged in as teacher2
|
|
|
61 |
And I navigate to "Settings" in current page administration
|
|
|
62 |
And I set the field "Course summary" to "Modified text"
|
|
|
63 |
And I click on "Save and display" "button"
|
|
|
64 |
When I am on the "Course 1" course page logged in as teacher1
|
|
|
65 |
And I navigate to "Settings" in current page administration
|
|
|
66 |
Then I should not see "This is my draft" in the "#id_summary_editor" "css_element"
|
|
|
67 |
And the field "Course summary" matches value "<p>Modified text</p>"
|
|
|
68 |
|
|
|
69 |
@javascript
|
|
|
70 |
Scenario: Draft should not be restored if the form was submitted via Javascript
|
|
|
71 |
Given I am on the "Course 1" course page logged in as teacher1
|
|
|
72 |
And I follow "Calendar" in the user menu
|
|
|
73 |
And I click on "New event" "button"
|
|
|
74 |
And I click on "Show more..." "link" in the "New event" "dialogue"
|
|
|
75 |
And I set the field "Event title" to "Test course event"
|
|
|
76 |
And I set the field "Description" to "This is my draft"
|
|
|
77 |
And I click on "Save" "button"
|
|
|
78 |
And I click on "New event" "button"
|
|
|
79 |
When I click on "Show more..." "link" in the "New event" "dialogue"
|
|
|
80 |
Then the field "Description" matches value ""
|