1 |
efrain |
1 |
@block @block_messageteacher @block_messageteacher_ajaxform @javascript
|
|
|
2 |
Feature: AJAX message form
|
|
|
3 |
In order to message my teacher easily
|
|
|
4 |
As a student
|
|
|
5 |
I need to access a messaging form without leaving the current page
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | email | firstname | lastname |
|
|
|
10 |
| teststudent | teststudent@example.com | Test | Student |
|
|
|
11 |
| testteacher1 | testteacher1@example.com | Test | Teacher1 |
|
|
|
12 |
And the following "categories" exist:
|
|
|
13 |
| name | category | idnumber |
|
|
|
14 |
| Category 1 | 0 | CAT1 |
|
|
|
15 |
And the following "courses" exist:
|
|
|
16 |
| fullname | shortname | category | format |
|
|
|
17 |
| Course 1 | course1 | CAT1 | topics |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role | enrol |
|
|
|
20 |
| teststudent | course1 | student | manual |
|
|
|
21 |
| testteacher1 | course1 | editingteacher | manual |
|
|
|
22 |
And the following config values are set as admin:
|
|
|
23 |
| roles | 3 | block_messageteacher |
|
|
|
24 |
And the following "blocks" exist:
|
|
|
25 |
| blockname | contextlevel | reference |
|
|
|
26 |
| messageteacher | Course | course1 |
|
|
|
27 |
|
|
|
28 |
Scenario: User accesses form
|
|
|
29 |
Given I log in as "teststudent"
|
|
|
30 |
And I am on "Course 1" course homepage
|
|
|
31 |
When I follow "Test Teacher1"
|
|
|
32 |
Then "Enter your message for Test Teacher1" "fieldset" should exist
|
|
|
33 |
And "Message text" "field" should exist
|
|
|
34 |
And "Send" "button" should exist in the "Message My Teacher" "dialogue"
|
|
|
35 |
|
|
|
36 |
Scenario: Student sends a message and returns to the page
|
|
|
37 |
Given I log in as "teststudent"
|
|
|
38 |
And I am on "Course 1" course homepage
|
|
|
39 |
And I follow "Test Teacher1"
|
|
|
40 |
And I set the following fields to these values:
|
|
|
41 |
| Message text | Test Message |
|
|
|
42 |
When I click on "Send" "button" in the "Message My Teacher" "dialogue"
|
|
|
43 |
Then I should see "Message Sent!"
|
|
|
44 |
And "Enter your message for Test Teacher1" "fieldset" should not exist
|
|
|
45 |
And I click on "body" "css_element"
|
|
|
46 |
Then I should see "Course 1" in the "h1" "css_element"
|
|
|
47 |
|
|
|
48 |
Scenario: Teacher recieves a message sent from the custom form
|
|
|
49 |
Given I log in as "teststudent"
|
|
|
50 |
And I am on "Course 1" course homepage
|
|
|
51 |
And I follow "Test Teacher1"
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| Message text | Test Message |
|
|
|
54 |
And I click on "Send" "button" in the "Message My Teacher" "dialogue"
|
|
|
55 |
And I click on "body" "css_element"
|
|
|
56 |
And I log out
|
|
|
57 |
And I log in as "testteacher1"
|
|
|
58 |
When I select "Test Student" user in messaging
|
|
|
59 |
Then I should see "Test Message"
|
|
|
60 |
|
|
|
61 |
Scenario: Teacher recieves a message sent from the custom form and appendurl is enabled
|
|
|
62 |
Given I log in as "admin"
|
|
|
63 |
And I set the following administration settings values:
|
|
|
64 |
| Append Referring URL | 1 |
|
|
|
65 |
And I log out
|
|
|
66 |
And I log in as "teststudent"
|
|
|
67 |
And I am on "Course 1" course homepage
|
|
|
68 |
And I follow "Test Teacher1"
|
|
|
69 |
And I set the following fields to these values:
|
|
|
70 |
| Message text | Test Message |
|
|
|
71 |
And I click on "Send" "button" in the "Message My Teacher" "dialogue"
|
|
|
72 |
And I click on "body" "css_element"
|
|
|
73 |
And I log out
|
|
|
74 |
And I log in as "testteacher1"
|
|
|
75 |
When I select "Test Student" user in messaging
|
|
|
76 |
Then I should see "Test Message"
|
|
|
77 |
And I should see "/course/view.php?id="
|