Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_courserating @javascript
2
Feature: Viewing and adding course ratings as a student
3
 
4
  Background:
5
    Given the following "courses" exist:
6
      | fullname | shortname | numsections |
7
      | Course 1 | C1        | 1           |
8
      | Course 2 | C2        | 1           |
9
      | Course 3 | C3        | 1           |
10
    Given the following "users" exist:
11
      | username | firstname | lastname | email                |
12
      | teacher1 | Teacher   | 1        | teacher1@example.com |
13
      | student1 | Student   | 1        | student1@example.com |
14
      | student2 | Student   | 2        | student2@example.com |
15
      | manager1 | Manager   | 1        | manager1@example.com |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | student1 | C1     | student        |
19
      | student2 | C1     | student        |
20
      | teacher1 | C1     | editingteacher |
21
    And the following "role assigns" exist:
22
      | user     | role    | contextlevel | reference |
23
      | manager1 | manager | System       |           |
24
 
25
  Scenario: Rating a course as a student
26
    When I log in as "student1"
27
    And I am on "Course 1" course homepage
28
    And I follow "Leave a rating"
29
    And I click on ".tool_courserating-form-stars-group .stars-3" "css_element"
30
    And I press "Save changes"
31
    And I should see "3.0" in the ".tool_courserating-widget" "css_element"
32
    And I should see "(1)" in the ".tool_courserating-widget" "css_element"
33
    And I log out
34
    And I log in as "student2"
35
    And I am on "Course 1" course homepage
36
    And I should see "3.0" in the ".tool_courserating-widget" "css_element"
37
    And I should see "(1)" in the ".tool_courserating-widget" "css_element"
38
    And I follow "Leave a rating"
39
    And I click on ".tool_courserating-form-stars-group .stars-4" "css_element"
40
    And I press "Save changes"
41
    And I should see "3.5" in the ".tool_courserating-widget" "css_element"
42
    And I click on "(2)" "text" in the ".tool_courserating-widget" "css_element"
43
    And I follow "View all reviews"
44
    And I should see "3.5" in the "Course reviews" "dialogue"
45
 
46
  Scenario: Flagging course ratings as a student
47
    Given the following "tool_courserating > ratings" exist:
48
      | user     | course | rating | review |
49
      | student1 | C1     | 3      | abcdef |
50
      | student2 | C1     | 4      | hello  |
51
    And I log in as "student2"
52
    And I am on "Course 1" course homepage
53
    And I should see "3.5" in the ".tool_courserating-widget" "css_element"
54
    And I should see "(2)" in the ".tool_courserating-widget" "css_element"
55
    And I click on ".tool_courserating-ratings" "css_element"
56
    And I follow "View all reviews"
57
    And I should see "abcdef" in the "Student 1" "tool_courserating > Review"
58
    And I click on "Flag" "link" in the "Student 1" "tool_courserating > Review"
59
    And I should see "You have flagged this review as inappropriate/offensive." in the "Student 1" "tool_courserating > Review"
60
    And I should not see "user(s) have flagged this review as inappropriate/offensive."
61
    And I should not see "Permanently delete"
62
    And I should not see "You have flagged this review as inappropriate/offensive." in the "Student 2" "tool_courserating > Review"
63
    And I log out
64
    And I log in as "manager1"
65
    And I am on course index
66
    And I click on ".tool_courserating-ratings" "css_element" in the "Course 1" "tool_courserating > Coursebox"
67
    And "Flag" "link" should exist in the "Student 1" "tool_courserating > Review"
68
    And I should see "1 user(s) have flagged this review as inappropriate/offensive." in the "Student 1" "tool_courserating > Review"
69
    And I should see "Permanently delete" in the "Student 1" "tool_courserating > Review"
70
    And I should not see "user(s) have flagged this review as inappropriate/offensive." in the "Student 2" "tool_courserating > Review"
71
 
72
  Scenario: Viewing course ratings as a non-logged in user
73
    Given the following "tool_courserating > ratings" exist:
74
      | user     | course | rating | review |
75
      | student1 | C1     | 3      | abcdef |
76
      | student2 | C1     | 4      | hello  |
77
    And the following config values are set as admin:
78
      | frontpage         | 7,6 |                |
79
      | frontpageloggedin | 7,6 |                |
80
    And I am on site homepage
81
    And I should see "3.5" in the "Course 1" "tool_courserating > Coursebox"
82
    And I should see "(2)" in the "Course 1" "tool_courserating > Coursebox"
83
    And I click on ".tool_courserating-ratings" "css_element" in the "Course 1" "tool_courserating > Coursebox"
84
    And I should see "3.5" in the "Course reviews" "dialogue"
85
    And I should see "abcdef" in the "Course reviews" "dialogue"
86
    And I should see "hello" in the "Course reviews" "dialogue"
87
    And I should not see "Flag"
88
    And I click on "Close" "button" in the "Course reviews" "dialogue"