-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Labels
Description
Description
Currently, while rewriting the gherkin tests to playwright. And for the steps like below:
And "Alice" shares the following resource using API
| resource | recipient | type | role | resourceType |
| folderPublic | Brian | user | Can edit with versions and trashbin | folder |
| emptyFolder | Brian | user | Can edit with versions and trashbin | folder |
| testavatar.jpg | Brian | user | Can edit with versions and trashbin | file |We are calling the function userHasSharedResource multiple times, depending on the number of resources listed in data table as:
await api.userHasSharedResource({
usersEnvironment,
stepUser: 'Alice',
resource: 'folderPublic',
recipient: 'Brian',
type: 'user',
role: 'Can edit with versions and trashbin',
resourceType: 'folder'
})
await api.userHasSharedResource({
usersEnvironment,
stepUser: 'Alice',
resource: 'emptyFolder',
recipient: 'Brian',
type: 'user',
role: 'Can edit with versions and trashbin',
resourceType: 'folder'
})
await api.userHasSharedResource({
usersEnvironment,
stepUser: 'Alice',
resource: 'testavatar.jpg',
recipient: 'Brian',
type: 'user',
role: 'Can edit with versions and trashbin',
resourceType: 'file'
})Instead of this we can pass the data in array of objects as:
await api.userHasSharedResource({
usersEnvironment,
stepUser: 'Alice',
resources: [
{ name: 'folderPublic', recipient: 'Brian', type: 'user', role: 'Can edit with versions and trashbin', resourceType: 'folder' },
{ name: 'emptyFolder', recipient: 'Brian', type: 'user', role: 'Can edit with versions and trashbin', resourceType: 'folder' },
{ name: 'testavatar.jpg', recipient: 'Brian', type: 'user', role: 'Can edit with versions and trashbin', resourceType: 'file' }
]
})This will make our test codes shorter and more readable.
There are other steps as well where we call the functions multiple times, and those codes also need to be refactored.
Reactions are currently unavailable