-
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.
Merge pull request #1976 from UK-Export-Finance/fix/EMS-2873
fix(EMS-2873): Cookies consent banner - "view cookies" link
- Loading branch information
Showing
10 changed files
with
135 additions
and
31 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
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
82 changes: 82 additions & 0 deletions
82
e2e-tests/insurance/cypress/e2e/journeys/cookies-consent/cookies-consent.spec.js
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,82 @@ | ||
import partials from '../../../../../partials'; | ||
import { COOKIES_CONSENT } from '../../../../../content-strings'; | ||
import { INSURANCE_ROUTES } from '../../../../../constants/routes/insurance'; | ||
|
||
const { COOKIES, ROOT } = INSURANCE_ROUTES; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
context('Insurance - Cookies consent - initial/default', () => { | ||
const rootUrl = `${baseUrl}${ROOT}`; | ||
|
||
beforeEach(() => { | ||
cy.clearCookies(); | ||
cy.navigateToUrl(rootUrl); | ||
}); | ||
|
||
it('should render a link to cookies', () => { | ||
cy.checkLink( | ||
partials.cookieBanner.cookiesLink(), | ||
COOKIES, | ||
COOKIES_CONSENT.QUESTION.VIEW_COOKIES, | ||
); | ||
}); | ||
|
||
it(`should redirect to ${COOKIES} when clicking cookies link`, () => { | ||
partials.cookieBanner.cookiesLink().click(); | ||
|
||
const expectedUrl = `${baseUrl}${COOKIES}`; | ||
|
||
cy.assertUrl(expectedUrl); | ||
}); | ||
|
||
describe('when clicking `accept cookies` button', () => { | ||
beforeEach(() => { | ||
cy.clearCookies(); | ||
cy.navigateToUrl(rootUrl); | ||
|
||
partials.cookieBanner.question.acceptButton().click(); | ||
}); | ||
|
||
it(`should render 'accepted' banner with link to ${COOKIES}`, () => { | ||
cy.checkLink( | ||
partials.cookieBanner.cookiesLink(), | ||
COOKIES, | ||
COOKIES_CONSENT.COOKIES_LINK, | ||
); | ||
}); | ||
|
||
it(`should redirect to ${COOKIES} when clicking cookies link`, () => { | ||
partials.cookieBanner.cookiesLink().click(); | ||
|
||
const expectedUrl = `${baseUrl}${COOKIES}`; | ||
|
||
cy.assertUrl(expectedUrl); | ||
}); | ||
}); | ||
|
||
describe('when clicking `reject cookies` button', () => { | ||
beforeEach(() => { | ||
cy.clearCookies(); | ||
cy.navigateToUrl(rootUrl); | ||
|
||
partials.cookieBanner.question.rejectButton().click(); | ||
}); | ||
|
||
it(`should render 'rejected' banner with link to ${COOKIES}`, () => { | ||
cy.checkLink( | ||
partials.cookieBanner.cookiesLink(), | ||
COOKIES, | ||
COOKIES_CONSENT.COOKIES_LINK, | ||
); | ||
}); | ||
|
||
it(`should redirect to ${COOKIES} when clicking cookies link`, () => { | ||
partials.cookieBanner.cookiesLink().click(); | ||
|
||
const expectedUrl = `${baseUrl}${COOKIES}`; | ||
|
||
cy.assertUrl(expectedUrl); | ||
}); | ||
}); | ||
}); |
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
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