How to Test Cookie Consent on Web (Complete Guide)

Cookie consent is a crucial aspect of Web app development, as it directly impacts user experience and compliance with regulations like GDPR and CCPA. Failure to properly implement cookie consent can r

May 07, 2026 · 3 min read · How-To Guides

Introduction to Cookie Consent Testing

Cookie consent is a crucial aspect of Web app development, as it directly impacts user experience and compliance with regulations like GDPR and CCPA. Failure to properly implement cookie consent can result in fines, damage to reputation, and loss of user trust. Common failures include inadequate notice, lack of user control, and insufficient documentation.

What to Test

The following test cases cover various scenarios to ensure comprehensive testing of cookie consent:

+ User accepts all cookies

+ User accepts necessary cookies only

+ User rejects all cookies

+ User closes the cookie consent banner without making a choice

+ User navigates away from the page without interacting with the cookie consent banner

+ Cookie consent banner does not display on subsequent visits

+ User has cookies disabled in their browser

+ User is using a browser that does not support cookies

+ Cookie consent banner is not accessible on smaller screens or devices

+ Cookie consent banner is readable by screen readers

+ Cookie consent banner can be navigated using keyboard only

+ High contrast mode is supported for users with visual impairments

+ Cookie consent banner is translated for users with different languages

Manual Testing Approach

To manually test cookie consent, follow these steps:

  1. Launch the Web app: Open the Web app in a browser and verify that the cookie consent banner is displayed.
  2. Interact with the cookie consent banner: Test each of the happy path scenarios, error scenarios, and edge cases.
  3. Verify cookie storage: Use the browser's developer tools to verify that cookies are being stored correctly based on the user's choices.
  4. Test accessibility: Use a screen reader and keyboard-only navigation to verify that the cookie consent banner is accessible.
  5. Repeat testing on different devices and browsers: Test the cookie consent banner on different devices, browsers, and screen sizes to ensure it is displayed and functions correctly.

Automated Testing Approach

Automated testing can be performed using tools like Playwright or Selenium. Here's an example of how to automate testing of cookie consent using Playwright:


const { test, expect } = require('@playwright/test');

test('cookie consent banner is displayed', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page.locator('cookie-consent-banner')).toBeVisible();
});

test('user can accept all cookies', async ({ page }) => {
  await page.goto('https://example.com');
  await page.locator('accept-all-cookies-button').click();
  await expect(page.locator('cookie-consent-banner')).not.toBeVisible();
});

To integrate automated testing into a CI/CD pipeline, use a tool like GitHub Actions. Here's an example of how to configure a GitHub Actions workflow to run Playwright tests:


name: Playwright Tests
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install dependencies
        run: npm install
      - name: Run Playwright tests
        run: npx playwright test

Autonomous Testing with SUSA

SUSA's autonomous testing platform can test cookie consent without the need for manual scripts. The curious persona catches issues related to cookie consent banner display and functionality, while the accessibility persona catches issues related to accessibility and screen reader compatibility. The adversarial persona catches issues related to error scenarios and edge cases.

SUSA's testing includes:

By using SUSA's autonomous testing platform, developers can ensure that their cookie consent implementation is comprehensive, accessible, and compliant with regulations.

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free