55
66import type { User } from '@nextcloud/e2e-test-server/cypress'
77
8+ import { randomString } from '../../support/utils/randomString.ts'
89import { clickOnBreadcrumbs , closeSidebar , copyFile , moveFile , navigateToFolder } from '../files/FilesUtils.ts'
910import { assertVersionContent , nameVersion , openVersionsPanel , setupTestSharedFileFromUser , uploadThreeVersions } from './filesVersionsUtils.ts'
1011
11- /**
12- *
13- * @param filePath
14- */
15- function assertVersionsContent ( filePath : string ) {
16- const path = filePath . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' )
17-
18- clickOnBreadcrumbs ( 'All files' )
19-
20- if ( path !== '' ) {
21- navigateToFolder ( path )
22- }
23-
24- openVersionsPanel ( filePath )
25-
26- cy . get ( '[data-files-versions-version]' ) . should ( 'have.length' , 3 )
27- assertVersionContent ( 0 , 'v3' )
28- assertVersionContent ( 1 , 'v2' )
29- assertVersionContent ( 2 , 'v1' )
30- }
31-
3212describe ( 'Versions cross share move and copy' , ( ) => {
3313 let randomSharedFolderName = ''
3414 let randomFileName = ''
@@ -37,7 +17,7 @@ describe('Versions cross share move and copy', () => {
3717 let bob : User
3818
3919 before ( ( ) => {
40- randomSharedFolderName = Math . random ( ) . toString ( 36 ) . replace ( / [ ^ a - z ] + / g , '' ) . substring ( 0 , 10 )
20+ randomSharedFolderName = randomString ( 10 )
4121
4222 cy . createRandomUser ( )
4323 . then ( ( user ) => {
@@ -49,7 +29,7 @@ describe('Versions cross share move and copy', () => {
4929 } )
5030
5131 beforeEach ( ( ) => {
52- randomFileName = Math . random ( ) . toString ( 36 ) . replace ( / [ ^ a - z ] + / g , '' ) . substring ( 0 , 10 ) + '.txt'
32+ randomFileName = randomString ( 10 ) + '.txt'
5333 randomFilePath = `${ randomSharedFolderName } /${ randomFileName } `
5434 uploadThreeVersions ( alice , randomFilePath )
5535
@@ -78,8 +58,8 @@ describe('Versions cross share move and copy', () => {
7858 let randomSubSubFolderName
7959
8060 beforeEach ( ( ) => {
81- randomSubFolderName = Math . random ( ) . toString ( 36 ) . replace ( / [ ^ a - z ] + / g , '' ) . substring ( 0 , 10 )
82- randomSubSubFolderName = Math . random ( ) . toString ( 36 ) . replace ( / [ ^ a - z ] + / g , '' ) . substring ( 0 , 10 )
61+ randomSubFolderName = randomString ( 10 )
62+ randomSubSubFolderName = randomString ( 10 )
8363 clickOnBreadcrumbs ( 'All files' )
8464 cy . mkdir ( bob , `/${ randomSharedFolderName } /${ randomSubFolderName } ` )
8565 cy . mkdir ( bob , `/${ randomSharedFolderName } /${ randomSubFolderName } /${ randomSubSubFolderName } ` )
@@ -101,3 +81,23 @@ describe('Versions cross share move and copy', () => {
10181 } )
10282 } )
10383} )
84+
85+ /**
86+ * @param filePath
87+ */
88+ function assertVersionsContent ( filePath : string ) {
89+ const path = filePath . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' )
90+
91+ clickOnBreadcrumbs ( 'All files' )
92+
93+ if ( path !== '' ) {
94+ navigateToFolder ( path )
95+ }
96+
97+ openVersionsPanel ( filePath )
98+
99+ cy . get ( '[data-files-versions-version]' ) . should ( 'have.length' , 3 )
100+ assertVersionContent ( 0 , 'v3' )
101+ assertVersionContent ( 1 , 'v2' )
102+ assertVersionContent ( 2 , 'v1' )
103+ }
0 commit comments