@@ -14,6 +14,7 @@ import { TemplateMgmtRequestProofPage } from '../pages/template-mgmt-request-pro
1414import { InvokeCommand , LambdaClient } from '@aws-sdk/client-lambda' ;
1515import { EmailHelper } from '../helpers/email-helper' ;
1616import { loginAsUser } from '../helpers/auth/login-as-user' ;
17+ import { Template } from '../helpers/types' ;
1718
1819const lambdaClient = new LambdaClient ( { region : 'eu-west-2' } ) ;
1920const emailHelper = new EmailHelper ( ) ;
@@ -232,6 +233,8 @@ function requestProof(
232233
233234 await previewTemplatePage . clickContinueButton ( ) ;
234235 } ) . toPass ( { timeout : 60_000 } ) ;
236+
237+ return expandedTemplateId ;
235238 } ) ;
236239}
237240
@@ -256,7 +259,7 @@ function submit(
256259}
257260
258261function checkEmail (
259- templateId : string ,
262+ expandedTemplateId : string ,
260263 testStart : Date ,
261264 prefix : string ,
262265 emailTitle : string
@@ -265,11 +268,11 @@ function checkEmail(
265268 await expect ( async ( ) => {
266269 const emailContents = await emailHelper . getEmailForTemplateId (
267270 prefix ,
268- templateId ,
271+ expandedTemplateId ,
269272 testStart
270273 ) ;
271274
272- expect ( emailContents ) . toContain ( templateId ) ;
275+ expect ( emailContents ) . toContain ( expandedTemplateId ) ;
273276 expect ( emailContents ) . toContain ( 'Valid Letter Template' ) ; // template name
274277 expect ( emailContents ) . toContain ( emailTitle ) ;
275278 } ) . toPass ( { timeout : 60_000 } ) ;
@@ -311,10 +314,14 @@ test.describe('letter complete e2e journey', () => {
311314
312315 await continueAfterCreation ( page ) ;
313316
314- await requestProof ( page , templateStorageHelper , templateKey ) ;
317+ const expandedTemplateId = await requestProof (
318+ page ,
319+ templateStorageHelper ,
320+ templateKey
321+ ) ;
315322
316323 await checkEmail (
317- templateKey . id ,
324+ expandedTemplateId ,
318325 testStart ,
319326 process . env . TEST_PROOF_REQUESTED_EMAIL_PREFIX ,
320327 'Proof Requested'
@@ -323,7 +330,7 @@ test.describe('letter complete e2e journey', () => {
323330 await submit ( page , templateStorageHelper , templateKey ) ;
324331
325332 await checkEmail (
326- templateKey . id ,
333+ expandedTemplateId ,
327334 testStart ,
328335 process . env . TEST_TEMPLATE_SUBMITTED_EMAIL_PREFIX ,
329336 'Template Submitted'
0 commit comments