Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
@mod @mod_data @javascript @editor_tiny
2
Feature: Edit existing database entries
3
  In order to modify a database entry
4
  As a teacher
5
  I need to successfully have changes recorded for each entry
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | teacher1 | Teacher   | 1        | teacher1@example.com |
11
    And the following "courses" exist:
12
      | fullname | shortname | category |
13
      | Course 1 | C1        | 0        |
14
    And the following "course enrolments" exist:
15
      | user     | course | role           |
16
      | teacher1 | C1     | editingteacher |
17
    And the following "activities" exist:
18
      | activity | name               | intro      | course | idnumber |
19
      | data     | Test database name | Intro text | C1     | data1    |
20
    And the following "mod_data > fields" exist:
21
      | database | type     | name        | required | description |
22
      | data1    | text     | headline    | 1        | Headline    |
23
      | data1    | textarea | description | 0        | Description |
24
    And the following "mod_data > entries" exist:
25
      | database | user     | headline   | description   |
26
      | data1    | teacher1 | Headline 1 | Original text |
27
      | data1    | teacher1 | Headline 2 |               |
28
 
29
  Scenario: Text areas are filled correctly when editing datasets
30
    Given I am on the "Test database name" "data activity" page logged in as "teacher1"
31
    And I select "Single view" from the "jump" singleselect
32
    And I should see "Headline 1" in the "region-main" "region"
33
    And I should see "Original text" in the "region-main" "region"
34
    And I click on ".defaulttemplate-single-body .action-menu" "css_element"
35
    # Edit fields and observe changes.
36
    And I click on "Edit" "link" in the ".defaulttemplate-single-body .dropdown-menu" "css_element"
37
    And I wait until the page is ready
38
    And I set the field "headline" to "New headline"
39
    And I set the field "description" to "New text"
40
    When I click on "Save" "button" in the "sticky-footer" "region"
41
    Then I should not see "Headline 1" in the "region-main" "region"
42
    And I should not see "Original text" in the "region-main" "region"
43
    And I should see "New headline" in the "region-main" "region"
44
    And I should see "New text" in the "region-main" "region"
45
 
46
  Scenario: Text areas are filled correctly when triggering autosave without making changes
47
    Given I am on the "Test database name" "data activity" page logged in as "teacher1"
48
    And I select "Single view" from the "jump" singleselect
49
    # Edit the the first DB entry textfield, but don't save the changes.
50
    And I click on ".defaulttemplate-single-body .action-menu" "css_element"
51
    And I click on "Edit" "link" in the ".defaulttemplate-single-body .dropdown-menu" "css_element"
52
    And I wait until the page is ready
53
    And I set the field "description" to "Unsaved changes"
54
    # Trigger autosave.
55
    And I press tab
56
    And I wait "1" seconds
57
    And I click on "Cancel" "button" in the "sticky-footer" "region"
58
    # Edit the second DB entry headline only.
59
    And I select "Single view" from the "jump" singleselect
60
    And I click on "2" "link" in the "sticky-footer" "region"
61
    And I click on ".defaulttemplate-single-body .action-menu" "css_element"
62
    And I click on "Edit" "link" in the ".defaulttemplate-single-body .dropdown-menu" "css_element"
63
    And I wait until the page is ready
64
    And I set the field "headline" to "New headline"
65
    And I click on "Save" "button" in the "sticky-footer" "region"
66
    And I select "Single view" from the "jump" singleselect
67
    And I click on "2" "link" in the "sticky-footer" "region"
68
    # Only the new heading is updated and the description field autosave did not carry over from the first entry.
69
    And I should see "New headline" in the "region-main" "region"
70
    And I should not see "Unsaved changes" in the "region-main" "region"