44 */ 
55import  type  {  User  }  from  '@nextcloud/cypress' 
66import  {  createShare  }  from  './FilesSharingUtils.ts' 
7- import  {  closeSidebar ,  getRowForFile  }  from  '../files/FilesUtils.ts' 
7+ import  {  closeSidebar ,  enableGridMode ,   getActionButtonForFile ,   getRowForFile  }  from  '../files/FilesUtils.ts' 
88
9- describe ( 'files_sharing: Files inline  status action' ,  {  testIsolation : true  } ,  ( )  =>  { 
9+ describe ( 'files_sharing: Sharing  status action' ,  {  testIsolation : true  } ,  ( )  =>  { 
1010	/** 
1111	 * Regression test of https://github.com/nextcloud/server/issues/45723 
1212	 */ 
13- 	it ( 'No "shared" tag when user ID is purely numerical' ,  ( )  =>  { 
13+ 	it ( 'No "shared" tag when user ID is purely numerical but there are no shares ' ,  ( )  =>  { 
1414		const  user  =  { 
1515			language : 'en' , 
1616			password : 'test1234' , 
@@ -29,76 +29,99 @@ describe('files_sharing: Files inline status action', { testIsolation: true }, (
2929			. should ( 'not.exist' ) 
3030	} ) 
3131
32+ 	it ( 'Render quick option for sharing' ,  ( )  =>  { 
33+ 		cy . createRandomUser ( ) . then ( ( user )  =>  { 
34+ 			cy . mkdir ( user ,  '/folder' ) 
35+ 			cy . login ( user ) 
36+ 
37+ 			cy . visit ( '/apps/files' ) 
38+ 		} ) 
39+ 
40+ 		getRowForFile ( 'folder' ) 
41+ 			. should ( 'be.visible' ) 
42+ 			. find ( '[data-cy-files-list-row-actions]' ) 
43+ 			. findByRole ( 'button' ,  {  name : / S h o w   s h a r i n g   o p t i o n s / } ) 
44+ 			. should ( 'be.visible' ) 
45+ 			. click ( ) 
46+ 
47+ 		// check the click opened the sidebar 
48+ 		cy . get ( '[data-cy-sidebar]' ) 
49+ 			. should ( 'be.visible' ) 
50+ 			// and ensure the sharing tab is selected 
51+ 			. findByRole ( 'tab' ,  {  name : 'Sharing' ,  selected : true  } ) 
52+ 			. should ( 'exist' ) 
53+ 	} ) 
54+ 
3255	describe ( 'Sharing inline status action handling' ,  ( )  =>  { 
3356		let  user : User 
3457		let  sharee : User 
3558
36- 		beforeEach ( ( )  =>  { 
59+ 		before ( ( )  =>  { 
3760			cy . createRandomUser ( ) . then ( ( $user )  =>  { 
38- 				user  =  $user 
61+ 				sharee  =  $user 
3962			} ) 
4063			cy . createRandomUser ( ) . then ( ( $user )  =>  { 
41- 				sharee  =  $user 
64+ 				user  =  $user 
65+ 				cy . mkdir ( user ,  '/folder' ) 
66+ 				cy . login ( user ) 
67+ 
68+ 				cy . visit ( '/apps/files' ) 
69+ 				getRowForFile ( 'folder' ) . should ( 'be.visible' ) 
70+ 
71+ 				createShare ( 'folder' ,  sharee . userId ) 
72+ 				closeSidebar ( ) 
4273			} ) 
74+ 			cy . logout ( ) 
4375		} ) 
4476
45- 		it ( 'Render quick option for sharing' ,  ( )  =>  { 
46- 			cy . mkdir ( user ,  '/folder' ) 
77+ 		it ( 'Render inline status action for sharer' ,  ( )  =>  { 
4778			cy . login ( user ) 
48- 
4979			cy . visit ( '/apps/files' ) 
50- 			getRowForFile ( 'folder' ) 
51- 				. should ( 'be.visible' ) 
5280
5381			getRowForFile ( 'folder' ) 
5482				. should ( 'be.visible' ) 
5583				. find ( '[data-cy-files-list-row-actions]' ) 
56- 				. findByRole ( 'button' ,  {  name : / S h o w   s h a r i n g   o p t i o n s / } ) 
57- 				. should ( 'be.visible' ) 
58- 				. click ( ) 
59- 
60- 			// check the click opened the sidebar 
61- 			cy . get ( '[data-cy-sidebar]' ) 
84+ 				. findByRole ( 'button' ,  {  name : / ^ S h a r e d   w i t h / i} ) 
6285				. should ( 'be.visible' ) 
63- 				// and ensure the sharing tab is selected 
64- 				. findByRole ( 'tab' ,  {  name : 'Sharing' ,  selected : true  } ) 
65- 				. should ( 'exist' ) 
6686		} ) 
6787
68- 		it ( 'Render inline status action for sharer' ,  ( )  =>  { 
69- 			cy . mkdir ( user ,  '/folder' ) 
88+ 		it ( 'Render status action in gridview for sharer' ,  ( )  =>  { 
7089			cy . login ( user ) 
71- 
7290			cy . visit ( '/apps/files' ) 
73- 			getRowForFile ( 'folder' ) 
74- 				. should ( 'be.visible' ) 
75- 			createShare ( 'folder' ,  sharee . userId ) 
76- 			closeSidebar ( ) 
91+ 			enableGridMode ( ) 
7792
7893			getRowForFile ( 'folder' ) 
7994				. should ( 'be.visible' ) 
80- 				. find ( '[data-cy-files-list-row-actions]' ) 
81- 				. findByRole ( 'button' ,  {  name : / ^ S h a r e d   w i t h / i} ) 
95+ 			getActionButtonForFile ( 'folder' ) 
96+ 				. click ( ) 
97+ 			cy . findByRole ( 'menu' ) 
98+ 				. findByRole ( 'menuitem' ,  {  name : / s h a r e d   w i t h / i} ) 
8299				. should ( 'be.visible' ) 
83100		} ) 
84101
85102		it ( 'Render inline status action for sharee' ,  ( )  =>  { 
86- 			cy . mkdir ( user ,  '/folder' ) 
87- 			cy . login ( user ) 
88- 
103+ 			cy . login ( sharee ) 
89104			cy . visit ( '/apps/files' ) 
105+ 
90106			getRowForFile ( 'folder' ) 
91107				. should ( 'be.visible' ) 
92- 			createShare ( 'folder' ,  sharee . userId ) 
93- 			closeSidebar ( ) 
108+ 				. find ( '[data-cy-files-list-row-actions]' ) 
109+ 				. findByRole ( 'button' ,  {  name : `Shared by ${ user . userId }   } ) 
110+ 				. should ( 'be.visible' ) 
111+ 		} ) 
94112
113+ 		it ( 'Render status action in grid view for sharee' ,  ( )  =>  { 
95114			cy . login ( sharee ) 
96115			cy . visit ( '/apps/files' ) 
97116
117+ 			enableGridMode ( ) 
118+ 
98119			getRowForFile ( 'folder' ) 
99120				. should ( 'be.visible' ) 
100- 				. find ( '[data-cy-files-list-row-actions]' ) 
101- 				. findByRole ( 'button' ,  {  name : `Shared by ${ user . userId }   } ) 
121+ 			getActionButtonForFile ( 'folder' ) 
122+ 				. click ( ) 
123+ 			cy . findByRole ( 'menu' ) 
124+ 				. findByRole ( 'menuitem' ,  {  name : `Shared by ${ user . userId }   } ) 
102125				. should ( 'be.visible' ) 
103126		} ) 
104127	} ) 
0 commit comments