forked from AgileVentures/shf-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin-sets-custom-waiting-reason.feature
More file actions
105 lines (81 loc) · 5.04 KB
/
Copy pathadmin-sets-custom-waiting-reason.feature
File metadata and controls
105 lines (81 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Feature: Admin sets or enters the reason they are waiting for info from a user
As an admin
so that SHF can talk with the user specifically about why they are waiting and know how long they might need to wait,
I need to set the reason why SHF is waiting
and if the reason is not available from a list,
I need to be able to type in text that describes the situation
PT: https://www.pivotaltracker.com/story/show/143810729
Background:
Given the following users exists
| email | admin |
| anna_waiting_for_info@nosnarkybarky.se | |
| admin@shf.com | true |
Given the following business categories exist
| name | description |
| rehab | physcial rehabitation |
Given the following regions exist:
| name |
| Stockholm |
Given the following companies exist:
| name | company_number | email | region |
| No More Snarky Barky | 5560360793 | snarky@snarkybarky.se | Stockholm |
And the following applications exist:
| first_name | user_email | company_number | category_name | state |
| AnnaWaiting | anna_waiting_for_info@nosnarkybarky.se | 5560360793 | rehab | waiting_for_applicant |
And the following member app waiting reasons exist
| name_sv | description_sv | name_en | description_en | is_custom |
| need doc | need doc | need documentation | need more documents proving qualifications | false |
| waiting for payment | still waiting for payment | waiting for payment | still waiting for payment | false |
And I am logged in as "admin@shf.com"
@javascript
Scenario: Admin selects 'need more documentation' as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to "need doc"
Then "member_app_waiting_reasons" should have "need doc" selected
And I am on the list applications page
And I am on "AnnaWaiting" application page
Then "member_app_waiting_reasons" should have "need doc" selected
@javascript
Scenario: Admin selects 'waiting for payment' as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to "waiting for payment"
And I am on the list applications page
And I am on "AnnaWaiting" application page
And "member_app_waiting_reasons" should have "waiting for payment" selected
@javascript
Scenario: Admin selects 'other' and enters text as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I am on the list applications page
And I am on "AnnaWaiting" application page
#And item t("admin_only.member_app_waiting_reasons.other_custom_reason") should be visible
And I should see t("membership_applications.need_info.other_reason_label")
And the "custom_reason_text" field should be set to "This is my reason"
And "member_app_waiting_reasons" should have t("admin_only.member_app_waiting_reasons.other_custom_reason") selected
@javascript
Scenario: Admin selects 'other' and fills in custom text but then changes reason to something else
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I set "member_app_waiting_reasons" to "waiting for payment"
And I am on the list applications page
And I am on "AnnaWaiting" application page
And "member_app_waiting_reasons" should have "waiting for payment" selected
@javascript
Scenario: When selected reason is not 'custom other,' the custom text is saved as blank (empty string)
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I set "member_app_waiting_reasons" to "need doc"
# change back so the custom reason field shows. it should be blank
And I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
Then I should not see "This is my reason"
@javascript
Scenario: owner cannot see the fields for changing the reason
Given I am logged in as "anna_waiting_for_info@nosnarkybarky.se"
And I am on the application page for "AnnaWaiting"
Then I should not see t("membership_applications.need_info.reason_title")