Skip to content

Add Playwright tests for Vulnerability UI#2567

Draft
niyazRedhat wants to merge 1 commit intoRedHatInsights:masterfrom
niyazRedhat:playwright-tests
Draft

Add Playwright tests for Vulnerability UI#2567
niyazRedhat wants to merge 1 commit intoRedHatInsights:masterfrom
niyazRedhat:playwright-tests

Conversation

@niyazRedhat
Copy link
Copy Markdown

@niyazRedhat niyazRedhat commented Apr 20, 2026

Summary

  • Add _playwright-tests/ folder with Playwright tests for Vulnerability UI
  • Navigation smoke tests for CVEs, Systems, and Reports pages
  • Helper utilities for login, navigation, and fixtures
  • playwright.config.js with Chromium, proxy support, and retry config
  • playwright_example.env template for environment setup

Test coverage

  • test_navigation.test.ts — navigation smoke tests (CVEs, Systems, Reports pages)
  • test_cves.test.ts — CVEs page filter, search, pagination tests

How to run

See _playwright-tests/README.md for full setup instructions.

Status

🚧 WIP — tests being stabilized, not ready for review yet

Summary by Sourcery

Add Playwright-base testing support for the Vulnerability UI, including configuration, helpers, and navigation coverage for key pages.

Build:

  • Add Playwright and dotenv dev dependencies and npm scripts for running, debugging, and reporting Playwright test runs.

Tests:

  • Introduce a Playwright test suite for Vulnerability UI with shared helpers, fixtures, and navigation and CVEs page coverage.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 20, 2026

Reviewer's Guide

Adds a Playwright-based end-to-end test suite for the Vulnerability UI, including configuration, helpers, auth bootstrap, and npm scripts to run the tests with environment-driven base URL and proxy settings.

Sequence diagram for Playwright auth setup and test execution

sequenceDiagram
  actor Dev
  participant NPM as NPM_Scripts
  participant PW as Playwright_CLI
  participant CFG as Playwright_Config
  participant SETUP as AuthSetup_Test
  participant APP as Vulnerability_UI_App
  participant STATE as StorageState_File
  participant TESTS as Chromium_Tests

  Dev->>NPM: run test:playwright
  NPM->>PW: invoke playwright test
  PW->>CFG: load configuration
  CFG-->>PW: projects setup, chromium

  PW->>SETUP: run setup project tests
  SETUP->>APP: navigate to BASE_URL and perform login
  APP-->>SETUP: returns authenticated session
  SETUP->>STATE: save storageState to .auth/admin_user.json
  SETUP-->>PW: setup complete

  PW->>TESTS: run chromium project tests
  TESTS->>STATE: load storageState
  TESTS->>APP: open Vulnerability UI pages (CVEs, Systems, Reports)
  APP-->>TESTS: render pages for assertions

  TESTS-->>PW: report results
  PW-->>Dev: output report (HTML/JSON or list)
Loading

Class diagram for the new Playwright test modules

classDiagram
  class PlaywrightConfig {
  }

  class AuthSetup {
  }

  class ConstantsHelper {
  }

  class FixturesHelper {
  }

  class LoginHelpers {
  }

  class NavHelpers {
  }

  class TestNavigation {
  }

  class TestCVEs {
  }

  PlaywrightConfig <.. AuthSetup : defines_project_setup
  PlaywrightConfig <.. TestNavigation : configures_project
  PlaywrightConfig <.. TestCVEs : configures_project

  AuthSetup --> FixturesHelper : uses_fixtures
  AuthSetup --> LoginHelpers : uses_login_helpers

  FixturesHelper --> LoginHelpers : composes
  FixturesHelper --> NavHelpers : composes
  FixturesHelper --> ConstantsHelper : uses_constants

  TestNavigation --> FixturesHelper : uses
  TestNavigation --> NavHelpers : uses
  TestNavigation --> ConstantsHelper : uses

  TestCVEs --> FixturesHelper : uses
  TestCVEs --> NavHelpers : uses
  TestCVEs --> ConstantsHelper : uses
Loading

File-Level Changes

Change Details Files
Introduce Playwright E2E test infrastructure and configuration for Vulnerability UI.
  • Add Playwright test runner dependency and dotenv for env-based configuration
  • Create Playwright config with CI-friendly retries, reporting, proxy support, and an auth bootstrap project
  • Add npm scripts to run Playwright tests in various modes (CLI, headed, debug, UI, report)
package.json
package-lock.json
playwright.config.js
Add Playwright helpers and fixtures for auth, navigation, and popup handling.
  • Implement login helpers that validate required env vars, perform Red Hat SSO login, and persist storage state/auth token
  • Add helpers for closing cookie and Pendo popups and ensuring preview mode is disabled
  • Provide constants for core Vulnerability routes, headings, and common filter labels
  • Create a custom Playwright test fixture that auto-closes popups before using the page fixture
_playwright-tests/helpers/loginHelpers.ts
_playwright-tests/helpers/navHelpers.ts
_playwright-tests/helpers/constants.ts
_playwright-tests/helpers/fixtures.ts
Add Vulnerability UI Playwright test suite skeleton and documentation.
  • Document Playwright tests folder structure, environment setup, auth flow, and selector guidelines
  • Introduce auth setup test that logs in once and stores session state for dependent tests
  • Add initial navigation and CVEs page tests (filters, search, pagination) and example env file for configuration
_playwright-tests/README.md
_playwright-tests/auth.setup.ts
_playwright-tests/test_navigation.test.ts
_playwright-tests/test_cves.test.ts
playwright_example.env

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@niyazRedhat niyazRedhat force-pushed the playwright-tests branch 4 times, most recently from 5bf9d5e to 9757b3e Compare April 21, 2026 11:10
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