@@ -112,16 +112,6 @@ test.describe('letter complete e2e journey', () => {
112112 ) ;
113113 } ) . toPass ( { timeout : 40_000 } ) ;
114114
115- // invoke SFTP poll lambda
116- await lambdaClient . send (
117- new InvokeCommand ( {
118- FunctionName : process . env . SFTP_POLL_LAMBDA_NAME ,
119- Payload : JSON . stringify ( {
120- supplier : 'WTMMOCK' ,
121- } ) ,
122- } )
123- ) ;
124-
125115 await expect ( async ( ) => {
126116 await page . reload ( ) ;
127117
@@ -138,8 +128,46 @@ test.describe('letter complete e2e journey', () => {
138128 await requestProofPage . clickRequestProofButton ( ) ;
139129
140130 await expect ( page ) . toHaveURL ( TemplateMgmtPreviewLetterPage . urlRegexp ) ;
131+ await expect ( previewTemplatePage . continueButton ) . toBeHidden ( ) ;
141132
142- await previewTemplatePage . clickContinueButton ( ) ;
133+ // invoke SFTP poll lambda
134+ await lambdaClient . send (
135+ new InvokeCommand ( {
136+ FunctionName : process . env . SFTP_POLL_LAMBDA_NAME ,
137+ Payload : JSON . stringify ( {
138+ supplier : 'WTMMOCK' ,
139+ } ) ,
140+ } )
141+ ) ;
142+
143+ await expect ( async ( ) => {
144+ const template = await templateStorageHelper . getTemplate ( key ) ;
145+ expect ( template . files ) . toContain ( { proofs : { } } ) ;
146+
147+ expect ( template . files ?. proofs ) . toEqual ( {
148+ 'proof-1' : {
149+ fileName : `proofs/${ user . userId } /${ templateId } /proof-1.pdf` ,
150+ virusScanStatus : 'PASSED' ,
151+ } ,
152+ 'proof-2' : {
153+ fileName : `proofs/${ user . userId } /${ templateId } /proof-2.pdf` ,
154+ virusScanStatus : 'PASSED' ,
155+ } ,
156+ 'proof-3' : {
157+ fileName : `proofs/${ user . userId } /${ templateId } /proof-3.pdf` ,
158+ virusScanStatus : 'PASSED' ,
159+ } ,
160+ } ) ;
161+
162+ expect ( template . templateStatus ) . toEqual ( 'PROOF_AVAILABLE' ) ;
163+ } ) . toPass ( { timeout : 60_000 } ) ;
164+
165+ await expect ( async ( ) => {
166+ await page . reload ( ) ;
167+
168+ await expect ( previewTemplatePage . continueButton ) . toBeVisible ( ) ;
169+ await previewTemplatePage . clickContinueButton ( ) ;
170+ } ) . toPass ( { timeout : 60_000 } ) ;
143171
144172 await expect ( page ) . toHaveURL ( TemplateMgmtSubmitLetterPage . urlRegexp ) ;
145173
0 commit comments