Skip to content

Commit ceb562f

Browse files
committed
test(behat): add unified search integration scenarios
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e464cda commit ceb562f

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
Feature: profile fields unified search
2+
Background:
3+
Given user "profileuser" exists
4+
And user "profileuser2" exists
5+
And user "profileuser3" exists
6+
And user "profileviewer" exists
7+
And user "directoryviewer" exists
8+
And run the command "profile_fields:developer:reset --all" with result code 0
9+
10+
Scenario: admins can use unified search without an explicit cursor and continue with a numeric cursor
11+
Given as user "admin"
12+
When sending "post" to ocs "/apps/profile_fields/api/v1/definitions"
13+
| fieldKey | unified_region_admin |
14+
| label | Unified Region Admin |
15+
| type | text |
16+
| adminOnly | false |
17+
| userEditable | false |
18+
| userVisible | true |
19+
| initialVisibility | private |
20+
| sortOrder | 10 |
21+
| active | true |
22+
Then the response should have a status code 201
23+
And fetch field "(UNIFIED_REGION_ADMIN_FIELD_ID)(jq).ocs.data.id" from previous JSON response
24+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser/values/<UNIFIED_REGION_ADMIN_FIELD_ID>"
25+
| value | LATAM - South |
26+
| currentVisibility | private |
27+
Then the response should have a status code 200
28+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser2/values/<UNIFIED_REGION_ADMIN_FIELD_ID>"
29+
| value | LATAM - North |
30+
| currentVisibility | private |
31+
Then the response should have a status code 200
32+
When sending "get" to ocs "/search/providers/profile_fields.directory/search?term=latam&limit=1&from=/settings/users"
33+
Then the response should have a status code 200
34+
And the response should be a JSON array with the following mandatory values
35+
| key | value |
36+
| (jq).ocs.data.name | Profile directory |
37+
| (jq).ocs.data.isPaginated | true |
38+
| (jq).ocs.data.cursor | 1 |
39+
| (jq).ocs.data.entries | (jq)length == 1 |
40+
| (jq).ocs.data.entries[0].title | profileuser-displayname |
41+
| (jq).ocs.data.entries[0].subline | Unified Region Admin: LATAM - South |
42+
| (jq).ocs.data.entries[0].icon | icon-user |
43+
| (jq).ocs.data.entries[0].rounded | true |
44+
When sending "get" to ocs "/search/providers/profile_fields.directory/search?term=latam&limit=1&cursor=1&from=/settings/users"
45+
Then the response should have a status code 200
46+
And the response should be a JSON array with the following mandatory values
47+
| key | value |
48+
| (jq).ocs.data.name | Profile directory |
49+
| (jq).ocs.data.isPaginated | false |
50+
| (jq).ocs.data.cursor | null |
51+
| (jq).ocs.data.entries | (jq)length == 1 |
52+
| (jq).ocs.data.entries[0].title | profileuser2-displayname |
53+
| (jq).ocs.data.entries[0].subline | Unified Region Admin: LATAM - North |
54+
55+
Scenario: authenticated users can use unified search and it only returns exposed values
56+
Given as user "admin"
57+
When sending "post" to ocs "/apps/profile_fields/api/v1/definitions"
58+
| fieldKey | unified_region_visibility |
59+
| label | Unified Region Visibility |
60+
| type | text |
61+
| adminOnly | false |
62+
| userEditable | false |
63+
| userVisible | true |
64+
| initialVisibility | private |
65+
| sortOrder | 10 |
66+
| active | true |
67+
Then the response should have a status code 201
68+
And fetch field "(UNIFIED_REGION_VISIBILITY_FIELD_ID)(jq).ocs.data.id" from previous JSON response
69+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser/values/<UNIFIED_REGION_VISIBILITY_FIELD_ID>"
70+
| value | LATAM - Public |
71+
| currentVisibility | public |
72+
Then the response should have a status code 200
73+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser2/values/<UNIFIED_REGION_VISIBILITY_FIELD_ID>"
74+
| value | LATAM - Users |
75+
| currentVisibility | users |
76+
Then the response should have a status code 200
77+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser3/values/<UNIFIED_REGION_VISIBILITY_FIELD_ID>"
78+
| value | LATAM - Private |
79+
| currentVisibility | private |
80+
Then the response should have a status code 200
81+
Given as user "profileviewer"
82+
When sending "get" to ocs "/search/providers/profile_fields.directory/search?term=latam&from=/settings/users"
83+
Then the response should have a status code 200
84+
And the response should be a JSON array with the following mandatory values
85+
| key | value |
86+
| (jq).ocs.data.name | Profile directory |
87+
| (jq).ocs.data.isPaginated | false |
88+
| (jq).ocs.data.entries | (jq)length == 2 |
89+
| (jq).ocs.data.entries[0].title | profileuser-displayname |
90+
| (jq).ocs.data.entries[0].subline | Unified Region Visibility: LATAM - Public |
91+
| (jq).ocs.data.entries[1].title | profileuser2-displayname |
92+
| (jq).ocs.data.entries[1].subline | Unified Region Visibility: LATAM - Users |
93+
94+
Scenario: hidden fields and private values are only searchable by admins
95+
Given as user "admin"
96+
When sending "post" to ocs "/apps/profile_fields/api/v1/definitions"
97+
| fieldKey | unified_region_hidden |
98+
| label | Unified Region Hidden |
99+
| type | text |
100+
| adminOnly | false |
101+
| userEditable | false |
102+
| userVisible | false |
103+
| initialVisibility | public |
104+
| sortOrder | 10 |
105+
| active | true |
106+
Then the response should have a status code 201
107+
And fetch field "(UNIFIED_REGION_HIDDEN_FIELD_ID)(jq).ocs.data.id" from previous JSON response
108+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileuser/values/<UNIFIED_REGION_HIDDEN_FIELD_ID>"
109+
| value | LATAM - Hidden |
110+
| currentVisibility | public |
111+
Then the response should have a status code 200
112+
When sending "post" to ocs "/apps/profile_fields/api/v1/definitions"
113+
| fieldKey | unified_region_private |
114+
| label | Unified Region Private |
115+
| type | text |
116+
| adminOnly | false |
117+
| userEditable | false |
118+
| userVisible | true |
119+
| initialVisibility | private |
120+
| sortOrder | 20 |
121+
| active | true |
122+
Then the response should have a status code 201
123+
And fetch field "(UNIFIED_REGION_PRIVATE_FIELD_ID)(jq).ocs.data.id" from previous JSON response
124+
When sending "put" to ocs "/apps/profile_fields/api/v1/users/profileviewer/values/<UNIFIED_REGION_PRIVATE_FIELD_ID>"
125+
| value | LATAM - Private |
126+
| currentVisibility | private |
127+
Then the response should have a status code 200
128+
Given as user "profileviewer"
129+
When sending "get" to ocs "/search/providers/profile_fields.directory/search?term=latam&from=/settings/users"
130+
Then the response should have a status code 200
131+
And the response should be a JSON array with the following mandatory values
132+
| key | value |
133+
| (jq).ocs.data.name | Profile directory |
134+
| (jq).ocs.data.isPaginated | false |
135+
| (jq).ocs.data.entries | (jq)length == 0 |
136+
Given as user "admin"
137+
When sending "get" to ocs "/search/providers/profile_fields.directory/search?term=latam&from=/settings/users"
138+
Then the response should have a status code 200
139+
And the response should be a JSON array with the following mandatory values
140+
| key | value |
141+
| (jq).ocs.data.name | Profile directory |
142+
| (jq).ocs.data.isPaginated | false |
143+
| (jq).ocs.data.entries | (jq)length == 2 |
144+
| (jq).ocs.data.entries[0].title | profileuser-displayname |
145+
| (jq).ocs.data.entries[0].subline | Unified Region Hidden: LATAM - Hidden |
146+
| (jq).ocs.data.entries[1].title | profileviewer-displayname |
147+
| (jq).ocs.data.entries[1].subline | Unified Region Private: LATAM - Private |

0 commit comments

Comments
 (0)