@commercetools-frontend/cypress-cookie-consent

1.0.23 • Public • Published

@commercetools-frontend/cypress-cookie-consent

This package allows to set a cookie consent cookie using the @commercetools-frontend/cypress-cookie-consent package.

Installation

$ npm install --save @commercetools-frontend/cypress-cookie-consent

Usage

You need to extend your Cypress commands. You might have an e2e.ts file containing your library and custom commands. If so add this to it:

import '@commercetools-frontend/cypress-cookie-consent/add-commands';

This will register a setConsentCookie on Cypress which you can invoke as cy.setConsentCookie. It accepts an argument called commandOptions which has a property named consentGroups. The consent groups are the groups you want to give consent for, for your Cypress test. So in summary you may call it as:

cy.setConsentCookie({
  consentGroups: {
    essentialCookies: true,
    performanceCookies: true,
    functionalCookies: true,
    targetingCookies: true,
    socialMediaCookies: true,
  },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @commercetools-frontend/cypress-cookie-consent

Weekly Downloads

1,052

Version

1.0.23

License

MIT

Unpacked Size

6.29 kB

Total Files

12

Last publish

Collaborators

  • tdeekens
  • emmenko
  • commercetools-admin