Skip to content

Commit

Permalink
Add test for quote accepted page
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsunkel committed Apr 26, 2024
1 parent 2c08cd4 commit 78bb9f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/views/quote-accepted.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set hideReturnLink = true %}

{% block main_content %}
<div class="confirmation-banner">
<div class="confirmation-banner" data-test="confirmation-banner">
<h1 class="confirmation-banner__heading">
Quote accepted
</h1>
Expand All @@ -16,11 +16,11 @@

<h3>What happens next</h3>

<p>You will receive a confirmation email that the quote has been accepted.</p>
<p data-test="confirmation-text">You will receive a confirmation email that the quote has been accepted.</p>

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

<p>
<a href="/{{ publicToken }}">View your order history</a>
<a href="/{{ publicToken }}" data-test="order-history-link">View your order history</a>
</p>
{% endblock %}
20 changes: 20 additions & 0 deletions test/end-to-end/cypress/quote-accepted-spec.cy.js
Original file line number Diff line number Diff line change
@@ -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')
})
})

0 comments on commit 78bb9f9

Please sign in to comment.