Skip to content

chore(e2e): add Playwright annotations to all spec files#2394

Closed
zdrapela wants to merge 3 commits into
redhat-developer:mainfrom
zdrapela:add-playwright-annotations
Closed

chore(e2e): add Playwright annotations to all spec files#2394
zdrapela wants to merge 3 commits into
redhat-developer:mainfrom
zdrapela:add-playwright-annotations

Conversation

@zdrapela

@zdrapela zdrapela commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Add component and workspace annotations to every test.beforeAll block across all 27 E2E spec files (18 workspaces)
  • Update the existing annotation in keycloak's catalog-users.spec.ts to also include workspace
  • Update CLAUDE.md to document the annotation convention

Jira: https://redhat.atlassian.net/browse/RHIDP-13047

Annotation types

Type Description Purpose
component Always "plugins" Categorizes tests as plugin tests
workspace Workspace directory name (e.g., tech-radar, rbac) Links tests to their workspace for filtering and reporting

Approach chosen: runtime test.info().annotations.push() in beforeAll (Option B)

Annotations are pushed at the start of each test.beforeAll:

test.beforeAll(async ({ rhdh }) => {
  test.info().annotations.push(
    { type: "component", description: "plugins" },
    { type: "workspace", description: "my-workspace" },
  );
  // ...
});

Options evaluated

Option A: Declarative test.describe details parameter

  • Uses Playwright's details.annotation parameter on test.describe
  • Clean and declarative, but changes the test.describe call signature
  • Rejected: prettier reformats the entire test.describe(...) block when arguments are added, triggering pre-existing formatting issues across all files and failing CI

Option B (chosen): Runtime test.info().annotations.push() in beforeAll

  • Pushes annotations at runtime inside test.beforeAll
  • Minimal diff — only adds 4 lines per file, no existing lines changed
  • Does not trigger prettier reformatting of surrounding code
  • Already used in the keycloak workspace (extended to include workspace annotation)

Option C: Fixture-based injection in e2e-test-utils

  • Would auto-inject annotations from the rhdh fixture based on project/workspace name
  • Zero spec file changes, fully centralized
  • Rejected: requires a separate package release, over-engineering for static metadata

Why Option B

  • Adding the details parameter to test.describe (Option A) causes prettier to reformat the entire function call, surfacing pre-existing formatting issues across all files and failing CI
  • Option B inserts lines inside an existing block — no reformatting triggered
  • Already established pattern in the codebase (keycloak)

Changes

  • 27 spec files: Added test.info().annotations.push() as first statement in test.beforeAll
  • keycloak/catalog-users.spec.ts: First describe block gets new annotations push; second describe block's existing push updated to also include workspace annotation
  • CLAUDE.md: Updated "Standard Test Pattern" section with annotation convention and example

Add component and workspace annotations to every test.describe block
using Playwright's declarative details parameter. Remove the old
runtime annotation push from keycloak. Update CLAUDE.md to document
the convention.

Assisted-by: OpenCode
@zdrapela zdrapela force-pushed the add-playwright-annotations branch from 1d6b6ee to 5e86e39 Compare May 5, 2026 12:51
zdrapela added 2 commits May 5, 2026 14:55
Add component and workspace annotations to every test.beforeAll block
using test.info().annotations.push(). Update the existing annotation
in keycloak to also include the workspace. Update CLAUDE.md to
document the convention.

Assisted-by: OpenCode
@zdrapela zdrapela force-pushed the add-playwright-annotations branch from f13aae3 to 76037fd Compare May 5, 2026 14:48
@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

@zdrapela

Copy link
Copy Markdown
Member Author

@jrichter1 You were right - the check was failing, because there were indentation issues. I created this pre-commit hook to avoid similar issues in the future. #2397

@zdrapela zdrapela closed this May 11, 2026
@zdrapela

Copy link
Copy Markdown
Member Author

Closing this PR as this is implemented in e2e test utils: redhat-developer/rhdh-e2e-test-utils#99

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant