Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_lesson
2
Feature: In a lesson activity, teacher can edit lesson's pages
3
  In order to modify an existing lesson
4
  As a teacher
5
  I need to edit pages in the lesson
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
11
      | student1 | Student | 1 | student1@example.com |
12
    And the following "courses" exist:
13
      | fullname | shortname | category |
14
      | Course 1 | C1 | 0 |
15
    And the following "course enrolments" exist:
16
      | user | course | role |
17
      | teacher1 | C1 | editingteacher |
18
      | student1 | C1 | student |
19
    And the following "activities" exist:
20
      | activity | name             | course | idnumber |
21
      | lesson   | Test lesson name | C1     | lesson1  |
22
    And the following "mod_lesson > pages" exist:
23
      | lesson           | qtype   | title                 | content              |
24
      | Test lesson name | content | First page name       | First page contents  |
25
      | Test lesson name | content | Second page name      | Second page contents |
26
      | Test lesson name | numeric | Hardest question ever | 1 + 1?              |
27
    And the following "mod_lesson > answers" exist:
28
      | page                  | answer        | response         | jumpto           | score |
29
      | First page name       | Next page     |                  | Next page        | 0     |
30
      | Second page name      | Previous page |                  | Previous page    | 0     |
31
      | Second page name      | Next page     |                  | Next page        | 0     |
32
      | Hardest question ever | 2             | Correct answer   | End of lesson    | 1     |
33
      | Hardest question ever | 1             | Incorrect answer | Second page name | 0     |
34
    And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
35
    And I press "Edit lesson"
36
    And I select edit type "Expanded"
37
 
38
  Scenario: Edit lesson content page
39
    Given I click on "//th[normalize-space(.)='Second page name']/descendant::a[3]" "xpath_element"
40
    When I set the following fields to these values:
41
      | Page title | Modified second page |
42
      | Page contents | Modified contents |
43
      | id_answer_editor_0 | Forward |
44
      | id_jumpto_0 |Next page |
45
      | id_answer_editor_1 | Backward |
46
      | id_jumpto_1 | Previous page |
47
    And I press "Save page"
48
    Then I should see "Modified second page"
49
    And I should not see "Second page name"
50
    And I am on the "Test lesson name" "lesson activity" page logged in as student1
51
    And I should see "First page contents"
52
    And I press "Next page"
53
    And I should see "Modified contents"
54
    And I should not see "Second page contents"
55
    And I press "Backward"
56
    And I should see "First page contents"
57
    And I press "Next page"
58
    And I should see "Modified contents"
59
    And I press "Forward"
60
    And I should see "1 + 1?"
61
    And I set the following fields to these values:
62
      | Your answer | 2 |
63
    And I press "Submit"
64
    And I should see "Correct answer"
65
    And I should not see "Incorrect answer"
66
    And I press "Continue"
67
    And I should see "Congratulations - end of lesson reached"
68
    And I should see "Your score is 1 (out of 1)."
69
 
70
  Scenario: Edit lesson question page
71
    Given I click on "//th[normalize-space(.)='Hardest question ever']/descendant::a[3]" "xpath_element"
72
    When I set the following fields to these values:
73
      | Page title | New hardest question |
74
      | Page contents | 1 + 2? |
75
      | id_answer_editor_0 | 2 |
76
      | id_response_editor_0 | Your answer is incorrect |
77
      | id_jumpto_0 | End of lesson |
78
      | id_score_0 | 0 |
79
      | id_answer_editor_1 | 3 |
80
      | id_response_editor_1 | Your answer is correct |
81
      | id_jumpto_1 | End of lesson |
82
      | id_score_1 | 1 |
83
    And I press "Save page"
84
    Then I should see "New hardest question"
85
    And I should not see "Hardest question ever"
86
    And I am on the "Test lesson name" "lesson activity" page logged in as student1
87
    And I should see "First page contents"
88
    And I press "Next page"
89
    And I should see "Second page contents"
90
    And I press "Next page"
91
    And I should see "1 + 2?"
92
    And I should not see "1 + 1?"
93
    And I set the following fields to these values:
94
      | Your answer | 3 |
95
    And I press "Submit"
96
    And I should see "Your answer is correct"
97
    And I should not see "Incorrect answer"
98
    And I press "Continue"
99
    And I should see "Congratulations - end of lesson reached"
100
    And I should see "Your score is 1 (out of 1)."