From b85677cf2cffe7559e7482ed986677f239a5f24f Mon Sep 17 00:00:00 2001
From: Pasquale Gatto <47112536+PasGat@users.noreply.github.com>
Date: Mon, 23 Nov 2020 10:04:20 +0000
Subject: [PATCH] MIB-153_V3: Add email to declaration confirmation
---
.../views/DeclarationConfirmationView.scala.html | 2 +-
.../pagespecs/DeclarationConfirmationPageSpec.scala | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
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"