@@ -108,7 +108,10 @@ describe('Sync', () => {
108108 'contain' ,
109109 'The document could not be loaded.' ,
110110 )
111+ cy . intercept ( '**/apps/text/session/*/create' ) . as ( 'create' )
111112 cy . get ( '#editor-container .document-status' ) . find ( '.button.primary' ) . click ( )
113+ // let first attempt fail
114+ cy . wait ( '@create' , { timeout : 10000 } )
112115 cy . get ( '#editor-container .document-status' , { timeout : 30000 } ) . should (
113116 'contain' ,
114117 'The document could not be loaded.' ,
@@ -117,13 +120,13 @@ describe('Sync', () => {
117120 cy . intercept ( '**/apps/text/session/*/*' , ( req ) => {
118121 req . continue ( )
119122 } ) . as ( 'alive' )
120- cy . intercept ( '**/apps/text/session/*/create' ) . as ( 'create' )
121123 cy . get ( '#editor-container .document-status' ) . find ( '.button.primary' ) . click ( )
124+ // this is the create request... - now with the alive alias
122125 cy . wait ( '@alive' , { timeout : 30000 } )
123- cy . wait ( '@create' , { timeout : 10000 } )
124126 . its ( 'request.body' )
125127 . should ( 'have.property' , 'baseVersionEtag' )
126128 . should ( 'not.be.empty' )
129+ cy . getContent ( ) . should ( 'contain' , 'Hello world' )
127130 } )
128131
129132 it ( 'recovers from a lost and closed connection' , ( ) => {
@@ -176,18 +179,9 @@ describe('Sync', () => {
176179 cy . wait ( '@save' )
177180 cy . uploadTestFile ( 'test.md' )
178181
179- cy . get ( '#editor-container .document-status' , { timeout : 30000 } ) . should (
180- 'contain' ,
181- 'Editing session has expired.' ,
182- )
183-
184- // Reload button works
185- cy . get ( '#editor-container .document-status a.button' )
186- . contains ( 'Reload' )
187- . click ( )
188-
189- cy . getContent ( )
190- cy . get ( '#editor-container .document-status .notecard' ) . should ( 'not.exist' )
182+ cy . getContent ( ) . should ( 'not.exist' )
183+ cy . getContent ( ) . find ( 'h2' ) . should ( 'contain' , 'Hello world' )
184+ cy . getContent ( ) . find ( 'li' ) . should ( 'not.exist' ) // was overwritten after the save
191185 } )
192186
193187 it ( 'passes the doc content from one session to the next' , ( ) => {
0 commit comments