Rev 11 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
@editor @editor_tiny @tiny_autosaveFeature: Tiny editor autosaveIn order to prevent data lossAs a content creatorI need my content to be saved automaticallyBackground:Given the following "courses" exist:| fullname | shortname | category | groupmode | description | summaryformat || Course 1 | C1 | 0 | 1 | | 1 |And the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | 1 | teacher1@example.com || teacher2 | Teacher | 2 | teacher2@example.com |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher || teacher2 | C1 | editingteacher |@javascriptScenario: Restore a draft on user profile pageGiven I log in as "teacher1"And I open my profile in edit modeAnd I set the field "Description" to "This is my draft"And I log outWhen I log in as "teacher1"And I open my profile in edit modeThen the field "Description" matches value "This is my draft"@javascriptScenario: Do not restore a draft if files have been modifiedGiven the following "user private file" exists:| user | teacher2 || filepath | lib/editor/tiny/tests/behat/fixtures/tinyscreenshot.png |And I am on the "Course 1" course page logged in as teacher1And I navigate to "Settings" in current page administrationAnd I set the field "Course summary" to "This is my draft"And I log outAnd I am on the "Course 1" course page logged in as teacher2And I navigate to "Settings" in current page administrationAnd I set the field "Course summary" to "<p>Image test</p>"And I select the "p" element in position "1" of the "Course summary" TinyMCE editorAnd I click on the "Image" button for the "Course summary" TinyMCE editorAnd I click on "Browse repositories" "button"And I click on "Private files" "link" in the ".fp-repo-area" "css_element"And I click on "tinyscreenshot.png" "link"And I click on "Select this file" "button"And I set the field "How would you describe this image to someone who can't see it?" to "It's the Moodle"And I click on "Save" "button" in the "Image details" "dialogue"And I click on "Save and display" "button"When I am on the "Course 1" course page logged in as teacher1And I navigate to "Settings" in current page administrationThen I should not see "This is my draft"@javascriptScenario: Do not restore a draft if text has been modifiedGiven I am on the "Course 1" course page logged in as teacher1And I navigate to "Settings" in current page administrationAnd I set the field "Course summary" to "This is my draft"And I am on the "Course 1" course page logged in as teacher2And I navigate to "Settings" in current page administrationAnd I set the field "Course summary" to "Modified text"And I click on "Save and display" "button"When I am on the "Course 1" course page logged in as teacher1And I navigate to "Settings" in current page administrationThen I should not see "This is my draft" in the "#id_summary_editor" "css_element"And the field "Course summary" matches value "<p>Modified text</p>"@javascriptScenario: Draft should not be restored if the form was submitted via JavascriptGiven I am on the "Course 1" course page logged in as teacher1And I follow "Calendar" in the user menuAnd I click on "New event" "button"And I click on "Show more..." "link" in the "New event" "dialogue"And I set the field "Event title" to "Test course event"And I set the field "Description" to "This is my draft"And I click on "Save" "button"And I click on "New event" "button"When I click on "Show more..." "link" in the "New event" "dialogue"Then the field "Description" matches value ""@javascriptScenario: Permissions can be configured to control access to autosaveGiven the following "roles" exist:| name | shortname | description | archetype || Custom teacher | custom1 | Limited permissions | editingteacher |And the following "users" exist:| username | firstname | lastname | email || teacher3 | Teacher | 3 | teacher3@example.com |And the following "course enrolments" exist:| user | course | role || teacher3 | C1 | custom1 |And the following "activity" exists:| activity | assign || course | C1 || name | Test assignment |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || tiny/autosave:use | Prohibit | custom1 | Course | C1 |# Check plugin access as a role with prohibited permissions.And I log in as "teacher3"And I am on the "Test assignment" Activity pageAnd I navigate to "Settings" in current page administrationAnd I set the field "Activity instructions" to "This is my draft"And I log outAnd I log in as "teacher3"And I am on the "Test assignment" Activity pageWhen I navigate to "Settings" in current page administrationThen the field "Activity instructions" matches value ""# Check plugin access as a role with allowed permissions.And I log in as "teacher1"And I am on the "Test assignment" Activity pageAnd I navigate to "Settings" in current page administrationAnd I set the field "Activity instructions" to "This is my draft"And I log outAnd I log in as "teacher1"And I am on the "Test assignment" Activity pageAnd I navigate to "Settings" in current page administrationAnd the field "Activity instructions" matches value "This is my draft"