Skip to content

tests: add not-found page tests#925

Merged
carlosthe19916 merged 1 commit intoguacsec:mainfrom
carlosthe19916:tests/not-found
Feb 18, 2026
Merged

tests: add not-found page tests#925
carlosthe19916 merged 1 commit intoguacsec:mainfrom
carlosthe19916:tests/not-found

Conversation

@carlosthe19916
Copy link
Copy Markdown
Collaborator

@carlosthe19916 carlosthe19916 commented Feb 16, 2026

In case there are resources non existent or a page not defined in the UI the NotFound Page should be rendered. This PR should cover that scenario

One test is disable on purpose because the rest api for packages does not generate 404 NotFound HTTP response as reported here https://issues.redhat.com/browse/TC-3626

image

Summary by Sourcery

Add end-to-end coverage for the UI 404 Not Found page across undefined and non-existent resource routes.

Tests:

  • Add Playwright E2E tests verifying the Not Found page renders for undefined routes and non-existent advisories, SBOMs, and vulnerabilities.
  • Introduce a skipped test documenting the expected 404 behavior for non-existent packages pending backend support.

Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 16, 2026

Reviewer's Guide

Adds Playwright end-to-end tests to verify the UI Not Found page is rendered for various missing or undefined resources, with one package-related test intentionally skipped due to a known backend limitation.

File-Level Changes

Change Details Files
Add Playwright E2E coverage for the 404 Not Found page across several resource types, including an intentionally skipped package test due to a known backend issue.
  • Introduce a shared NOT_EXISTENT_UUID constant representing a guaranteed non-existent resource ID for testing.
  • Add a reusable expectNotFound helper that asserts the 404 heading and explanatory text are visible on the page.
  • Ensure each test logs in via the shared login helper before navigation using a beforeEach hook.
  • Add tests that navigate to undefined or non-existent advisory, SBOM, and vulnerability routes and assert the Not Found page is shown.
  • Add a skipped test for non-existent package routes, with a comment referencing the tracking issue for enabling it later.
e2e/tests/ui/pages/not-found/not-found.spec.ts

Possibly linked issues

  • #: PR implements the Phase 3 Not Found page E2E tests from the plan, validating 404 rendering for invalid routes.

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

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `e2e/tests/ui/pages/not-found/not-found.spec.ts:44-47` </location>
<code_context>
+    await expectNotFound(page);
+  });
+
+  // Enable this test when https://issues.redhat.com/browse/TC-3626 is fixed
+  test.skip("Shows 404 page for non-existent package", async ({ page }) => {
+    await page.goto(`/packages/${NON_EXISTENT_UUID}`);
+    await expectNotFound(page);
</code_context>

<issue_to_address>
**suggestion (testing):** Consider tying the skipped test more explicitly to the external issue or using `test.fixme` for a known-broken scenario

Given this is a known backend issue (TC-3626), consider using `test.fixme` instead of `test.skip`, or annotating it (e.g. `@known-failure`) so it’s clearly surfaced in reports and easier to track/reenable once the backend is fixed.

```suggestion
  // FIXME(TC-3626): Backend currently does not return 404 for non-existent package.
  // Re-enable once https://issues.redhat.com/browse/TC-3626 is resolved.
  test.fixme("Shows 404 page for non-existent package (TC-3626)", async ({ page }) => {
    await page.goto(`/packages/${NON_EXISTENT_UUID}`);
    await expectNotFound(page);
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.14%. Comparing base (2712cf5) to head (c8e3e3b).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #925      +/-   ##
==========================================
- Coverage   64.86%   64.14%   -0.72%     
==========================================
  Files         195      195              
  Lines        3341     3341              
  Branches      753      753              
==========================================
- Hits         2167     2143      -24     
- Misses        878      905      +27     
+ Partials      296      293       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@mrrajan mrrajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carlosthe19916 carlosthe19916 added this pull request to the merge queue Feb 18, 2026
Merged via the queue into guacsec:main with commit e469709 Feb 18, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this to Done in Trustify Feb 18, 2026
mrrajan pushed a commit to mrrajan/trustify-ui that referenced this pull request Mar 2, 2026
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants