@@ -7,8 +7,6 @@ context.only('Document Operations', () => {
77 cy . visit ( '/' )
88 cy . get ( `[node-id=${ CSS . escape ( 'admin@' + Cypress . env ( 'API_HOST' ) ) } ]` )
99 . should ( 'be.visible' )
10- // TODO(DP): might have to improve by adding more before / after hooks to prevent dangling documents
11- // see #400
1210 } )
1311
1412 after ( ( ) => {
@@ -58,9 +56,15 @@ context.only('Document Operations', () => {
5856 cy . get ( '.ReactVirtualized__Grid' )
5957 . should ( 'be.visible' )
6058 . contains ( 'untitled-1' )
59+ // (DP) cleanup welcome tab so we don't have to deal with it in later tests
60+ cy . get ( '#shell-tab-fusion-welcome > .p-TabBar-tabCloseIcon' )
61+ . click ( )
62+ cy . get ( '#shell-tab-fusion-welcome' )
63+ . should ( 'not.exist' )
64+
6165
6266 // TODO(DP):
63- // - add test for #413 : change order, remove workaround, might need a call to focused()
67+ // - add test for #413 : remove workaround
6468 // - check if tree view is deselected (it is but need not be),
6569 // - check if Explorer is updated properly (seems inconsistent need to double click)
6670 // - check if editor window is opening the newly create doc in a new tab (it doesn't)
@@ -83,12 +87,41 @@ context.only('Document Operations', () => {
8387 cy . get ( '.view-line' )
8488 . type ( 'asdf{ctrl+s}' )
8589 }
90+ // (DP): see #525 close edited editor pane
91+ cy . get ( '#theia-main-content-panel > .p-TabBar > .p-TabBar-content-container > .p-TabBar-content' )
92+ . within ( ( ) => {
93+ cy . get ( '.p-TabBar-tabCloseIcon' )
94+ . click ( { multiple : true } )
95+ } )
96+ cy . get ( '.main' )
97+ . click ( )
98+ cy . get ( '.view-lines' )
99+ . should ( 'not.exist' )
100+ cy . get ( '[node-id$=untitled-1]' )
101+ . should ( 'exist' )
102+ cy . get ( '[node-id$=untitled-2]' )
103+ . should ( 'not.exist' )
86104 } )
87105
88- // (DP): TODO
89- it . skip ( 'should not loose edits on closing' , ( ) => {
106+ it . skip ( 'should load previously stored document' , ( ) => {
90107 cy . get ( '.fusion-item' )
91108 . should ( 'be.visible' )
109+ cy . get ( '[node-id$=untitled-1]' )
110+ . dblclick ( )
111+ cy . get ( '.view-lines' )
112+ . should ( 'exist' )
113+ . contains ( 'asdf' )
114+ cy . get ( '#theia-main-content-panel > .p-TabBar > .p-TabBar-content-container > .p-TabBar-content' )
115+ . within ( ( ) => {
116+ cy . get ( '.p-TabBar-tabCloseIcon' )
117+ . click ( { multiple : true } )
118+ } )
119+ cy . get ( '.main' )
120+ . click ( )
121+ cy . get ( '[node-id$=untitled-1]' )
122+ . should ( 'exist' )
123+ cy . get ( '[node-id$=untitled-2]' )
124+ . should ( 'not.exist' )
92125 } )
93126
94127 it ( 'should display document properties' , ( ) => {
@@ -115,37 +148,103 @@ context.only('Document Operations', () => {
115148 . should ( 'contain.text' , 'user' )
116149 cy . get ( '.secondary' )
117150 . click ( )
151+ cy . get ( '[node-id$=untitled-1]' )
152+ . should ( 'exist' )
153+ } )
154+
155+ it ( 'should not create duplicate documents' , ( ) => {
156+ cy . get ( '[node-id$=db]' )
157+ . should ( 'be.visible' )
158+ . rightclick ( )
159+ . then ( ( ) => {
160+ cy . get ( '.p-Menu' )
161+ . should ( 'be.visible' )
162+ . contains ( 'New document' )
163+ . trigger ( 'mousemove' )
164+ cy . get ( '[data-command="fusion.new-document"] > .p-Menu-itemLabel' )
165+ . should ( 'be.visible' )
166+ . click ( )
167+ cy . get ( '.fs-inline-input > .theia-input' )
168+ . clear ( )
169+ . type ( 'untitled-1{enter}' )
170+ cy . get ( '.error' )
171+ . should ( 'exist' )
172+ . should ( 'contain.text' , 'Item already exists' )
173+ cy . get ( '[node-id$=untitled-1]' )
174+ . should ( 'exist' )
175+ } )
176+ } )
177+
178+ it ( 'should let users delete documents' , ( ) => {
179+ cy . get ( '[node-id$=untitled-1]' )
180+ . should ( 'be.visible' )
181+ . rightclick ( )
182+ cy . get ( '[data-command="fusion.delete"] > .p-Menu-itemLabel' )
183+ . should ( 'be.visible' )
184+ . click ( )
185+ cy . get ( '.main' )
186+ . click ( )
187+ cy . get ( '[node-id$=db]' )
188+ . should ( 'be.visible' )
189+ cy . get ( '[node-id$=untitled-1]' )
190+ . should ( 'not.exist' )
118191 } )
119192
120193 // see #414 workaround is to run this after editing and saving the document,
121194 // we should be able to rename before editing content
122- it ( 'should let users rename documents' , ( ) => {
195+ it . skip ( 'should let users rename documents' , ( ) => {
123196 cy . get ( '.fusion-item' )
124197 . should ( 'exist' )
125- // (DP) rename untitled-1 -> test.txt
198+ // (DP) rename untitled-1 -> test.xml
126199 cy . get ( '[node-id$=untitled-1]' )
127200 . should ( 'be.visible' )
128- // (DP) press F2 not working
201+ // (DP) press F2 not working see #526
129202 // .trigger('keydown', { keyCode: 112, which: 112 })
130203 // .trigger('keyup', { keyCode: 112, which: 112 })
131204 // (DP) see #522
132205 . rightclick ( { force : true } )
133- // (DP) note to self: the problem is that the editor window remains open from previous runs,
134- // so there is untitled-1 there after the rename, we need to close it, without interferring with the
135- // logic of the first run, or just declare this test green because yolo
136206 cy . get ( '[data-command="fusion.rename"] > .p-Menu-itemLabel' )
137207 . should ( 'be.visible' )
138208 . click ( )
139209 . focused ( )
210+ . clear ( )
140211 . type ( 'test.txt{enter}' , { force : true } )
141- cy . get ( '[node-id$=test\\.txt]' )
142- . should ( 'be.visible' )
143- // DP see #414 activate to confirm fix
212+ // (DP): see #414 here the funkyness starts instead of having renamed the first file upon hitting {enter}
213+ // - we now have 2 files in the db tree untitled-1 and test.txt, there should only be 1 => test.txt
214+ // - test.txt isn't really renamed as its contents are empty, it should have the contents previously stored as untitled-1
215+ // - uncomment the following to test any potential fixes
144216 // cy.get('[node-id$=untitled-1]')
145- // .should('not.exist')
217+ // .should('not.exist')
218+
219+ // (DP): failed workaround which needs to include a subworkaround but ultimately fails due to #527
220+ // cy.get('.ReactVirtualized__Grid')
221+ // .then(() => {
222+ // cy.get('[node-id$=test\\.txt]')
223+ // .dblclick()
224+ // })
225+ // if (Cypress.platform === 'darwin') {
226+ // cy.get('.view-line')
227+ // .type('fdsa{meta+s}')
228+ // } else {
229+ // cy.get('.view-line')
230+ // .type('fdsa{ctrl+s}')
231+ // }
232+ // // (DP): subworkaround #525 close edited editor pane
233+ // cy.get('#theia-main-content-panel > .p-TabBar > .p-TabBar-content-container > .p-TabBar-content')
234+ // .within(() => {
235+ // cy.get('.p-TabBar-tabCloseIcon')
236+ // .click({ multiple: true })
237+ // })
238+ // cy.get('.main')
239+ // .click()
240+ // (DP): end workarounds #414 #525 #527
241+
242+ // (DP): if #414 is fixed the below needs to be activated
243+ // cy.get('[node-id$=test\\.txt]')
244+ // .should('be.visible')
146245 } )
147246
148- it ( 'should not create duplicate documents' , ( ) => {
247+ it . skip ( 'should not create duplicate documents' , ( ) => {
149248 cy . get ( '[node-id$=db]' )
150249 . should ( 'be.visible' )
151250 . rightclick ( )
@@ -169,7 +268,7 @@ context.only('Document Operations', () => {
169268 } )
170269 } )
171270
172- it ( 'should let users delete documents' , ( ) => {
271+ it . skip ( 'should let users delete documents' , ( ) => {
173272 cy . get ( '[node-id$=test\\.txt]' )
174273 . should ( 'be.visible' )
175274 . rightclick ( )
@@ -178,7 +277,6 @@ context.only('Document Operations', () => {
178277 . click ( )
179278 cy . get ( '.main' )
180279 . click ( )
181- // make sure all test files are gone see #400
182280 cy . get ( '[node-id$=db]' )
183281 . should ( 'be.visible' )
184282 cy . get ( '[node-id$=test\\.txt]' )
0 commit comments