Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for cookies page #529

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/app/views/cookies.njk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends '_layouts/omis-base.njk' %}

{% block body_main_content %}
<h1>Cookies</h1>
<h1 data-test="header-cookies">Cookies</h1>

<p>GOV.UK puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site.</p>
<p data-test="paragraph-cookie-info">GOV.UK puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site.</p>

<p>Cookies are used to:</p>
<p data-test="paragraph-cookie-useage">Cookies are used to:</p>

<ul>
<li>measure how you use the website so it can be updated and improved based on your needs</li>
Expand All @@ -16,15 +16,15 @@
<p>GOV.UK cookies aren’t used to identify you personally.</p>
{% endcall %}

<p>You’ll normally see a message on the site before we store a cookie on your computer.</p>
<p data-test="paragraph-description">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 data-test="cookies-link" rel="external" href="https://ico.org.uk/for-the-public/online/cookies/">how to manage cookies</a>.</p>

<h2>How cookies are used on GOV.UK</h2>
<h2 data-test="header-title-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/" data-test="google-analytics-link">improving site search</a>.</p>

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

Expand All @@ -43,9 +43,9 @@

<p>Google Analytics sets the following cookies:</p>

<h3>Universal Analytics</h3>
<h3 data-test="header-universal-analytics">Universal Analytics</h3>

<table>
<table data-test="table-universal-analytics">
<thead>
<tr>
<th>Name</th>
Expand Down Expand Up @@ -74,7 +74,7 @@

<h3>Google Analytics</h3>

<table>
<table data-test="table-google-analytics">
<thead>
<tr>
<th>Name</th>
Expand Down Expand Up @@ -110,7 +110,7 @@

<p>You may see a pop-up welcome message when you first visit GOV.UK. We’ll store a cookie so that your computer knows you’ve seen it and knows not to show it again.</p>

<table>
<table data-test="table-introductory-message">
<thead>
<tr>
<th>Name</th>
Expand All @@ -131,7 +131,7 @@

<p>If you choose to pay by credit or debit card we need to store a cookie for your payment session. The content of this is encrypted and never shared.</p>

<table>
<table data-test="table-pay-by-card">
<thead>
<tr>
<th>Name</th>
Expand Down
51 changes: 51 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,51 @@
describe("Omis Cookie Spec", () => {
context("cookies spec", () => {
beforeEach(() => {
cy.visit("http://localhost:4000/cookies");
});
it("visits cookies page", () => {
cy.get('[data-test="header-cookies"]')
.should("exist")
.and("have.text", "Cookies");

cy.get('[data-test="paragraph-cookie-info"]')
.should("exist")
.and(
"have.text",
"GOV.UK puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site."
);
cy.get('[data-test="paragraph-cookie-useage"]')
.should("exist")
.and("have.text", "Cookies are used to:");
});
it("should click the 'How to manage cookies link'", () => {
cy.get('[data-test="header-title-cookies"]')
.should("exist")
.and("have.text", "How cookies are used on GOV.UK");
cy.get('[data-test="cookies-link"]')
.should("exist")
.and("contain", "how to manage cookies")
.click();
});
it("should click the Google analytics external link", () => {
cy.get('[data-test="google-analytics-link"]')
.should("exist")
.and("contain", "improving site search")
.click();
});

it("should display information for universal analytics table", () => {
cy.get('[data-test="table-universal-analytics"]').should("exist");
});
it("should display information for google analytics table", () => {
cy.get('[data-test="table-google-analytics"]').should("exist");
});
it("should display information for introductory message table", () => {
cy.get('[data-test="table-introductory-message"]').should("exist");
});

it("should display information for paying by credit or debit card table", () => {
cy.get('[data-test="table-pay-by-card"]').should("exist");
});
});
});