@@ -51,20 +51,20 @@ variants.forEach(function ({ fixture, mime }) {
5151 } )
5252
5353 it ( prefix + ': displays conflicts' , function ( ) {
54- createConflict ( fileName , mime )
54+ createConflict ( fileName , 'edited-' + fileName , mime )
5555
5656 cy . openFile ( fileName )
5757
5858 cy . get ( '.text-editor .document-status' ) . should (
5959 'contain' ,
6060 'The file was overwritten.' ,
6161 )
62- getWrapper ( ) . find ( '#read-only-editor' ) . should ( 'contain' , 'edited ' )
62+ getWrapper ( ) . find ( '#read-only-editor' ) . should ( 'contain' , 'Hello world ' )
6363 getWrapper ( )
6464 . find ( '#read-only-editor' )
6565 . should ( 'not.contain' , 'cruel conflicting' )
6666
67- getWrapper ( ) . find ( '.text-editor__main' ) . should ( 'contain' , 'edited ' )
67+ getWrapper ( ) . find ( '.text-editor__main' ) . should ( 'contain' , 'Hello world ' )
6868 getWrapper ( )
6969 . find ( '.text-editor__main' )
7070 . should ( 'contain' , 'cruel conflicting' )
@@ -73,7 +73,7 @@ variants.forEach(function ({ fixture, mime }) {
7373 it (
7474 prefix + ': resolves conflict using current editing session' ,
7575 function ( ) {
76- createConflict ( fileName , mime )
76+ createConflict ( fileName , 'edited-' + fileName , mime )
7777
7878 cy . openFile ( fileName )
7979 cy . intercept ( { method : 'POST' , url : '**/session/*/push' } ) . as ( 'push' )
@@ -82,26 +82,25 @@ variants.forEach(function ({ fixture, mime }) {
8282
8383 getWrapper ( ) . should ( 'not.exist' )
8484 cy . get ( '[data-cy="resolveThisVersion"]' ) . should ( 'not.exist' )
85- cy . getContent ( ) . should ( 'contain' , 'edited' )
8685 cy . getContent ( ) . should ( 'contain' , 'cruel conflicting' )
8786 } ,
8887 )
8988
9089 it ( prefix + ': resolves conflict using server version' , function ( ) {
91- createConflict ( fileName , mime )
90+ createConflict ( fileName , 'edited-' + fileName , mime )
9291
9392 cy . openFile ( fileName )
9493 cy . get ( '[data-cy="resolveServerVersion"]' ) . click ( )
9594
9695 getWrapper ( ) . should ( 'not.exist' )
9796 cy . get ( '[data-cy="resolveThisVersion"]' ) . should ( 'not.exist' )
9897 cy . get ( '[data-cy="resolveServerVersion"]' ) . should ( 'not.exist' )
99- cy . getContent ( ) . should ( 'contain' , 'edited ' )
98+ cy . getContent ( ) . should ( 'contain' , 'Hello world ' )
10099 cy . getContent ( ) . should ( 'not.contain' , 'cruel conflicting' )
101100 } )
102101
103102 it ( prefix + ': hides conflict in read only session' , function ( ) {
104- createConflict ( fileName , mime )
103+ createConflict ( fileName , 'edited-' + fileName , mime )
105104 cy . testName ( ) . then ( ( testName ) => {
106105 cy . shareFile ( `/${ testName } /${ fileName } ` ) . then ( ( token ) => {
107106 cy . logout ( )
@@ -113,16 +112,10 @@ variants.forEach(function ({ fixture, mime }) {
113112 } )
114113
115114 it ( prefix + ': no conflict when uploading same file content' , function ( ) {
116- cy . testName ( ) . then ( ( testName ) => {
117- cy . uploadFile ( fileName , mime , `${ testName } /${ fileName } ` )
118- cy . visitTestFolder ( )
119- cy . openFile ( fileName )
120- cy . uploadFile ( fileName , mime , `${ testName } /${ fileName } ` )
121-
122- cy . get ( '.text-editor .document-status' ) . should ( 'not.exist' )
123- getWrapper ( ) . should ( 'not.exist' )
124- cy . getContent ( ) . should ( 'not.contain' , 'edited' )
125- } )
115+ createConflict ( fileName , fileName , mime )
116+ cy . openFile ( fileName )
117+ cy . getContent ( ) . should ( 'contain' , 'Hello world' )
118+ getWrapper ( ) . should ( 'not.exist' )
126119 } )
127120 } )
128121} )
@@ -139,7 +132,7 @@ describe('conflict dialog scroll behaviour', function () {
139132 cy . login ( user )
140133 cy . createTestFolder ( )
141134
142- createConflict ( fileName , 'text/markdown' )
135+ createConflict ( fileName , 'edited-' + fileName , ' text/markdown')
143136
144137 cy . openFile ( fileName )
145138
@@ -158,23 +151,30 @@ describe('conflict dialog scroll behaviour', function () {
158151} )
159152
160153/**
161- * @param {string } fileName - filename
154+ * @param {string } fileName1 - filename1
155+ * @param {string } fileName2 - filename2
162156 * @param {string } mime - mimetype
163157 */
164- function createConflict ( fileName , mime ) {
158+ function createConflict ( fileName1 , fileName2 , mime ) {
165159 cy . testName ( ) . then ( ( testName ) => {
166- cy . uploadFile ( fileName , mime , `${ testName } /${ fileName } ` )
160+ cy . uploadFile ( fileName1 , mime , `${ testName } /${ fileName1 } ` )
167161 } )
168162 cy . visitTestFolder ( )
169- cy . openFile ( fileName )
163+ cy . openFile ( fileName1 )
170164 cy . log ( 'Inspect editor' )
171165 cy . getEditor ( )
172166 . find ( '.ProseMirror' )
173167 . should ( 'have.attr' , 'contenteditable' , 'true' )
168+
174169 cy . getContent ( ) . type ( 'Hello you cruel conflicting world' )
170+
175171 cy . testName ( ) . then ( ( testName ) => {
176- cy . uploadFile ( 'edited-' + fileName , mime , testName + '/' + fileName )
172+ cy . uploadFile ( fileName2 , mime , testName + '/' + fileName1 )
177173 } )
174+
175+ cy . intercept ( 'POST' , '**/session/*/sync' ) . as ( 'sync' )
176+ cy . wait ( '@sync' , { timeout : 10000 } )
177+
178178 cy . get ( '#viewer .modal-header button.header-close' ) . click ( )
179179 cy . get ( '#viewer' ) . should ( 'not.exist' )
180180}
0 commit comments