@@ -22,8 +22,10 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
2222 it ( 'See first assigned tag in the file list' , ( ) => {
2323 const tag = randomBytes ( 8 ) . toString ( 'base64' )
2424
25+ cy . intercept ( 'PROPFIND' , `**/remote.php/dav/files/${ user . userId } /file.txt` ) . as ( 'getNode' )
2526 getRowForFile ( 'file.txt' ) . should ( 'be.visible' )
2627 triggerActionForFile ( 'file.txt' , 'details' )
28+ cy . wait ( '@getNode' )
2729
2830 cy . get ( '[data-cy-sidebar]' )
2931 . should ( 'be.visible' )
@@ -36,13 +38,14 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
3638 . click ( )
3739
3840 cy . intercept ( 'PUT' , '**/remote.php/dav/systemtags-relations/files/**' ) . as ( 'assignTag' )
39- cy . get ( '[data-cy-sidebar]' )
40- . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
41- . should ( 'be.visible' )
42- . type ( `${ tag } {enter}` )
41+
42+ getCollaborativeTagsInput ( )
43+ . type ( `{selectAll}${ tag } {enter}` )
4344 cy . wait ( '@assignTag' )
44- closeSidebar ( )
45+ cy . wait ( '@getNode' )
4546
47+ // Close the sidebar and reload to check the file list
48+ closeSidebar ( )
4649 cy . reload ( )
4750
4851 getRowForFile ( 'file.txt' )
@@ -56,8 +59,10 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
5659 const tag1 = randomBytes ( 5 ) . toString ( 'base64' )
5760 const tag2 = randomBytes ( 5 ) . toString ( 'base64' )
5861
62+ cy . intercept ( 'PROPFIND' , `**/remote.php/dav/files/${ user . userId } /file.txt` ) . as ( 'getNode' )
5963 getRowForFile ( 'file.txt' ) . should ( 'be.visible' )
6064 triggerActionForFile ( 'file.txt' , 'details' )
65+ cy . wait ( '@getNode' )
6166
6267 cy . get ( '[data-cy-sidebar]' )
6368 . should ( 'be.visible' )
@@ -70,17 +75,20 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
7075 . click ( )
7176
7277 cy . intercept ( 'PUT' , '**/remote.php/dav/systemtags-relations/files/**' ) . as ( 'assignTag' )
73- cy . get ( '[data-cy-sidebar]' ) . within ( ( ) => {
74- cy . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
75- . should ( 'be.visible' )
76- . type ( `${ tag1 } {enter}` )
77- cy . wait ( '@assignTag' )
78- cy . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
79- . should ( 'be.visible' )
80- . type ( `${ tag2 } {enter}` )
81- cy . wait ( '@assignTag' )
82- } )
8378
79+ // Assign first tag
80+ getCollaborativeTagsInput ( )
81+ . type ( `{selectAll}${ tag1 } {enter}` )
82+ cy . wait ( '@assignTag' )
83+ cy . wait ( '@getNode' )
84+
85+ // Assign second tag
86+ getCollaborativeTagsInput ( )
87+ . type ( `{selectAll}${ tag2 } {enter}` )
88+ cy . wait ( '@assignTag' )
89+ cy . wait ( '@getNode' )
90+
91+ // Close the sidebar and reload to check the file list
8492 closeSidebar ( )
8593 cy . reload ( )
8694
@@ -97,11 +105,10 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
97105 const tag2 = randomBytes ( 4 ) . toString ( 'base64' )
98106 const tag3 = randomBytes ( 4 ) . toString ( 'base64' )
99107
108+ cy . intercept ( 'PROPFIND' , `**/remote.php/dav/files/${ user . userId } /file.txt` ) . as ( 'getNode' )
100109 getRowForFile ( 'file.txt' ) . should ( 'be.visible' )
101-
102- cy . intercept ( 'PROPFIND' , '**/remote.php/dav/**' ) . as ( 'sidebarLoaded' )
103110 triggerActionForFile ( 'file.txt' , 'details' )
104- cy . wait ( '@sidebarLoaded ' )
111+ cy . wait ( '@getNode ' )
105112
106113 cy . get ( '[data-cy-sidebar]' )
107114 . should ( 'be.visible' )
@@ -114,23 +121,26 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
114121 . click ( )
115122
116123 cy . intercept ( 'PUT' , '**/remote.php/dav/systemtags-relations/files/**' ) . as ( 'assignTag' )
117- cy . get ( '[data-cy-sidebar]' ) . within ( ( ) => {
118- cy . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
119- . should ( 'be.visible' )
120- . type ( `${ tag1 } {enter}` )
121- cy . wait ( '@assignTag' )
122-
123- cy . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
124- . should ( 'be.visible' )
125- . type ( `${ tag2 } {enter}` )
126- cy . wait ( '@assignTag' )
127-
128- cy . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
129- . should ( 'be.visible' )
130- . type ( `${ tag3 } {enter}` )
131- cy . wait ( '@assignTag' )
132- } )
133124
125+ // Assign first tag
126+ getCollaborativeTagsInput ( )
127+ . type ( `{selectAll}${ tag1 } {enter}` )
128+ cy . wait ( '@assignTag' )
129+ cy . wait ( '@getNode' )
130+
131+ // Assign second tag
132+ getCollaborativeTagsInput ( )
133+ . type ( `{selectAll}${ tag2 } {enter}` )
134+ cy . wait ( '@assignTag' )
135+ cy . wait ( '@getNode' )
136+
137+ // Assign third tag
138+ getCollaborativeTagsInput ( )
139+ . type ( `{selectAll}${ tag3 } {enter}` )
140+ cy . wait ( '@assignTag' )
141+ cy . wait ( '@getNode' )
142+
143+ // Close the sidebar and reload to check the file list
134144 closeSidebar ( )
135145 cy . reload ( )
136146
@@ -153,3 +163,10 @@ describe('Systemtags: Files integration', { testIsolation: true }, () => {
153163 } )
154164 } )
155165} )
166+
167+ function getCollaborativeTagsInput ( ) : Cypress . Chainable < JQuery < HTMLElement > > {
168+ return cy . get ( '[data-cy-sidebar]' )
169+ . findByRole ( 'combobox' , { name : / c o l l a b o r a t i v e t a g s / i } )
170+ . should ( 'be.visible' )
171+ . should ( 'not.have.attr' , 'disabled' , { timeout : 5000 } )
172+ }
0 commit comments