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 @_file_upload
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
    And the following "blocks" exist:
20
      | blockname      | contextlevel | reference | pagetypepattern | defaultregion |
21
      | private_files  | System       | 1         | my-index        | side-post     |
22
 
23
  @javascript
24
  Scenario: Restore a draft on user profile page
25
    Given I log in as "teacher1"
26
    And I open my profile in edit mode
27
    And I set the field "Description" to "This is my draft"
28
    And I log out
29
    When I log in as "teacher1"
30
    And I open my profile in edit mode
31
    Then the field "Description" matches value "This is my draft"
32
 
33
  @javascript
34
  Scenario: Do not restore a draft if files have been modified
35
    Given I am on the "Course 1" course page logged in as teacher1
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
39
    And I log in as "teacher2"
40
    And I follow "Manage private files..."
41
    And I upload "/lib/editor/tiny/tests/behat/fixtures/tinyscreenshot.png" file to "Files" filemanager
42
    And I click on "Save changes" "button"
43
    And I am on "Course 1" course homepage
44
    And I navigate to "Settings" in current page administration
45
    And I set the field "Course summary" to "<p>Image test</p>"
46
    And I select the "p" element in position "1" of the "Course summary" TinyMCE editor
47
    And I click on the "Image" button for the "Course summary" TinyMCE editor
48
    And I click on "Browse repositories" "button"
49
    And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
50
    And I click on "tinyscreenshot.png" "link"
51
    And I click on "Select this file" "button"
52
    And I set the field "How would you describe this image to someone who can't see it:" to "It's the Moodle"
53
    And I click on "Save" "button" in the "Image details" "dialogue"
54
    And I click on "Save and display" "button"
55
    When I am on the "Course 1" course page logged in as teacher1
56
    And I navigate to "Settings" in current page administration
57
    Then I should not see "This is my draft"
58
 
59
  @javascript
60
  Scenario: Do not restore a draft if text has been modified
61
    Given I am on the "Course 1" course page logged in as teacher1
62
    And I navigate to "Settings" in current page administration
63
    And I set the field "Course summary" to "This is my draft"
64
    And I am on the "Course 1" course page logged in as teacher2
65
    And I navigate to "Settings" in current page administration
66
    And I set the field "Course summary" to "Modified text"
67
    And I click on "Save and display" "button"
68
    When I am on the "Course 1" course page logged in as teacher1
69
    And I navigate to "Settings" in current page administration
70
    Then I should not see "This is my draft" in the "#id_summary_editor" "css_element"
71
    And the field "Course summary" matches value "<p>Modified text</p>"
72
 
73
  @javascript
74
  Scenario: Draft should not be restored if the form was submitted via Javascript
75
    Given I am on the "Course 1" course page logged in as teacher1
76
    And I follow "Calendar" in the user menu
77
    And I click on "New event" "button"
78
    And I click on "Show more..." "link" in the "New event" "dialogue"
79
    And I set the field "Event title" to "Test course event"
80
    And I set the field "Description" to "This is my draft"
81
    And I click on "Save" "button"
82
    And I click on "New event" "button"
83
    When I click on "Show more..." "link" in the "New event" "dialogue"
84
    Then the field "Description" matches value ""