Skip to content

[daily-playwright] Add tests for Admin Permissions Matrix - #16813

Draft
github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-09-15-c16d01564b7bdaaa
Draft

github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-09-15-c16d01564b7bdaaa

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

https://entire.io/gh/ohcnetwork/care_fe/trails/4

What was tested

This PR adds comprehensive test coverage for the Admin Permissions Matrix page (/admin/permissions), a previously untested administrative feature that displays all roles and their permissions in a matrix view.

Page Overview

The Permissions page shows:

  • A matrix table with all available permissions (rows) and roles (columns)
  • Visual indicators (✓ checkmark for granted, ✗ for not granted)
  • Role headers with rotation for space efficiency
  • Pagination support for large permission sets
  • Sticky headers and left column for horizontal/vertical scroll

Test Coverage Added

File: tests/admin/permissions/permissionsMatrix.spec.ts (9 test cases)

  1. Page load - Verifies the permissions matrix page loads with correct title and description
  2. Role headers - Confirms role headers render in the table with permission column
  3. Permission rows - Validates permission rows display with correct cell counts
  4. Permission indicators - Checks that checkmark and X icons render for permission status
  5. Pagination - Verifies pagination controls are present and functional
  6. API integration - Confirms the page fetches roles data from /api/.../roles endpoint
  7. Sticky layout - Validates sticky positioning on headers for scroll behavior
  8. Permission names - Ensures permission names display correctly in rows
  9. Empty state - Tests graceful handling of edge cases

Why this matters

  • Coverage gap filled: This was a completely untested admin page
  • Critical workflow: Permissions management is essential for role administration
  • User-facing feature: Helps verify the matrix layout renders correctly across browsers
  • Regression prevention: Tests ensure future changes don't break the permission matrix

How to run locally

# Run the new test file
npx playwright test tests/admin/permissions/permissionsMatrix.spec.ts

# Run with UI mode
npx playwright test tests/admin/permissions/permissionsMatrix.spec.ts --ui

# Run a specific test
npx playwright test tests/admin/permissions/permissionsMatrix.spec.ts -g "should load and display"

Test quality checklist

  • ✅ Uses role-based selectors (getByRole, getByText)
  • ✅ Avoids hard-coded CSS selectors (no .admin-table > div:nth-child(2))
  • ✅ Includes proper assertions for visibility and content
  • ✅ Handles loading states with appropriate timeouts
  • ✅ Tests both success paths and data validation
  • ✅ Independent tests with no shared state
  • ✅ Follows naming convention: (feature).spec.ts in feature directory

Closes #16803 (part of ongoing daily test coverage improvements)

AI generated by Daily Playwright Test Improver

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e5a2aab2-8b09-4a94-af5d-de833bb56c45

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

expect(iconCount).toBeGreaterThan(0);

// Verify we have both check-circle and x-circle icons
const checkIcons = page.locator("svg[aria-label], text:has-text('✓')");

// Check for pagination element (usually shows page info or navigation)
// The pagination is rendered by useFilters hook
const paginationContainer = page.locator("[role='navigation']");
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 79299ae
Status: ✅  Deploy successful!
Preview URL: https://d92d6d44.care-preview-a7w.pages.dev
Branch Preview URL: https://daily-playwright-2026-09-15.care-preview-a7w.pages.dev

View logs

@github-actions github-actions Bot added the stale label Sep 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants