|
| 1 | +import { test } from '../../support/test' |
| 2 | +import * as api from '../../steps/api/api' |
| 3 | +import * as ui from '../../steps/ui/index' |
| 4 | + |
| 5 | +test.describe('Users can use web to organize tags', () => { |
| 6 | + test.beforeEach(async ({ world }) => { |
| 7 | + // Given "Admin" creates following users using API |
| 8 | + // | id | |
| 9 | + // | Alice | |
| 10 | + // | Brian | |
| 11 | + await api.usersHaveBeenCreated({ |
| 12 | + world, |
| 13 | + stepUser: 'Admin', |
| 14 | + users: ['Alice', 'Brian'] |
| 15 | + }) |
| 16 | + |
| 17 | + // Given "Alice" logs in |
| 18 | + await ui.userLogsIn({ world, stepUser: 'Alice' }) |
| 19 | + }) |
| 20 | + |
| 21 | + test('Tag management', { tag: '@predefined-users' }, async ({ world }) => { |
| 22 | + // When "Alice" creates the following files into personal space using API |
| 23 | + // | pathToFile | content | |
| 24 | + // | lorem.txt | lorem ipsum | |
| 25 | + await api.userHasCreatedFiles({ |
| 26 | + world, |
| 27 | + stepUser: 'Alice', |
| 28 | + files: [{ pathToFile: 'lorem.txt', content: 'lorem ipsum' }] |
| 29 | + }) |
| 30 | + // And "Alice" adds the following tags for the following resources using the sidebar panel |
| 31 | + // | resource | tags | |
| 32 | + // | lorem.txt | tag 1, tag 2 | |
| 33 | + await ui.userAddsFollowingTagsForResourcesUsingSidebarPanel({ |
| 34 | + world, |
| 35 | + stepUser: 'Alice', |
| 36 | + resources: [{ name: 'lorem.txt', tags: ['tag 1', 'tag 2'] }] |
| 37 | + }) |
| 38 | + // Then the following resources should contain the following tags in the files list for user "Alice" |
| 39 | + // | resource | tags | |
| 40 | + // | lorem.txt | tag 1, tag 2 | |
| 41 | + await ui.resourceShouldContainTagsInFileList({ |
| 42 | + world, |
| 43 | + stepUser: 'Alice', |
| 44 | + resources: [{ name: 'lorem.txt', tags: ['tag 1', 'tag 2'] }] |
| 45 | + }) |
| 46 | + // Then the following resources should contain the following tags in the details panel for user "Alice" |
| 47 | + // | resource | tags | |
| 48 | + // | lorem.txt | tag 1, tag 2 | |
| 49 | + await ui.resourceShouldContainTagsInDetailPanel({ |
| 50 | + world, |
| 51 | + stepUser: 'Alice', |
| 52 | + resources: [{ name: 'lorem.txt', tags: ['tag 1', 'tag 2'] }] |
| 53 | + }) |
| 54 | + // When "Alice" removes the following tags for the following resources using the sidebar panel |
| 55 | + // | resource | tags | |
| 56 | + // | lorem.txt | tag 1 | |
| 57 | + await ui.userRemovesTagsFromResourcesUsingSideBar({ |
| 58 | + world, |
| 59 | + stepUser: 'Alice', |
| 60 | + resources: [{ name: 'lorem.txt', tags: ['tag 1'] }] |
| 61 | + }) |
| 62 | + // Then the following resources should contain the following tags in the files list for user "Alice" |
| 63 | + // | resource | tags | |
| 64 | + // | lorem.txt | tag 2 | |
| 65 | + await ui.resourceShouldContainTagsInFileList({ |
| 66 | + world, |
| 67 | + stepUser: 'Alice', |
| 68 | + resources: [{ name: 'lorem.txt', tags: ['tag 2'] }] |
| 69 | + }) |
| 70 | + // Then the following resources should contain the following tags in the details panel for user "Alice" |
| 71 | + // | resource | tags | |
| 72 | + // | lorem.txt | tag 2 | |
| 73 | + await ui.resourceShouldContainTagsInDetailPanel({ |
| 74 | + world, |
| 75 | + stepUser: 'Alice', |
| 76 | + resources: [{ name: 'lorem.txt', tags: ['tag 2'] }] |
| 77 | + }) |
| 78 | + // And "Alice" logs out |
| 79 | + await ui.userLogsOut({ world, stepUser: 'Alice' }) |
| 80 | + }) |
| 81 | + |
| 82 | + test('Long tag name', async ({ world }) => { |
| 83 | + // And "Alice" creates the following files into personal space using API |
| 84 | + // | pathToFile | content | |
| 85 | + // | lorem.txt | lorem ipsum | |
| 86 | + await api.userHasCreatedFiles({ |
| 87 | + world, |
| 88 | + stepUser: 'Alice', |
| 89 | + files: [{ pathToFile: 'lorem.txt', content: 'lorem ipsum' }] |
| 90 | + }) |
| 91 | + // When "Alice" tries to add the following tag for the following resources using the sidebar panel |
| 92 | + // | resource | tags | |
| 93 | + // | lorem.txt | Loremipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore | |
| 94 | + await ui.userTriesToAddTagForResourceUsingSidebarPanel({ |
| 95 | + world, |
| 96 | + stepUser: 'Alice', |
| 97 | + resources: [ |
| 98 | + { |
| 99 | + name: 'lorem.txt', |
| 100 | + tags: [ |
| 101 | + 'Loremipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore' |
| 102 | + ] |
| 103 | + } |
| 104 | + ] |
| 105 | + }) |
| 106 | + // Then "Alice" should see the following tag validation message: |
| 107 | + // """ |
| 108 | + // Tags must not be longer than 100 characters |
| 109 | + // """ |
| 110 | + await ui.userShouldSeeFollowingTagValidationMessages({ |
| 111 | + world, |
| 112 | + stepUser: 'Alice', |
| 113 | + message: 'Tags must not be longer than 100 characters' |
| 114 | + }) |
| 115 | + // And "Alice" logs out |
| 116 | + await ui.userLogsOut({ world, stepUser: 'Alice' }) |
| 117 | + }) |
| 118 | + |
| 119 | + test('Tag search', { tag: '@predefined-users' }, async ({ world }) => { |
| 120 | + // When "Alice" creates the following files into personal space using API |
| 121 | + // | pathToFile | content | |
| 122 | + // | lorem.txt | lorem ipsum | |
| 123 | + // | textfile.txt | test file | |
| 124 | + await api.userHasCreatedFiles({ |
| 125 | + world, |
| 126 | + stepUser: 'Alice', |
| 127 | + files: [ |
| 128 | + { pathToFile: 'lorem.txt', content: 'lorem ipsum' }, |
| 129 | + { pathToFile: 'textfile.txt', content: 'test file' } |
| 130 | + ] |
| 131 | + }) |
| 132 | + // And "Alice" adds the following tags for the following resources using the sidebar panel |
| 133 | + // | resource | tags | |
| 134 | + // | lorem.txt | tag1, tag2 | |
| 135 | + await ui.userAddsFollowingTagsForResourcesUsingSidebarPanel({ |
| 136 | + world, |
| 137 | + stepUser: 'Alice', |
| 138 | + resources: [{ name: 'lorem.txt', tags: ['tag1', 'tag2'] }] |
| 139 | + }) |
| 140 | + // And "Alice" clicks the tag "tag1" on the resource "lorem.txt" |
| 141 | + await ui.userClicksTheTagOnResource({ |
| 142 | + world, |
| 143 | + stepUser: 'Alice', |
| 144 | + resourceName: 'lorem.txt', |
| 145 | + tagName: 'tag1' |
| 146 | + }) |
| 147 | + // Then the following resources should contain the following tags in the files list for user "Alice" |
| 148 | + // | resource | tags | |
| 149 | + // | lorem.txt | tag1 | |
| 150 | + await ui.resourceShouldContainTagsInFileList({ |
| 151 | + world, |
| 152 | + stepUser: 'Alice', |
| 153 | + resources: [{ name: 'lorem.txt', tags: ['tag1'] }] |
| 154 | + }) |
| 155 | + // Then following resources should not be displayed in the files list for user "Alice" |
| 156 | + // | resource | |
| 157 | + // | textfile.txt | |
| 158 | + await ui.userShouldNotSeeTheResources({ |
| 159 | + world, |
| 160 | + listType: 'files list', |
| 161 | + stepUser: 'Alice', |
| 162 | + resources: ['textfile.txt'] |
| 163 | + }) |
| 164 | + // And "Alice" logs out |
| 165 | + await ui.userLogsOut({ world, stepUser: 'Alice' }) |
| 166 | + }) |
| 167 | + |
| 168 | + test('Tags in shared resources', { tag: '@predefined-users' }, async ({ world }) => { |
| 169 | + // And "Brian" logs in |
| 170 | + await ui.userLogsIn({ world, stepUser: 'Brian' }) |
| 171 | + // And "Alice" creates the following folders in personal space using API |
| 172 | + // | name | |
| 173 | + // | folder_to_shared | |
| 174 | + await api.userHasCreatedFolders({ |
| 175 | + world, |
| 176 | + stepUser: 'Alice', |
| 177 | + folderNames: ['folder_to_shared'] |
| 178 | + }) |
| 179 | + // And "Alice" creates the following files into personal space using API |
| 180 | + // | pathToFile | content | |
| 181 | + // | folder_to_shared/lorem.txt | lorem ipsum | |
| 182 | + await api.userHasCreatedFiles({ |
| 183 | + world, |
| 184 | + stepUser: 'Alice', |
| 185 | + files: [{ pathToFile: 'folder_to_shared/lorem.txt', content: 'lorem ipsum' }] |
| 186 | + }) |
| 187 | + // And "Alice" adds the following tags for the following resources using the sidebar panel |
| 188 | + // | resource | tags | |
| 189 | + // | folder_to_shared/lorem.txt | tag 1, tag 2 | |
| 190 | + await ui.userAddsFollowingTagsForResourcesUsingSidebarPanel({ |
| 191 | + world, |
| 192 | + stepUser: 'Alice', |
| 193 | + resources: [{ name: 'folder_to_shared/lorem.txt', tags: ['tag 1', 'tag 2'] }] |
| 194 | + }) |
| 195 | + // When "Alice" shares the following resource using the sidebar panel |
| 196 | + // | resource | recipient | type | role | resourceType | |
| 197 | + // | folder_to_shared | Brian | user | Can edit with trashbin | folder | |
| 198 | + await ui.userSharesResources({ |
| 199 | + world, |
| 200 | + stepUser: 'Alice', |
| 201 | + actionType: 'SIDEBAR_PANEL', |
| 202 | + shares: [ |
| 203 | + { |
| 204 | + resource: 'folder_to_shared', |
| 205 | + recipient: 'Brian', |
| 206 | + type: 'user', |
| 207 | + role: 'Can edit with trashbin', |
| 208 | + resourceType: 'folder' |
| 209 | + } |
| 210 | + ] |
| 211 | + }) |
| 212 | + // And "Alice" logs out |
| 213 | + await ui.userLogsOut({ world, stepUser: 'Alice' }) |
| 214 | + // And "Brian" navigates to the shared with me page |
| 215 | + await ui.userNavigatesToSharedWithMePage({ |
| 216 | + world, |
| 217 | + stepUser: 'Brian' |
| 218 | + }) |
| 219 | + // Then the following resources should contain the following tags in the files list for user "Brian" |
| 220 | + // | resource | tags | |
| 221 | + // | folder_to_shared/lorem.txt | tag 1, tag 2 | |
| 222 | + await ui.resourceShouldContainTagsInFileList({ |
| 223 | + world, |
| 224 | + stepUser: 'Brian', |
| 225 | + resources: [{ name: 'folder_to_shared/lorem.txt', tags: ['tag 1', 'tag 2'] }] |
| 226 | + }) |
| 227 | + // And "Brian" logs out |
| 228 | + await ui.userLogsOut({ world, stepUser: 'Brian' }) |
| 229 | + }) |
| 230 | +}) |
0 commit comments