1 |
efrain |
1 |
@core @core_user
|
|
|
2 |
Feature: Contact site support method and availability can be customised
|
|
|
3 |
In order to effectively support people using my Moodle site
|
|
|
4 |
As an admin
|
|
|
5 |
I need to be able to configure the site support method and who has access to it
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| user1 | User | One | user1@example.com |
|
|
|
11 |
|
|
|
12 |
Scenario: Contact site support can be made available to all site visitors
|
|
|
13 |
Given the following config values are set as admin:
|
|
|
14 |
| supportavailability | 2 |
|
|
|
15 |
# Confirm unauthenticated visitor has access to the contact form.
|
|
|
16 |
When I am on site homepage
|
|
|
17 |
Then I should see "Contact site support" in the "page-footer" "region"
|
|
|
18 |
And I click on "Contact site support" "link" in the "page-footer" "region"
|
|
|
19 |
And I should see "Contact site support" in the "page-header" "region"
|
|
|
20 |
# Confirm someone logged in as guest has access to the contact form.
|
|
|
21 |
And I log in as "guest"
|
|
|
22 |
And I should see "Contact site support" in the "page-footer" "region"
|
|
|
23 |
And I click on "Contact site support" "link" in the "page-footer" "region"
|
|
|
24 |
And I should see "Contact site support" in the "page-header" "region"
|
|
|
25 |
And I log out
|
|
|
26 |
# Confirm logged in user has access to the contact form.
|
|
|
27 |
And I log in as "user1"
|
|
|
28 |
And I should see "Contact site support" in the "page-footer" "region"
|
|
|
29 |
And I click on "Contact site support" "link" in the "page-footer" "region"
|
|
|
30 |
And I should see "Contact site support" in the "page-header" "region"
|
|
|
31 |
|
|
|
32 |
Scenario: Contact site support can be limited to authenticated users
|
|
|
33 |
Given the following config values are set as admin:
|
|
|
34 |
| supportavailability | 1 |
|
|
|
35 |
# Confirm unauthenticated visitor cannot see the option or directly access the page.
|
|
|
36 |
When I am on site homepage
|
|
|
37 |
Then I should not see "Contact site support" in the "page-footer" "region"
|
|
|
38 |
And I am on the "user > Contact Site Support" page
|
|
|
39 |
And I should see "Acceptance test site" in the "page-header" "region"
|
|
|
40 |
And I should not see "Contact site support" in the "page-header" "region"
|
|
|
41 |
# Confirm someone logged in as guest cannot see the option or directly access the page.
|
|
|
42 |
And I log in as "guest"
|
|
|
43 |
And I should not see "Contact site support" in the "page-footer" "region"
|
|
|
44 |
And I am on the "user > Contact Site Support" page
|
|
|
45 |
And I should see "Acceptance test site" in the "page-header" "region"
|
|
|
46 |
And I should not see "Contact site support" in the "page-header" "region"
|
|
|
47 |
And I log out
|
|
|
48 |
# Confirm logged in user has access to the contact form.
|
|
|
49 |
And I log in as "user1"
|
|
|
50 |
And I should see "Contact site support" in the "page-footer" "region"
|
|
|
51 |
And I click on "Contact site support" "link" in the "page-footer" "region"
|
|
|
52 |
And I should see "Contact site support" in the "page-header" "region"
|
|
|
53 |
|
|
|
54 |
Scenario: Contact site support can be disabled
|
|
|
55 |
Given the following config values are set as admin:
|
|
|
56 |
| supportavailability | 0 |
|
|
|
57 |
| defaulthomepage | home |
|
|
|
58 |
# Confirm unauthenticated visitor cannot see the option.
|
|
|
59 |
When I am on site homepage
|
|
|
60 |
Then I should not see "Contact site support" in the "page-footer" "region"
|
|
|
61 |
# Confirm someone logged in as guest cannot see the option.
|
|
|
62 |
And I log in as "guest"
|
|
|
63 |
And I should not see "Contact site support" in the "page-footer" "region"
|
|
|
64 |
And I log out
|
|
|
65 |
# Confirm logged in user cannot see the option.
|
|
|
66 |
And I log in as "user1"
|
|
|
67 |
And I should not see "Contact site support" in the "page-footer" "region"
|
|
|
68 |
And I log out
|
|
|
69 |
# Confirm admin cannot see the option.
|
|
|
70 |
And I log in as "admin"
|
|
|
71 |
And I should not see "Contact site support" in the "page-footer" "region"
|
|
|
72 |
# Confirm visiting the contact form directly without permission redirects to the homepage.
|
|
|
73 |
And I am on the "user > Contact Site Support" page
|
|
|
74 |
And I should see "Acceptance test site" in the "page-header" "region"
|
|
|
75 |
And I should not see "Contact site support" in the "page-header" "region"
|
|
|
76 |
|
|
|
77 |
@javascript
|
|
|
78 |
Scenario: Contact site support link opens a custom support page URL if set
|
|
|
79 |
Given the following config values are set as admin:
|
|
|
80 |
| supportavailability | 1 |
|
|
|
81 |
| supportpage | user/profile.php |
|
|
|
82 |
When I log in as "user1"
|
|
|
83 |
And I am on site homepage
|
|
|
84 |
And I click on "Contact site support" "link" in the "page-footer" "region"
|
|
|
85 |
And I switch to a second window
|
|
|
86 |
Then I should see "User One" in the "page-header" "region"
|
|
|
87 |
And I should not see "Contact site support" in the "page-header" "region"
|
|
|
88 |
And I close all opened windows
|
|
|
89 |
|
|
|
90 |
Scenario: Visiting the contact site support page directly will redirect to the custom support page if set
|
|
|
91 |
Given the following config values are set as admin:
|
|
|
92 |
| supportavailability | 2 |
|
|
|
93 |
| supportpage | profile.php |
|
|
|
94 |
When I log in as "user1"
|
|
|
95 |
And I am on the "user > Contact Site Support" page
|
|
|
96 |
Then I should see "User One" in the "page-header" "region"
|
|
|
97 |
And I should not see "Contact site support" in the "page-header" "region"
|
|
|
98 |
|
|
|
99 |
Scenario: Visiting the contact site support page still redirects to homepage if access to support is disabled
|
|
|
100 |
Given the following config values are set as admin:
|
|
|
101 |
| supportavailability | 0 |
|
|
|
102 |
| supportpage | profile.php |
|
|
|
103 |
| defaulthomepage | home |
|
|
|
104 |
When I log in as "user1"
|
|
|
105 |
And I am on the "user > Contact Site Support" page
|
|
|
106 |
Then I should see "Acceptance test site" in the "page-header" "region"
|
|
|
107 |
And I should not see "Contact site support" in the "page-header" "region"
|