mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Implements a cookie consent banner and settings modal for GDPR compliance, allowing users to manage preferences for analytics and monitoring cookies. Integrates consent checks with Sentry, Vercel Analytics, and Google Analytics, ensuring tracking is only enabled with user permission. Refactors dialog components for improved layout and adds consent management utilities and hooks. #### For code changes: - [x] Banner appears at bottom of page on first visit with rounded corners and proper spacing (40px margins) - [x] Banner shows three buttons: "Reject All", "Settings", and "Accept All" - [x] Clicking "Accept All" hides banner and enables analytics/monitoring - [x] Clicking "Reject All" hides banner and keeps analytics/monitoring disabled - [x] Banner does not reappear after consent is given (check localStorage: `autogpt_cookie_consent`) **Cookie Settings Modal:** - [x] Clicking "Settings" button opens the Cookie Settings modal - [x] Modal displays three categories: Essential Cookies (always active), Analytics & Performance (toggle), Error Monitoring & Session Replay (toggle) - [x] Clicking "Save Preferences" saves custom settings and closes modal - [x] Clicking "Accept All" enables all cookies and closes modal - [x] Clicking "Reject All" disables optional cookies and closes modal - [x] Modal can be closed with X button or clicking outside **Consent Persistence:** - [x] Refresh page after giving consent - banner should not reappear - [x] Clear localStorage and refresh - banner should reappear - [x] Consent choices persist across browser sessions <img width="1123" height="126" alt="image" src="https://github.com/user-attachments/assets/7425efab-b5cc-4449-802d-0e12bd65053b" /> <img width="1124" height="372" alt="image" src="https://github.com/user-attachments/assets/2f28919a-97e8-44f5-9021-70d3836bb996" />
80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
/**
|
|
* Read environment variables from file.
|
|
* https://github.com/motdotla/dotenv
|
|
*/
|
|
import dotenv from "dotenv";
|
|
import path from "path";
|
|
dotenv.config({ path: path.resolve(__dirname, ".env") });
|
|
dotenv.config({ path: path.resolve(__dirname, "../backend/.env") });
|
|
/**
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: "./src/tests",
|
|
/* Global setup file that runs before all tests */
|
|
globalSetup: "./src/tests/global-setup.ts",
|
|
/* Run tests in files in parallel */
|
|
fullyParallel: true,
|
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
forbidOnly: !!process.env.CI,
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 1 : 0,
|
|
/* use more workers on CI. */
|
|
workers: process.env.CI ? 4 : undefined,
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
reporter: [["list"], ["html", { open: "never" }]],
|
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
use: {
|
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
baseURL: "http://localhost:3000/",
|
|
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
screenshot: "only-on-failure",
|
|
bypassCSP: true,
|
|
|
|
/* Helps debugging failures */
|
|
trace: "retain-on-failure",
|
|
video: "retain-on-failure",
|
|
|
|
/* Auto-accept cookies in all tests to prevent banner interference */
|
|
storageState: {
|
|
cookies: [],
|
|
origins: [
|
|
{
|
|
origin: "http://localhost:3000",
|
|
localStorage: [
|
|
{
|
|
name: "autogpt_cookie_consent",
|
|
value: JSON.stringify({
|
|
hasConsented: true,
|
|
timestamp: Date.now(),
|
|
analytics: true,
|
|
monitoring: true,
|
|
}),
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
/* Maximum time one test can run for */
|
|
timeout: 25000,
|
|
|
|
/* Configure web server to start automatically */
|
|
webServer: {
|
|
command: "pnpm start",
|
|
url: "http://localhost:3000",
|
|
reuseExistingServer: true,
|
|
},
|
|
|
|
/* Configure projects for major browsers */
|
|
projects: [
|
|
{
|
|
name: "chromium",
|
|
use: { ...devices["Desktop Chrome"], channel: "chromium" },
|
|
},
|
|
],
|
|
});
|