diff --git a/app/uk/gov/hmrc/merchandiseinbaggage/views/DeclarationConfirmationView.scala.html b/app/uk/gov/hmrc/merchandiseinbaggage/views/DeclarationConfirmationView.scala.html index da6238620..cdd99ac0b 100644 --- a/app/uk/gov/hmrc/merchandiseinbaggage/views/DeclarationConfirmationView.scala.html +++ b/app/uk/gov/hmrc/merchandiseinbaggage/views/DeclarationConfirmationView.scala.html @@ -32,7 +32,7 @@

Declaration complete

@messages("declarationConfirmation.date")

@declaration.dateOfDeclaration.formattedDate

- +

@messages("declarationConfirmation.email", declaration.email.email)

Print or save a copy of this page diff --git a/test/uk/gov/hmrc/merchandiseinbaggage/pagespecs/DeclarationConfirmationPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggage/pagespecs/DeclarationConfirmationPageSpec.scala index 38bac6443..7d886f91e 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggage/pagespecs/DeclarationConfirmationPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggage/pagespecs/DeclarationConfirmationPageSpec.scala @@ -39,17 +39,19 @@ class DeclarationConfirmationPageSpec extends BasePageSpec[DeclarationConfirmati "make declaration" in { val id = DeclarationId("456") val declarationJourney = completedDeclarationJourney.copy(declarationType = DeclarationType.Export) + val declarationCompleted = declarationJourney.declarationIfRequiredAndComplete.get givenADeclarationJourney(declarationJourney.copy(declarationId = Some(id))) - givenPersistedDeclarationIsFound(wireMockServer, declarationJourney.declarationIfRequiredAndComplete.get, id) + givenPersistedDeclarationIsFound(wireMockServer, declarationCompleted, id) open(path) page.mustRenderBasicContentWithoutHeader(path, title) hasConfirmationPanelWithContents hasDateOfDeclaration + hasEmailAddress(declarationCompleted) hasPrintPageContentInPdf hasWhaToDoNext - hasGoodDetails(completedDeclarationJourney.declarationIfRequiredAndComplete.get) - hasPersonDetails(completedDeclarationJourney.declarationIfRequiredAndComplete.get) + hasGoodDetails(declarationCompleted) + hasPersonDetails(declarationCompleted) hasMakeAnotherDeclarationLink } } @@ -66,6 +68,9 @@ class DeclarationConfirmationPageSpec extends BasePageSpec[DeclarationConfirmati textOfElementWithId("declarationDateFormattedId") must include(LocalDateTime.now.format(Declaration.formatter)) } + def hasEmailAddress(declaration: Declaration): Assertion = + textOfElementWithId("declarationEmailId") mustBe s"We have sent you a confirmation email to ${declaration.email.email}." + def hasPrintPageContentInPdf: Assertion = { attrOfElementWithId("printDeclarationId", "href") mustBe "javascript:window.print();" textOfElementWithId("printDeclarationId") mustBe "Print or save a copy of this page"