Skip to content

Commit

Permalink
add test for cookies page
Browse files Browse the repository at this point in the history
  • Loading branch information
bau123 committed Apr 25, 2024
1 parent c4f182e commit faa37c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/views/cookies.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

<p>You’ll normally see a message on the site before we store a cookie on your computer.</p>

<p>Find out more about <a rel="external" href="https://ico.org.uk/for-the-public/online/cookies/">how to manage cookies</a>.</p>
<p>Find out more about <a rel="external" href="https://ico.org.uk/for-the-public/online/cookies/" class="cookies-link">how to manage cookies</a>.</p>

<h2>How cookies are used on GOV.UK</h2>
<h2 class="header-cookies">How cookies are used on GOV.UK</h2>

<h3>Measuring website usage (Google Analytics)</h3>

<p>We use Google Analytics software to collect information about how you use GOV.UK. We do this to help make sure the site is meeting the needs of its users and to help us make improvements, for example <a rel="external" href="https://insidegovuk.blog.gov.uk/2015/03/26/new-tool-to-see-trending-searches/">improving site search</a>.</p>
<p>We use Google Analytics software to collect information about how you use GOV.UK. We do this to help make sure the site is meeting the needs of its users and to help us make improvements, for example <a rel="external" href="https://insidegovuk.blog.gov.uk/2015/03/26/new-tool-to-see-trending-searches/" class="google-analytics-link">improving site search</a>.</p>

<p>Google Analytics stores information about:</p>

Expand Down
25 changes: 25 additions & 0 deletions test/end-to-end/cypress/cookies-spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe("Omis Cookie Spec", () => {
context("cookies spec", () => {
beforeEach(() => {
cy.visit("http://localhost:4000/cookies");
});
it("visits cookies page", () => {
cy.get("h1").should("exist").and("have.text", "Cookies");
});
it("should click the 'How to manage cookies link'", () => {
cy.get('[class="header-cookies"]')
.should("exist")
.and("have.text", "How cookies are used on GOV.UK");
cy.get('[class="cookies-link"]')
.should("exist")
.and("contain", "how to manage cookies")
.click();
});
it("should click the Google analytics external link", () => {
cy.get('[class="google-analytics-link"]')
.should("exist")
.and("contain", "improving site search")
.click();
});
});
});

0 comments on commit faa37c9

Please sign in to comment.