11 |
efrain |
1 |
@editor @editor_atto @atto
|
1 |
efrain |
2 |
Feature: Atto Autosave
|
|
|
3 |
To reduce frustration, atto should save drafts of my work.
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given the following "courses" exist:
|
|
|
7 |
| fullname | shortname | category | groupmode |
|
|
|
8 |
| Course 1 | C1 | 0 | 1 |
|
|
|
9 |
And the following "users" exist:
|
|
|
10 |
| username | firstname | lastname | email |
|
|
|
11 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
12 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher1 | C1 | editingteacher |
|
|
|
16 |
| teacher2 | C1 | editingteacher |
|
|
|
17 |
And I log in as "admin"
|
|
|
18 |
And I navigate to "Plugins > Text editors > Atto HTML editor > Atto toolbar settings" in site administration
|
|
|
19 |
And I set the field "Autosave frequency" to "3"
|
|
|
20 |
And I set the field with xpath "//select[@name='s_editor_atto_autosavefrequency[u]']" to "seconds"
|
|
|
21 |
And I click on "Save changes" "button"
|
|
|
22 |
And I am on "Course 1" course homepage
|
|
|
23 |
And I navigate to "Settings" in current page administration
|
|
|
24 |
And I set the field "Course summary format" to "1"
|
|
|
25 |
And I click on "Save and display" "button"
|
|
|
26 |
And I log out
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Restore a draft
|
|
|
30 |
Given I log in as "teacher1"
|
|
|
31 |
And I am on "Course 1" course homepage
|
|
|
32 |
And I navigate to "Settings" in current page administration
|
|
|
33 |
And I set the field "Course summary" to "This is my draft"
|
|
|
34 |
# Wait for the autosave
|
|
|
35 |
And I wait "5" seconds
|
|
|
36 |
And I log out
|
|
|
37 |
When I log in as "teacher1"
|
|
|
38 |
And I am on "Course 1" course homepage
|
|
|
39 |
And I navigate to "Settings" in current page administration
|
|
|
40 |
# Wait for the autorestore
|
|
|
41 |
And I wait "2" seconds
|
|
|
42 |
Then I should see "This is my draft"
|
|
|
43 |
|
|
|
44 |
@javascript
|
|
|
45 |
Scenario: Do not restore a draft if files have been modified
|
11 |
efrain |
46 |
Given the following "user private file" exists:
|
|
|
47 |
| user | teacher2 |
|
|
|
48 |
| filepath | lib/editor/atto/tests/fixtures/moodle-logo.png |
|
|
|
49 |
And I am on the "Course 1" course page logged in as teacher1
|
1 |
efrain |
50 |
And I navigate to "Settings" in current page administration
|
|
|
51 |
And I set the field "Course summary" to "This is my draft"
|
|
|
52 |
# Wait for the autosave
|
|
|
53 |
And I wait "5" seconds
|
|
|
54 |
And I log out
|
11 |
efrain |
55 |
And I am on the "Course 1" course page logged in as teacher2
|
1 |
efrain |
56 |
And I navigate to "Settings" in current page administration
|
|
|
57 |
And I set the field "Course summary" to "<p>Image test</p>"
|
|
|
58 |
And I select the text in the "Course summary" Atto editor
|
|
|
59 |
And I click on "Insert or edit image" "button"
|
|
|
60 |
And I click on "Browse repositories..." "button"
|
|
|
61 |
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
|
|
62 |
And I click on "moodle-logo.png" "link"
|
|
|
63 |
And I click on "Select this file" "button"
|
|
|
64 |
And I set the field "Describe this image" to "It's the Moodle"
|
|
|
65 |
# Wait for the page to "settle".
|
|
|
66 |
And I wait until the page is ready
|
|
|
67 |
And I click on "Save image" "button"
|
|
|
68 |
And I click on "Save and display" "button"
|
|
|
69 |
And I log out
|
|
|
70 |
When I log in as "teacher1"
|
|
|
71 |
And I am on "Course 1" course homepage
|
|
|
72 |
And I navigate to "Settings" in current page administration
|
|
|
73 |
Then I should not see "This is my draft"
|
|
|
74 |
|
|
|
75 |
@javascript
|
|
|
76 |
Scenario: Do not restore a draft if text has been modified
|
|
|
77 |
Given I log in as "teacher1"
|
|
|
78 |
And I am on "Course 1" course homepage
|
|
|
79 |
And I navigate to "Settings" in current page administration
|
|
|
80 |
And I set the field "Course summary" to "This is my draft"
|
|
|
81 |
# Wait for the autosave
|
|
|
82 |
And I wait "5" seconds
|
|
|
83 |
And I log out
|
|
|
84 |
And I log in as "teacher2"
|
|
|
85 |
And I am on "Course 1" course homepage
|
|
|
86 |
And I navigate to "Settings" in current page administration
|
|
|
87 |
And I set the field "Course summary" to "Modified text"
|
|
|
88 |
And I click on "Save and display" "button"
|
|
|
89 |
And I log out
|
|
|
90 |
When I log in as "teacher1"
|
|
|
91 |
And I am on "Course 1" course homepage
|
|
|
92 |
And I navigate to "Settings" in current page administration
|
|
|
93 |
Then I should not see "This is my draft"
|
|
|
94 |
And I should see "Modified text"
|