From 92bdf471e8b487ccc0ca963fa2b11f4a777986a5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 6 Feb 2026 05:24:06 +0000 Subject: [PATCH] fix: correct i18n mock in CrowdSec tests and silence query warning - Added [ready: true](http://_vscodecontentref_/6) to [react-i18next](http://_vscodecontentref_/7) mock in CrowdSecBouncerKeyDisplay tests to prevent infinite loading state - Mocked [getCrowdsecKeyStatus](http://_vscodecontentref_/8) in Security page tests to resolve "Query data cannot be undefined" warning - Ensures all Security dashboard related tests pass reliably without console errors --- docs/plans/fix_e2e_failures.md | 45 ++ frontend/package-lock.json | 396 ++++++++---------- frontend/package.json | 2 +- .../CrowdSecBouncerKeyDisplay.test.tsx | 1 + .../src/pages/__tests__/Security.spec.tsx | 6 + 5 files changed, 230 insertions(+), 220 deletions(-) create mode 100644 docs/plans/fix_e2e_failures.md diff --git a/docs/plans/fix_e2e_failures.md b/docs/plans/fix_e2e_failures.md new file mode 100644 index 00000000..0c108049 --- /dev/null +++ b/docs/plans/fix_e2e_failures.md @@ -0,0 +1,45 @@ +# Plan: Fix E2E Test Failures + +## Objective +Fix implementation bugs and test logic issues causing failures in `certificates.spec.ts`, `navigation.spec.ts`, and `proxy-acl-integration.spec.ts`. + +## Analysis of Failures + +### 1. Certificates Test (`tests/core/certificates.spec.ts`) +- **Failure**: Fails to assert "Domain" column header. Received `undefined`. +- **Root Cause**: Race condition. The test attempts to valid header text before the table has finished rendering (likely while in Loading or Empty state). +- **Fix**: explicit wait for the table element to be visible before asserting headers. + +### 2. Navigation Test (`tests/core/navigation.spec.ts`) +- **Failure**: Sidebar expected to be hidden on mobile but is detected as visible. +- **Root Cause**: The Sidebar implementation in `Layout.tsx` uses CSS transforms (`-translate-x-full`) to hide the menu on mobile. Playwright's `.toBeVisible()` matcher considers elements with `opacity: 1` and non-zero size as "visible", even if translated off-screen. +- **Fix**: Update the assertion to check that the sidebar is hidden from the viewport OR check for the presence of the `-translate-x-full` class. + +### 3. Proxy ACL Integration (`tests/integration/proxy-acl-integration.spec.ts`) +- **Failure**: Timeout waiting for `select[name="access_list_id"]`. +- **Root Cause**: The `AccessListSelector.tsx` component renders a standard `` element. + - Add `id="access_list_id"` to the `