Skip to content

Commit 9854dc7

Browse files
authored
[full-ci][tests-only] Rewrite link feature into playwrightonly (#13609)
* tests: rewrite link feature into playwrightonly Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * tests: add accessibility testing Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * tests: add copy and move acessibility test Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * refactor methods Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * migrate the methods Signed-off-by: nabim777 <nabinalemagar019@gmail.com> --------- Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
1 parent 1378dca commit 9854dc7

10 files changed

Lines changed: 621 additions & 125 deletions

File tree

tests/e2e-playwright/specs/app-provider/lock.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ test.describe('lock', { tag: '@sse' }, () => {
4242
// When "Alice" creates the following resources
4343
// | resource | type | content |
4444
// | test.odt | OpenDocument | some content |
45-
await api.userHasCreatedFiles({
46-
usersEnvironment,
45+
await ui.userCreatesResources({
46+
actorsEnvironment,
4747
stepUser: 'Alice',
48-
files: [{ pathToFile: 'test.odt', content: 'some content' }]
48+
resources: [{ name: 'test.odt', type: 'OpenDocument', content: 'some content' }]
4949
})
5050
// And "Alice" shares the following resource using API
5151
// | resource | recipient | type | role | resourceType |
Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,324 @@
1+
import { test } from '../../support/test'
2+
import { config } from '../../../e2e/config.js'
3+
import {
4+
ActorsEnvironment,
5+
UsersEnvironment,
6+
FilesEnvironment,
7+
LinksEnvironment
8+
} from '../../../e2e/support/environment'
9+
import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken'
10+
import * as api from '../../steps/api/api'
11+
import * as ui from '../../steps/ui/index'
12+
13+
test.describe('link', () => {
14+
let actorsEnvironment
15+
const usersEnvironment = new UsersEnvironment()
16+
const filesEnvironment = new FilesEnvironment()
17+
const linksEnvironment = new LinksEnvironment()
18+
19+
test.beforeEach(async ({ browser }) => {
20+
actorsEnvironment = new ActorsEnvironment({
21+
context: {
22+
acceptDownloads: config.acceptDownloads,
23+
reportDir: config.reportDir,
24+
tracingReportDir: config.tracingReportDir,
25+
reportHar: config.reportHar,
26+
reportTracing: config.reportTracing,
27+
reportVideo: config.reportVideo,
28+
failOnUncaughtConsoleError: config.failOnUncaughtConsoleError
29+
},
30+
browser: browser
31+
})
32+
33+
await setAccessAndRefreshToken(usersEnvironment)
34+
35+
// Given "Admin" creates following users using API
36+
// | id |
37+
// | Alice |
38+
await api.usersHasBeenCreated({
39+
usersEnvironment,
40+
stepUser: 'Admin',
41+
users: ['Alice']
42+
})
43+
})
44+
45+
test('public link', { tag: '@predefined-users' }, async () => {
46+
// Given "Admin" creates following users using API
47+
// | id |
48+
// | Brian |
49+
await api.usersHasBeenCreated({
50+
usersEnvironment,
51+
stepUser: 'Admin',
52+
users: ['Brian']
53+
})
54+
55+
// And "Alice" creates the following folders in personal space using API
56+
// | name |
57+
// | folderPublic |
58+
// | folderPublic/SubFolder |
59+
await api.userHasCreatedFolders({
60+
usersEnvironment,
61+
stepUser: 'Alice',
62+
folderNames: ['folderPublic', 'folderPublic/SubFolder']
63+
})
64+
// And "Alice" creates the following files into personal space using API
65+
// | pathToFile | content |
66+
// | folderPublic/lorem.txt | lorem ipsum |
67+
await api.userHasCreatedFiles({
68+
usersEnvironment,
69+
stepUser: 'Alice',
70+
files: [{ pathToFile: 'folderPublic/lorem.txt', content: 'lorem ipsum' }]
71+
})
72+
73+
// When "Alice" logs in
74+
await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' })
75+
// And "Alice" creates a public link of following resource using the sidebar panel
76+
// | resource | role | password |
77+
// | folderPublic | Secret File Drop | %public% |
78+
await ui.createPublicLink({
79+
actorsEnvironment,
80+
stepUser: 'Alice',
81+
resource: 'folderPublic',
82+
role: 'Secret File Drop',
83+
password: '%public%'
84+
})
85+
// And "Alice" renames the most recently created public link of resource "folderPublic" to "myPublicLink"
86+
await ui.userRenamesMostRecentlyCreatedPublicLinkOfResource({
87+
actorsEnvironment,
88+
stepUser: 'Alice',
89+
resource: 'folderPublic',
90+
newName: 'myPublicLink'
91+
})
92+
// And "Alice" edits the public link named "myPublicLink" of resource "folderPublic" changing role to "Secret File Drop"
93+
await ui.userChangesRoleOfThePublicLinkOfResource({
94+
actorsEnvironment,
95+
stepUser: 'Alice',
96+
resource: 'folderPublic',
97+
linkName: 'myPublicLink',
98+
newRole: 'Secret File Drop'
99+
})
100+
// And "Alice" sets the expiration date of the public link named "myPublicLink" of resource "folderPublic" to "+5 days"
101+
await ui.userSetsExpirationDateOfThePublicLinkOfResource({
102+
actorsEnvironment,
103+
stepUser: 'Alice',
104+
resource: 'folderPublic',
105+
linkName: 'myPublicLink',
106+
expireDate: '+5 days'
107+
})
108+
// When "Anonymous" opens the public link "myPublicLink"
109+
await ui.userOpensPublicLink({
110+
actorsEnvironment,
111+
linksEnvironment,
112+
stepUser: 'Anonymous',
113+
name: 'myPublicLink'
114+
})
115+
// And "Anonymous" unlocks the public link with password "%public%"
116+
await ui.userUnlocksPublicLink({
117+
actorsEnvironment,
118+
password: '%public%',
119+
stepUser: 'Anonymous'
120+
})
121+
// And "Anonymous" drop uploads following resources
122+
// | resource |
123+
// | textfile.txt |
124+
await ui.userDropUploadsResources({
125+
actorsEnvironment,
126+
filesEnvironment,
127+
stepUser: 'Anonymous',
128+
resources: ['textfile.txt']
129+
})
130+
131+
// authenticated user
132+
// When "Brian" logs in
133+
await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Brian' })
134+
// And "Brian" opens the public link "myPublicLink"
135+
await ui.userOpensPublicLink({
136+
actorsEnvironment,
137+
linksEnvironment,
138+
stepUser: 'Brian',
139+
name: 'myPublicLink'
140+
})
141+
// And "Brian" unlocks the public link with password "%public%"
142+
await ui.userUnlocksPublicLink({
143+
actorsEnvironment,
144+
password: '%public%',
145+
stepUser: 'Brian'
146+
})
147+
// And "Brian" drop uploads following resources
148+
// | resource |
149+
// | simple.pdf |
150+
await ui.userDropUploadsResources({
151+
actorsEnvironment,
152+
filesEnvironment,
153+
stepUser: 'Brian',
154+
resources: ['simple.pdf']
155+
})
156+
157+
// When "Alice" opens folder "folderPublic"
158+
await ui.userOpensResources({
159+
actorsEnvironment,
160+
stepUser: 'Alice',
161+
resource: 'folderPublic'
162+
})
163+
// Then following resources should be displayed in the files list for user "Alice"
164+
// | resource |
165+
// | textfile.txt |
166+
// | simple.pdf |
167+
await ui.userShouldSeeTheResources({
168+
actorsEnvironment,
169+
listType: 'files list',
170+
stepUser: 'Alice',
171+
resources: ['textfile.txt', 'simple.pdf']
172+
})
173+
// And "Alice" opens the "files" app
174+
await ui.userOpensApplication({
175+
actorsEnvironment,
176+
stepUser: 'Alice',
177+
name: 'files'
178+
})
179+
// And "Alice" edits the public link named "myPublicLink" of resource "folderPublic" changing role to "Can edit"
180+
await ui.userChangesRoleOfThePublicLinkOfResource({
181+
actorsEnvironment,
182+
stepUser: 'Alice',
183+
resource: 'folderPublic',
184+
linkName: 'myPublicLink',
185+
newRole: 'Can edit'
186+
})
187+
// And "Brian" refreshes the old link
188+
await ui.userRefreshesTheOldLink({ actorsEnvironment, stepUser: 'Brian' })
189+
190+
// Then following resources should be displayed in the files list for user "Brian"
191+
// | resource |
192+
// | textfile.txt |
193+
// | simple.pdf |
194+
// | SubFolder |
195+
// | lorem.txt |
196+
await ui.userShouldSeeTheResources({
197+
actorsEnvironment,
198+
listType: 'files list',
199+
stepUser: 'Brian',
200+
resources: ['textfile.txt', 'simple.pdf', 'SubFolder', 'lorem.txt']
201+
})
202+
// And "Brian" deletes the following resources from public link using sidebar panel
203+
// | resource |
204+
// | simple.pdf |
205+
await ui.userDeletesResourcesFromPublicLink({
206+
actorsEnvironment,
207+
stepUser: 'Brian',
208+
actionType: 'SIDEBAR_PANEL',
209+
resources: [{ resource: 'simple.pdf' }]
210+
})
211+
// And "Brian" logs out
212+
await ui.logOutUser({ actorsEnvironment, stepUser: 'Brian' })
213+
214+
// And "Anonymous" refreshes the old link
215+
await ui.userRefreshesTheOldLink({ actorsEnvironment, stepUser: 'Anonymous' })
216+
// And "Anonymous" downloads the following public link resources using the sidebar panel
217+
// | resource | type |
218+
// | lorem.txt | file |
219+
// | textfile.txt | file |
220+
await ui.userDownloadsThePublicLinkResources({
221+
actorsEnvironment,
222+
stepUser: 'Anonymous',
223+
actionType: 'SIDEBAR_PANEL',
224+
resources: [
225+
{ resource: 'lorem.txt', type: 'file' },
226+
{ resource: 'textfile.txt', type: 'file' }
227+
]
228+
})
229+
// And "Anonymous" uploads the following resources in public link page
230+
// | resource | option |
231+
// | new-lorem.txt | |
232+
// | lorem.txt | replace |
233+
await ui.userUploadsResourcesInPublicLink({
234+
actorsEnvironment,
235+
filesEnvironment,
236+
stepUser: 'Anonymous',
237+
resources: [{ name: 'new-lorem.txt' }, { name: 'lorem.txt', option: 'replace' }]
238+
})
239+
// And "Anonymous" creates the following resources
240+
// | resource | type |
241+
// | myfolder/child | folder |
242+
await ui.userCreatesResources({
243+
actorsEnvironment,
244+
stepUser: 'Anonymous',
245+
resources: [{ name: 'myfolder/child', type: 'folder' }]
246+
})
247+
248+
// And "Anonymous" uploads the following resources in public link page
249+
// | resource | type |
250+
// | PARENT | folder |
251+
await ui.userUploadsResourcesInPublicLink({
252+
actorsEnvironment,
253+
filesEnvironment,
254+
stepUser: 'Anonymous',
255+
resources: [{ name: 'PARENT', type: 'folder' }]
256+
})
257+
// And "Anonymous" should see the resource "PARENT" in the files list
258+
await ui.userShouldSeeTheResources({
259+
actorsEnvironment,
260+
listType: 'files list',
261+
stepUser: 'Anonymous',
262+
resources: ['PARENT']
263+
})
264+
// And "Anonymous" moves the following resource using drag-drop
265+
// | resource | to |
266+
// | new-lorem.txt | SubFolder |
267+
await ui.userMovesResource({
268+
actorsEnvironment,
269+
stepUser: 'Anonymous',
270+
actionType: 'drag-drop',
271+
resources: [{ resource: 'new-lorem.txt', to: 'SubFolder' }]
272+
})
273+
// And "Anonymous" copies the following resource using sidebar-panel
274+
// | resource | to |
275+
// | lorem.txt | myfolder |
276+
await ui.userCopiesResource({
277+
actorsEnvironment,
278+
stepUser: 'Anonymous',
279+
actionType: 'sidebar-panel',
280+
resources: [{ resource: 'lorem.txt', to: 'myfolder' }]
281+
})
282+
// And "Anonymous" renames the following public link resources
283+
// | resource | as |
284+
// | lorem.txt | lorem_new.txt |
285+
// | textfile.txt | textfile_new.txt |
286+
await ui.userRenamesPublicLinkResources({
287+
actorsEnvironment,
288+
stepUser: 'Anonymous',
289+
resources: [
290+
{ resource: 'lorem.txt', newName: 'lorem_new.txt' },
291+
{ resource: 'textfile.txt', newName: 'textfile_new.txt' }
292+
]
293+
})
294+
// And "Anonymous" deletes the following resources from public link using batch action
295+
// | resource | from |
296+
// | lorem.txt | myfolder |
297+
// | child | myfolder |
298+
await ui.userDeletesResourcesFromPublicLink({
299+
actorsEnvironment,
300+
stepUser: 'Anonymous',
301+
actionType: 'BATCH_ACTION',
302+
resources: [
303+
{ resource: 'lorem.txt', parentFolder: 'myfolder' },
304+
{ resource: 'child', parentFolder: 'myfolder' }
305+
]
306+
})
307+
// And "Alice" removes the public link named "myPublicLink" of resource "folderPublic"
308+
await ui.userRemovesThePublicLinkOfResource({
309+
actorsEnvironment,
310+
stepUser: 'Alice',
311+
resource: 'folderPublic',
312+
linkName: 'myPublicLink'
313+
})
314+
// And "Anonymous" should not be able to open the old link "myPublicLink"
315+
await ui.userShouldNotBeAbleToOpenTheOldLink({
316+
actorsEnvironment,
317+
linksEnvironment,
318+
stepUser: 'Anonymous',
319+
linkName: 'myPublicLink'
320+
})
321+
// And "Alice" logs out
322+
await ui.logOutUser({ actorsEnvironment, stepUser: 'Alice' })
323+
})
324+
})

tests/e2e-playwright/specs/spaces/participantManagement.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,21 @@ test.describe('check files pagination in project space', () => {
232232
// And "Anonymous" uploads the following resources in public link page
233233
// | resource |
234234
// | textfile.txt |
235-
await ui.uploadResourceInPublicLink({
235+
await ui.userUploadsResourcesInPublicLink({
236236
actorsEnvironment,
237237
filesEnvironment,
238238
stepUser: 'Anonymous',
239-
resource: 'textfile.txt'
239+
resources: [{ name: 'textfile.txt' }]
240240
})
241241

242242
// And "Anonymous" deletes the following resources from public link using sidebar panel
243243
// | resource | from |
244244
// | lorem.txt | |
245-
await ui.deleteResourceFromPublicLink({
245+
await ui.userDeletesResourcesFromPublicLink({
246246
actorsEnvironment,
247247
stepUser: 'Anonymous',
248-
file: 'lorem.txt',
249-
actionType: 'sidebar panel'
248+
actionType: 'SIDEBAR_PANEL',
249+
resources: [{ resource: 'lorem.txt' }]
250250
})
251251

252252
// When "Brian" deletes the following resources using the sidebar panel

0 commit comments

Comments
 (0)