11import { test } from '../../support/test'
2- import { config } from '../../../e2e/config.js'
3- import {
4- ActorsEnvironment ,
5- UsersEnvironment ,
6- FilesEnvironment
7- } from '../../../e2e/support/environment/index.js'
8- import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken.js'
92import * as api from '../../steps/api/api.js'
103import * as ui from '../../steps/ui/index'
114
125test . describe ( 'Kindergarten can use web to organize a day' , { tag : '@predefined-users' } , ( ) => {
13- let actorsEnvironment
14- const usersEnvironment = new UsersEnvironment ( )
15- const filesEnvironment = new FilesEnvironment ( )
16-
17- test . beforeEach ( async ( { browser } ) => {
18- actorsEnvironment = new ActorsEnvironment ( {
19- context : {
20- acceptDownloads : config . acceptDownloads ,
21- reportDir : config . reportDir ,
22- tracingReportDir : config . tracingReportDir ,
23- reportHar : config . reportHar ,
24- reportTracing : config . reportTracing ,
25- reportVideo : config . reportVideo ,
26- failOnUncaughtConsoleError : config . failOnUncaughtConsoleError
27- } ,
28- browser : browser
29- } )
30-
31- await setAccessAndRefreshToken ( usersEnvironment )
32-
6+ test . beforeEach ( async ( { world } ) => {
337 // Given "Admin" creates following users using API
348 // | id |
359 // | Alice |
3610 // | Brian |
3711 // | Carol |
38- await api . usersHasBeenCreated ( {
39- usersEnvironment ,
12+ await api . usersHaveBeenCreated ( {
13+ world ,
4014 stepUser : 'Admin' ,
4115 users : [ 'Alice' , 'Brian' , 'Carol' ]
4216 } )
@@ -46,36 +20,35 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
4620 // | sales |
4721 // | security |
4822 await api . groupsHaveBeenCreated ( {
23+ world,
4924 groupIds : [ 'sales' , 'security' ] ,
50- admin : usersEnvironment . getUser ( { key : 'Admin' } )
25+ stepUser : 'Admin'
5126 } )
5227
5328 // And "Admin" adds user to the group using API
5429 // | user | group |
5530 // | Brian | sales |
56- await api . addUserToGroup ( {
57- usersEnvironment ,
31+ await api . usersHaveBeenAddedToGroup ( {
32+ world ,
5833 stepUser : 'Admin' ,
59- userToAdd : [ { user : 'Brian' , group : 'sales' } ]
34+ usersToAdd : [ { user : 'Brian' , group : 'sales' } ]
6035 } )
61-
62- await setAccessAndRefreshToken ( usersEnvironment )
6336 } )
6437
65- test ( 'Alice can share this weeks meal plan with all parents' , async ( ) => {
38+ test ( 'Alice can share this weeks meal plan with all parents' , async ( { world } ) => {
6639 // When "Alice" logs in
67- await ui . logInUser ( { usersEnvironment , actorsEnvironment , stepUser : 'Alice' } )
40+ await ui . userLogsIn ( { world , stepUser : 'Alice' } )
6841
6942 // And "Alice" navigates to the personal space page
70- await ui . navigateToPersonalSpacePage ( { actorsEnvironment , stepUser : 'Alice' } )
43+ await ui . userNavigatesToPersonalSpacePage ( { world , stepUser : 'Alice' } )
7144
7245 // And "Alice" creates the following resources
7346 // | resource | type |
7447 // | groups/Kindergarten Koalas/meal plan | folder |
7548 // | groups/Pre-Schools Pirates/meal plan | folder |
7649 // | groups/Teddy Bear Daycare/meal plan | folder |
7750 await ui . userCreatesResources ( {
78- actorsEnvironment ,
51+ world ,
7952 stepUser : 'Alice' ,
8053 resources : [
8154 { name : 'groups/Kindergarten Koalas/meal plan' , type : 'folder' } ,
@@ -95,9 +68,8 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
9568 // | data.zip | groups/Teddy Bear Daycare/meal plan |
9669 // | lorem.txt | groups/Teddy Bear Daycare/meal plan |
9770 // | lorem-big.txt | groups/Teddy Bear Daycare/meal plan |
98- await ui . uploadResource ( {
99- actorsEnvironment,
100- filesEnvironment,
71+ await ui . userUploadsResources ( {
72+ world,
10173 stepUser : 'Alice' ,
10274 resources : [
10375 { name : 'PARENT/parent.txt' , to : 'groups/Kindergarten Koalas/meal plan' } ,
@@ -127,8 +99,7 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
12799 // | groups/Teddy Bear Daycare/meal plan/data.zip | Brian | user | Can edit with trashbin | file |
128100 // | groups/Teddy Bear Daycare/meal plan/data.zip | Carol | user | Can edit with trashbin | file |
129101 await ui . userSharesResources ( {
130- actorsEnvironment,
131- usersEnvironment,
102+ world,
132103 actionType : 'SIDEBAR_PANEL' ,
133104 stepUser : 'Alice' ,
134105 shares : [
@@ -226,58 +197,52 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
226197 // | groups/Pre-Schools Pirates/meal plan/lorem-big.txt | sales | group | Can edit with trashbin | file |
227198 // | groups/Kindergarten Koalas/meal plan | sales | group | Can edit with trashbin | folder |
228199 // | groups/Teddy Bear Daycare/meal plan/data.zip | Carol | user | Can edit with trashbin | file |
229- await ui . updateShareeRole ( {
230- usersEnvironment,
231- actorsEnvironment,
232- stepUser : 'Alice' ,
233- resource : 'groups/Pre-Schools Pirates/meal plan' ,
234- recipient : 'Carol' ,
235- type : 'user' ,
236- role : 'Can view' ,
237- resourceType : 'folder'
238- } )
239- await ui . updateShareeRole ( {
240- usersEnvironment,
241- actorsEnvironment,
242- stepUser : 'Alice' ,
243- resource : 'groups/Pre-Schools Pirates/meal plan/lorem-big.txt' ,
244- recipient : 'sales' ,
245- type : 'group' ,
246- role : 'Can edit with trashbin' ,
247- resourceType : 'file'
248- } )
249- await ui . updateShareeRole ( {
250- usersEnvironment,
251- actorsEnvironment,
252- stepUser : 'Alice' ,
253- resource : 'groups/Kindergarten Koalas/meal plan' ,
254- recipient : 'sales' ,
255- type : 'group' ,
256- role : 'Can edit with trashbin' ,
257- resourceType : 'folder'
258- } )
259- await ui . updateShareeRole ( {
260- usersEnvironment,
261- actorsEnvironment,
200+ await ui . userUpdatesShareeRoles ( {
201+ world,
262202 stepUser : 'Alice' ,
263- resource : 'groups/Teddy Bear Daycare/meal plan/data.zip' ,
264- recipient : 'Carol' ,
265- type : 'user' ,
266- role : 'Can edit with trashbin' ,
267- resourceType : 'file'
203+ roleUpdates : [
204+ {
205+ resource : 'groups/Pre-Schools Pirates/meal plan' ,
206+ recipient : 'Carol' ,
207+ type : 'user' ,
208+ role : 'Can view' ,
209+ resourceType : 'folder'
210+ } ,
211+ {
212+ resource : 'groups/Pre-Schools Pirates/meal plan/lorem-big.txt' ,
213+ recipient : 'sales' ,
214+ type : 'group' ,
215+ role : 'Can edit with trashbin' ,
216+ resourceType : 'file'
217+ } ,
218+ {
219+ resource : 'groups/Kindergarten Koalas/meal plan' ,
220+ recipient : 'sales' ,
221+ type : 'group' ,
222+ role : 'Can edit with trashbin' ,
223+ resourceType : 'folder'
224+ } ,
225+ {
226+ resource : 'groups/Teddy Bear Daycare/meal plan/data.zip' ,
227+ recipient : 'Carol' ,
228+ type : 'user' ,
229+ role : 'Can edit with trashbin' ,
230+ resourceType : 'file'
231+ }
232+ ]
268233 } )
269234 // Then what do we check for to be confident that the above things done by Alice have worked?
270235 // When "Brian" logs in
271- await ui . logInUser ( { usersEnvironment , actorsEnvironment , stepUser : 'Brian' } )
236+ await ui . userLogsIn ( { world , stepUser : 'Brian' } )
272237
273238 // And "Brian" navigates to the shared with me page
274- await ui . navigateToSharedWithMePage ( { actorsEnvironment , stepUser : 'Brian' } )
239+ await ui . userNavigatesToSharedWithMePage ( { world , stepUser : 'Brian' } )
275240
276241 // And "Brian" downloads the following resources using the sidebar panel
277242 // | resource | from | type |
278243 // | data.zip | meal plan | file |
279- await ui . userDownloadsResource ( {
280- actorsEnvironment ,
244+ await ui . userDownloadsResources ( {
245+ world ,
281246 stepUser : 'Brian' ,
282247 resourceToDownload : [ { resource : 'data.zip' , from : 'meal plan' , type : 'file' } ] ,
283248 actionType : 'SIDEBAR_PANEL'
@@ -286,10 +251,10 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
286251 // Then what do we check for to be confident that the above things done by Brian have worked?
287252 // Then the downloaded zip should contain... ?
288253 // When "Carol" logs in
289- await ui . logInUser ( { usersEnvironment , actorsEnvironment , stepUser : 'Carol' } )
254+ await ui . userLogsIn ( { world , stepUser : 'Carol' } )
290255
291256 // And "Carol" navigates to the shared with me page
292- await ui . navigateToSharedWithMePage ( { actorsEnvironment , stepUser : 'Carol' } )
257+ await ui . userNavigatesToSharedWithMePage ( { world , stepUser : 'Carol' } )
293258 // And "Carol" downloads the following resources using the sidebar panel
294259 // | resource | from | type |
295260 // | data.zip | meal plan | file |
@@ -298,8 +263,8 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
298263 // | meal plan | | folder |
299264 // Then what do we check for to be confident that the above things done by Carol have worked?
300265 // Then the downloaded files should have content "abc..."
301- await ui . userDownloadsResource ( {
302- actorsEnvironment ,
266+ await ui . userDownloadsResources ( {
267+ world ,
303268 stepUser : 'Carol' ,
304269 resourceToDownload : [
305270 { resource : 'data.zip' , from : 'meal plan' , type : 'file' } ,
@@ -310,7 +275,7 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
310275 actionType : 'SIDEBAR_PANEL'
311276 } )
312277 // And "Carol" logs out
313- await ui . logOutUser ( { actorsEnvironment , stepUser : 'Carol' } )
278+ await ui . userLogsOut ( { world , stepUser : 'Carol' } )
314279
315280 // When "Brian" downloads the following resources using the sidebar panel
316281 // | resource | from | type |
@@ -319,8 +284,8 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
319284 // | meal plan | | folder |
320285 // Then what do we check for to be confident that the above things done by Brian have worked?
321286 // Then the downloaded files should have content "abc..."
322- await ui . userDownloadsResource ( {
323- actorsEnvironment ,
287+ await ui . userDownloadsResources ( {
288+ world ,
324289 stepUser : 'Brian' ,
325290 resourceToDownload : [
326291 { resource : 'lorem.txt' , from : 'meal plan' , type : 'file' } ,
@@ -331,7 +296,7 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
331296 } )
332297
333298 // And "Brian" logs out
334- await ui . logOutUser ( { actorsEnvironment , stepUser : 'Brian' } )
299+ await ui . userLogsOut ( { world , stepUser : 'Brian' } )
335300 // And "Alice" downloads the following resources using the sidebar panel
336301 // | resource | from | type |
337302 // | parent.txt | groups/Kindergarten Koalas/meal plan | file |
@@ -350,8 +315,8 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
350315 // | Pre-Schools Pirates | groups | folder |
351316 // | Teddy Bear Daycare | groups | folder |
352317 // | groups | | folder |
353- await ui . userDownloadsResource ( {
354- actorsEnvironment ,
318+ await ui . userDownloadsResources ( {
319+ world ,
355320 stepUser : 'Alice' ,
356321 resourceToDownload : [
357322 {
@@ -452,7 +417,7 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
452417 // # Then what do we check for to be confident that the above things done by Alice have worked?
453418 // # Then the downloaded files should have content "abc..."
454419 await ui . userDeletesResources ( {
455- actorsEnvironment ,
420+ world ,
456421 stepUser : 'Alice' ,
457422 actionType : 'SIDEBAR_PANEL' ,
458423 resources : [
@@ -470,6 +435,6 @@ test.describe('Kindergarten can use web to organize a day', { tag: '@predefined-
470435 ]
471436 } )
472437 // And "Alice" logs out
473- await ui . logOutUser ( { actorsEnvironment , stepUser : 'Alice' } )
438+ await ui . userLogsOut ( { world , stepUser : 'Alice' } )
474439 } )
475440} )
0 commit comments