From 78bb9f9010539b0f2dd877cbaa89fc066f625894 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 26 Apr 2024 15:27:23 +0100 Subject: [PATCH] Add test for quote accepted page --- src/app/views/quote-accepted.njk | 6 +++--- .../cypress/quote-accepted-spec.cy.js | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 test/end-to-end/cypress/quote-accepted-spec.cy.js diff --git a/src/app/views/quote-accepted.njk b/src/app/views/quote-accepted.njk index 1c305f8..e7a5cc1 100644 --- a/src/app/views/quote-accepted.njk +++ b/src/app/views/quote-accepted.njk @@ -3,7 +3,7 @@ {% set hideReturnLink = true %} {% block main_content %} -
+

Quote accepted

@@ -16,11 +16,11 @@

What happens next

-

You will receive a confirmation email that the quote has been accepted.

+

You will receive a confirmation email that the quote has been accepted.

{% include '_includes/payment-instructions.njk' %}

- View your order history + View your order history

{% endblock %} 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..656b957 --- /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/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA/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', 'WHY589/23') + 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', '/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA/payment') + cy.get('[data-test="order-history-link"]').should('have.text', 'View your order history').and('have.attr', 'href', '/7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA') + }) +}) \ No newline at end of file