-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a3dabe
commit 33203d7
Showing
7 changed files
with
130 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
{% extends '_layouts/invoice.njk' %} | ||
|
||
{% block invoice_payment_information %} | ||
<h3>Payment terms</h3> | ||
<h3 data-test="payment-terms">Payment terms</h3> | ||
|
||
<p>Payable by {{ invoice.payment_due_date | formatDate }} ({{ invoice.payment_due_date | fromNow }}).</p> | ||
<p data-test="due-date">Payable by {{ invoice.payment_due_date | formatDate }} ({{ invoice.payment_due_date | fromNow }}).</p> | ||
|
||
<h3>How to pay by credit or debit card</h3> | ||
<h3 data-test="pay-by-card">How to pay by credit or debit card</h3> | ||
|
||
<p>You can pay online using the government’s secure payment service.</p> | ||
|
||
<p> | ||
<a href="/{{ publicToken }}/payment/card">Pay by credit or debit card</a> | ||
<a href="/{{ publicToken }}/payment/card" data-test="pay-by-card-link">Pay by credit or debit card</a> | ||
</p> | ||
|
||
<h3>How to pay by bank transfer</h3> | ||
<h3 data-test="pay-by-bank-transfer">How to pay by bank transfer</h3> | ||
|
||
{% include '_includes/bank-transfer-instructions.njk' %} | ||
|
||
<h3>In case of problems</h3> | ||
<h3 data-test="if-problem">In case of problems</h3> | ||
|
||
<p>Get in touch with your DBT contact or email <a href="mailto:[email protected]">[email protected]</a>.</p> | ||
<p>Get in touch with your DBT contact or email <a href="mailto:[email protected]" data-test="email-link">[email protected]</a>.</p> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { acceptedQuote } from "../test-data"; | ||
|
||
describe("Invoice spec", () => { | ||
const order = acceptedQuote; | ||
|
||
context("Link to invoice page", () => { | ||
it("should take you to the invoice page when clicking 'the invoice' link", () => { | ||
cy.visit(`http://localhost:4000/${order.public_token}`); | ||
cy.get('[data-test="invoice-link"]').click(); | ||
cy.get('[data-test="heading"]') | ||
.should("exist") | ||
.and("have.text", "Invoice"); | ||
}); | ||
|
||
it("should take you to the invoice page when clicking 'View your invoice'", () => { | ||
cy.visit(`http://localhost:4000/${order.public_token}`); | ||
cy.get('[data-test="view-invoice-link"]').click(); | ||
cy.get('[data-test="heading"]') | ||
.should("exist") | ||
.and("have.text", "Invoice"); | ||
}); | ||
}); | ||
|
||
context("When on the invoice page", () => { | ||
beforeEach(() => { | ||
cy.visit(`http://localhost:4000/${order.public_token}/invoice`); | ||
}); | ||
|
||
it("should show the address of the company the invoice is for", () => { | ||
cy.contains("To") | ||
.should("exist") | ||
.parent() | ||
.and("contain", order.billing_company_name) | ||
.and("contain", order.billing_address_town) | ||
.and("contain", order.billing_address_1) | ||
.and("contain", order.billing_address_postcode) | ||
.and("contain", order.billing_address_country); | ||
}); | ||
|
||
it("should show the invoice number and an invoice date", () => { | ||
cy.contains("Invoice number").should("exist"); | ||
cy.contains("Invoice date").should("exist"); | ||
}); | ||
|
||
it("should show the address that the invoice has been sent from and the vat number", () => { | ||
cy.contains("From").should("exist"); | ||
cy.contains("VAT number").should("exist"); | ||
}); | ||
|
||
it("should show the table with the order number, the description and the amount", () => { | ||
cy.get('[data-test="cost-table"]') | ||
.should("exist") | ||
.and("contain", order.reference) | ||
.and("contain", `UK Government support in ${order.primary_market.name}`) | ||
.and("contain", order.subtotal_cost); | ||
}); | ||
|
||
it("should show payment terms with date invoice is due by", () => { | ||
cy.get('[data-test="payment-terms"]').should( | ||
"have.text", | ||
"Payment terms" | ||
); | ||
cy.get('[data-test="due-date"]').should("exist"); | ||
}); | ||
|
||
it("should show how to pay by credit card with link to pay by this method", () => { | ||
cy.get('[data-test="pay-by-card"]').should( | ||
"have.text", | ||
"How to pay by credit or debit card" | ||
); | ||
cy.get('[data-test="pay-by-card-link') | ||
.should("have.text", "Pay by credit or debit card") | ||
.and("have.attr", "href", `/${order.public_token}/payment/card`); | ||
}); | ||
|
||
it("should show how to pay by bank transfer with the amount owed", () => { | ||
cy.get('[data-test="pay-by-bank-transfer"]').should( | ||
"have.text", | ||
"How to pay by bank transfer" | ||
); | ||
cy.get('[data-test="order-total-cost"]') | ||
.should("exist") | ||
.and("contain", order.total_cost); | ||
cy.get('[data-test="reference"]') | ||
.should("exist") | ||
.and("contain", order.reference); | ||
}); | ||
|
||
it("should show in case of problem section with and email link", () => { | ||
cy.get('[data-test="if-problem"]').should( | ||
"have.text", | ||
"In case of problems" | ||
); | ||
cy.get('[data-test="email-link"]') | ||
.should("have.text", "[email protected]") | ||
.and("have.attr", "href", "mailto:[email protected]"); | ||
}); | ||
|
||
it("should take you to the order history page when clicking 'View your order history' link", () => { | ||
cy.get('[data-test="view-order-history-link"]') | ||
.should("exist") | ||
.click() | ||
.location("pathname") | ||
.should("eq", `/${order.public_token}`); | ||
|
||
cy.contains("Your order").should("exist"); | ||
}); | ||
|
||
it("should have a 'Print this page' link", () => { | ||
cy.contains("Print this page").should("exist"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters