2 Feature: Contact site support method and availability can be customised
3 In order to effectively support people using my Moodle site
5 I need to be able to configure the site support method and who has access to it
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | user1 | User | One | user1@example.com |
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"
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"
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 not see "Contact site support" in the "page-header" "region"
40 # Confirm someone logged in as guest cannot see the option or directly access the page.
41 And I log in as "guest"
42 And I should not see "Contact site support" in the "page-footer" "region"
43 And I am on the "user > Contact Site Support" page
44 And I should not see "Contact site support" in the "page-header" "region"
46 # Confirm logged in user has access to the contact form.
47 And I log in as "user1"
48 And I should see "Contact site support" in the "page-footer" "region"
49 And I click on "Contact site support" "link" in the "page-footer" "region"
50 And I should see "Contact site support" in the "page-header" "region"
52 Scenario: Contact site support can be disabled
53 Given the following config values are set as admin:
54 | supportavailability | 0 |
55 | defaulthomepage | 0 |
56 # Confirm unauthenticated visitor cannot see the option.
57 When I am on site homepage
58 Then I should not see "Contact site support" in the "page-footer" "region"
59 # Confirm someone logged in as guest cannot see the option.
60 And I log in as "guest"
61 And I should not see "Contact site support" in the "page-footer" "region"
63 # Confirm logged in user cannot see the option.
64 And I log in as "user1"
65 And I should not see "Contact site support" in the "page-footer" "region"
67 # Confirm admin cannot see the option.
68 And I log in as "admin"
69 And I should not see "Contact site support" in the "page-footer" "region"
70 # Confirm visiting the contact form directly without permission redirects to the homepage.
71 And I am on the "user > Contact Site Support" page
72 And I should see "Acceptance test site" in the "page-header" "region"
73 And I should not see "Contact site support" in the "page-header" "region"
76 Scenario: Contact site support link opens a custom support page URL if set
77 Given the following config values are set as admin:
78 | supportavailability | 1 |
79 | supportpage | user/profile.php |
80 When I log in as "user1"
81 And I am on site homepage
82 And I click on "Contact site support" "link" in the "page-footer" "region"
83 And I switch to a second window
84 Then I should see "User One" in the "page-header" "region"
85 And I should not see "Contact site support" in the "page-header" "region"
86 And I close all opened windows
88 Scenario: Visiting the contact site support page directly will redirect to the custom support page if set
89 Given the following config values are set as admin:
90 | supportavailability | 2 |
91 | supportpage | profile.php |
92 When I log in as "user1"
93 And I am on the "user > Contact Site Support" page
94 Then I should see "User One" in the "page-header" "region"
95 And I should not see "Contact site support" in the "page-header" "region"
97 Scenario: Visiting the contact site support page still redirects to homepage if access to support is disabled
98 Given the following config values are set as admin:
99 | supportavailability | 0 |
100 | supportpage | profile.php |
101 | defaulthomepage | 0 |
102 When I log in as "user1"
103 And I am on the "user > Contact Site Support" page
104 Then I should see "Acceptance test site" in the "page-header" "region"
105 And I should not see "Contact site support" in the "page-header" "region"