You will need to pay
- the invoice
+ the invoice
by {{ invoice.payment_due_date | formatDate }} ({{ invoice.payment_due_date | fromNow(invoice.overdue) }}{{ ' overdue' if invoice.overdue }}).
{# Ugly indentation is so that markdown spacing is handled correctly #}
{% markdown %}{{ quote.content | safe }}{% endmarkdown %}
{% call Reveal({ summary: 'View full terms and conditions' }) %}
@@ -50,10 +50,10 @@
error: 'Confirm that you accept the Charges and the Terms and Conditions' if invalid
}) }}
-
+
- {% call Reveal({ summary: 'There is a problem with my quote' }) %}
+ {% call Reveal({ summary: 'There is a problem with my quote', dataTest: 'quote-problem' }) %}
{% include '_includes/messages/general-contact.njk' %}
{% endcall %}
{% endif %}
diff --git a/test/end-to-end/cypress/order-page-spec.cy.js b/test/end-to-end/cypress/order-page-spec.cy.js
new file mode 100644
index 0000000..9847e79
--- /dev/null
+++ b/test/end-to-end/cypress/order-page-spec.cy.js
@@ -0,0 +1,81 @@
+const { addMonths, format } = require("date-fns");
+const { formats } = require("../../../config");
+
+describe("order page spec", () => {
+ it("when visiting an order where the quote is awaiting acceptance", () => {
+ cy.visit(
+ "http://localhost:4000/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA"
+ );
+ cy.log('should display correct headings')
+ cy.get('h1').should("have.text", "Your order");
+ cy.get('[data-test="subheading"]').should("have.text", "Order reference WHY589/23 in Canada")
+
+ cy.log('should display Review your quote text and button')
+ cy.get('[data-test="actions-heading"]').should('have.text', 'Your actions')
+ cy.get('[data-test="accept-quote-text"]').should('have.text', 'Please review and accept your quote so that we can start delivering the work.')
+ cy.get('[data-test="review-your-quote-button"]')
+ .should("contain", "Review your quote")
+ .and('have.attr', 'href', '/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA/quote');
+
+ cy.log('should display Your quote text')
+ cy.get('[data-test="your-quote-heading"]').should('have.text', 'Your quote')
+ cy.get('[data-test="metalist-quote"]').should('contain', 'We sent it on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'It will expire on').and('contain', `${format(addMonths(new Date(), 1), formats.dateLong)} (in a month)`)
+ });
+ it("when visiting an order where the quote is accepted", () => {
+ cy.visit(
+ "http://localhost:4000/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ"
+ );
+ cy.log('should display correct headings')
+ cy.get('h1').should("have.text", "Your order");
+ cy.get('[data-test="subheading"]').should("have.text", "Order reference RYM547/24 in Canada")
+
+ cy.log('should display invoice text and button')
+ cy.get('[data-test="actions-heading"]').should('have.text', 'Your actions')
+ cy.get('[data-test="must-pay-text"]').should('have.text', 'You must pay for your order to receive the work.')
+ cy.get('[data-test="pay-invoice-text"]').should('have.text', `\n You will need to pay\n the invoice\n by ${format(addMonths(new Date(), 1), formats.dateLong)} (in a month).\n`)
+ cy.get('[data-test="invoice-link"]').should('have.text', 'the invoice').and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/invoice')
+ cy.get('[data-test="payment-options-button"]')
+ .should("contain", "View payment options")
+ .and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/payment')
+ cy.get('[data-test="accept-quote-text"]').should('not.exist')
+ cy.get('[data-test="review-your-quote-button"]').should("not.exist")
+
+ cy.log('should display Your invoice text')
+ cy.get('[data-test="invoice-heading"]').should('have.text', 'Your invoice')
+ cy.get('[data-test="metalist-invoice"]').should('contain', 'Invoice number').and('contain', 'Created on').and('contain', format(new Date(), formats.dateLong))
+ cy.get('[data-test="view-invoice-link"]').should('contain', 'View your invoice').and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/invoice')
+
+ cy.log('should display Your quote text')
+ cy.get('[data-test="your-quote-heading"]').should('have.text', 'Your quote')
+ cy.get('[data-test="metalist-quote"]').should('contain', 'We sent it on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'You accepted it on')
+ cy.get('[data-test="quote-link"]').should('contain', 'View your accepted quote').and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/quote')
+ });
+ it("when visiting an order that has been paid for", () => {
+ cy.visit(
+ "http://localhost:4000/h93Dn7DKvMLbUB5Yz2h5z7dL1mXXGUa_UiPNBkVoyKLmBE29YQ"
+ );
+ cy.log('should display correct headings')
+ cy.get('h1').should("have.text", "Your order");
+ cy.get('[data-test="subheading"]').should("have.text", "Order reference CJC167/23 in Canada")
+
+ cy.log('should display completion box')
+ cy.get('[data-test="completed-text"]').should('have.text', 'Completed work for your order will be sent directly to you by email.')
+ cy.get('[data-test="problem-text"]').should('have.text', 'If there are any problems, get in touch with your DBT contact or email omis.orders@digital.trade.gov.uk.')
+ cy.get('[data-test="omis-email"]').should('have.attr', 'href', 'mailto:omis.orders@digital.trade.gov.uk')
+
+ cy.log('should display invoice text and button')
+ cy.get('[data-test="actions-heading"]').should('have.text', 'Your actions')
+ cy.get('[data-test="no-actions-text"]').should('have.text', 'You have no actions for this order.')
+
+ cy.log('should display Your invoice text')
+ cy.get('[data-test="invoice-heading"]').should('have.text', 'Your invoice')
+ cy.get('[data-test="metalist-invoice"]').should('contain', 'Invoice number').and('contain', 'Created on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'Paid on')
+ cy.get('[data-test="view-invoice-link"]').should('contain', 'View your invoice').and('have.attr', 'href', '/h93Dn7DKvMLbUB5Yz2h5z7dL1mXXGUa_UiPNBkVoyKLmBE29YQ/invoice')
+ cy.get('[data-test="receipt-link"]').should('contain', 'View your payment receipt').and('have.attr', 'href', '/h93Dn7DKvMLbUB5Yz2h5z7dL1mXXGUa_UiPNBkVoyKLmBE29YQ/receipt')
+
+ cy.log('should display Your quote text')
+ cy.get('[data-test="your-quote-heading"]').should('have.text', 'Your quote')
+ cy.get('[data-test="metalist-quote"]').should('contain', 'We sent it on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'You accepted it on')
+ cy.get('[data-test="quote-link"]').should('contain', 'View your accepted quote').and('have.attr', 'href', '/h93Dn7DKvMLbUB5Yz2h5z7dL1mXXGUa_UiPNBkVoyKLmBE29YQ/quote')
+ });
+});
\ No newline at end of file
diff --git a/test/end-to-end/cypress/quote-accepted-spec.cy.js b/test/end-to-end/cypress/quote-accepted-spec.cy.js
new file mode 100644
index 0000000..cdd49f6
--- /dev/null
+++ b/test/end-to-end/cypress/quote-accepted-spec.cy.js
@@ -0,0 +1,20 @@
+const { addMonths, format } = require('date-fns')
+const { formats } = require("../../../config");
+
+describe("quote acceptance page spec", () => {
+ it("when accepting a quote", () => {
+ cy.visit(
+ "http://localhost:4000/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/quote/accepted"
+ );
+
+ cy.log('should render all elements correctly')
+ cy.get('[data-test="confirmation-banner"]').should('contain', 'Quote accepted').and('contain', 'Your reference number is').and('contain', 'RYM547/24')
+ cy.get('h3').should('have.text', 'What happens next')
+ cy.get('[data-test="confirmation-text"]').should('have.text', 'You will receive a confirmation email that the quote has been accepted.')
+ cy.get('[data-test="pay-invoice-text"]').should('have.text', `\n You will need to pay\n the invoice\n by ${format(addMonths(new Date(), 1), formats.dateLong)} (in a month).\n`)
+ cy.get('[data-test="payment-options-button"]')
+ .should("contain", "View payment options")
+ .and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/payment')
+ cy.get('[data-test="order-history-link"]').should('have.text', 'View your order history').and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ')
+ })
+})
\ No newline at end of file
diff --git a/test/end-to-end/cypress/quote-page-spec.cy.js b/test/end-to-end/cypress/quote-page-spec.cy.js
new file mode 100644
index 0000000..ee16571
--- /dev/null
+++ b/test/end-to-end/cypress/quote-page-spec.cy.js
@@ -0,0 +1,59 @@
+const { addMonths, format } = require('date-fns')
+const { formats } = require("../../../config");
+
+describe("quote page spec", () => {
+ it("where the quote is awaiting acceptance", () => {
+ cy.visit(
+ "http://localhost:4000/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA/quote"
+ );
+ cy.log('should render correct headings')
+ cy.get('[data-test="order-history-link"]').should('have.text', 'View your order history').and('have.attr', 'href', '/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA')
+ cy.get('[class="local-header__heading"]').should('have.text', 'Your quote')
+ cy.get('[data-test="subheading"]').should('have.text', 'Order reference WHY589/23 for Canada')
+ cy.get('[data-test="metalist-quote"]').should('contain', 'We sent it on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'It will expire on').and('contain', `${format(addMonths(new Date(), 1), formats.dateLong)} (in a month)`)
+
+ cy.log('should render quote')
+ cy.get('[data-test="quote"]').should('contain', `Date: ${format(new Date(), formats.dateLong)}`)
+ .and('contain', 'Quote for the Provision of an Overseas Market Introduction Service (“OMIS”): WHY589/23 (the Quote)')
+ .and('contain', 'Motorleaf Global HQ of 5000 Rue Saint-Patrick, Montréal, H4E 1A8, Canada')
+ .and('contain', 'DBT will deliver the Services on or before the Delivery Date which shall be 7 May 2030')
+ .and('contain', 'The Customer Contact shall be Johnny Cakeman of Motorleaf Global HQ, 5000 Rue Saint-Patrick, Montréal, H4E 1A8, Canada and johnny@cakeman.com.')
+ .and('contain', `This Quote must be accepted by you by ${format(addMonths(new Date(), 1), formats.dateLong)}.`)
+
+ cy.log('should render the quote acceptance elements')
+ cy.get('[data-test="field-confirm-1"]').should('contain', 'I accept the Charges and the Terms and Conditions')
+ cy.get('[data-test="accept-quote-button"]').should('have.text', 'Accept quote')
+ cy.get('[data-test="reveal-quote-problem"]').should('have.text', 'There is a problem with my quote').click()
+ cy.get('[class="c-message c-message--muted"]').should('contain', 'Get in touch with your DBT contact or email omis.orders@digital.trade.gov.uk')
+ cy.get('[data-test="omis-orders-email"]').should('have.attr', 'href', 'mailto:omis.orders@digital.trade.gov.uk')
+
+ cy.log('should accept the quote')
+ cy.get('[data-test="field-confirm-1"]').click()
+ cy.get('[data-test="accept-quote-button"]').click()
+ cy.location('pathname').should('eq', '/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA/quote/accepted')
+
+ });
+ it("when visiting an order where the quote is accepted", () => {
+ cy.visit(
+ "http://localhost:4000/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ/quote"
+ );
+ cy.log('should render correct headings')
+ cy.get('[data-test="order-history-link"]').should('have.text', 'View your order history').and('have.attr', 'href', '/XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ')
+ cy.get('[class="local-header__heading"]').should('have.text', 'Your quote')
+ cy.get('[data-test="subheading"]').should('have.text', 'Order reference RYM547/24 for Canada')
+ cy.get('[data-test="metalist-quote"]').should('contain', 'We sent it on').and('contain', format(new Date(), formats.dateLong)).and('contain', 'You accepted it on')
+
+ cy.log('should render quote')
+ cy.get('[data-test="quote"]').should('contain', `Date: ${format(new Date(), formats.dateLong)}`)
+ .and('contain', 'Quote for the Provision of an Overseas Market Introduction Service (“OMIS”): RYM547/24 (the Quote)')
+ .and('contain', 'Motorleaf Global HQ of 5000 Rue Saint-Patrick, Montréal, H4E 1A8, Canada')
+ .and('contain', 'DBT will deliver the Services on or before the Delivery Date which shall be 7 May 2030')
+ .and('contain', 'The Customer Contact shall be Johnny Cakeman of Motorleaf Global HQ, 5000 Rue Saint-Patrick, Montréal, H4E 1A8, Canada and johnny@cakeman.com.')
+ .and('contain', `This Quote must be accepted by you by ${format(addMonths(new Date(), 1), formats.dateLong)}.`)
+
+ cy.log('should not display the acceptance elements')
+ cy.get('[data-test="field-confirm-1"]').should('not.exist')
+ cy.get('[data-test="accept-quote-button"]').should('not.exist')
+ cy.get('[data-test="reveal-quote-problem"]').should('not.exist')
+ })
+});
\ No newline at end of file
diff --git a/test/end-to-end/cypress/quote-spec.cy.js b/test/end-to-end/cypress/quote-spec.cy.js
deleted file mode 100644
index 8c31539..0000000
--- a/test/end-to-end/cypress/quote-spec.cy.js
+++ /dev/null
@@ -1,11 +0,0 @@
-describe("quote spec", () => {
- it("visits OMIS order page", () => {
- cy.visit(
- "http://localhost:4000/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA"
- );
- cy.get("h1").should("exist").and("have.text", "Your order");
- cy.get('[class="button"]')
- .should("exist")
- .and("contain", "Review your quote");
- });
-});