Skip to content

Conversation

carlosthe19916
Copy link
Contributor

@carlosthe19916 carlosthe19916 commented Aug 27, 2025

Although we can setup the initial upload of files though the API, doing it though the UI does not force users to enable the PLAYWRIGHT_AUTH_CLIENT_ID and PLAYWRIGHT_AUTH_URL environment variables.

As a side note. Doing the setup through the UI also indirectly tests the Upload pages.

Summary by Sourcery

Backport the UI global.setup from trustify-tests to configure initial SBOM and advisory data ingestion via the UI and update Playwright to run these setup steps before other tests.

New Features:

  • Add a new Playwright project "setup-ui-data" to run global.setup.ts for uploading SBOM and advisory files via the UI

Enhancements:

  • Update Playwright config to use "setup-ui-data" instead of "setup-api-data" for UI browser dependencies
  • Adjust the UI login helper to navigate to "/importers" and verify the Importers heading

Tests:

  • Introduce global.setup.ts in tests/ui/dependencies to ingest initial SBOM and advisory data through the UI

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

sourcery-ai bot commented Aug 27, 2025

Reviewer's Guide

This PR backports the UI global.setup from trustify-tests by introducing a dedicated Playwright project for UI-based data ingestion, updating UI test dependencies and login flow, and refining API setup logging to support initial SBOM and advisory uploads via the UI.

File-Level Changes

Change Details Files
Add Playwright 'setup-ui-data' project and update UI test dependencies
  • Define new 'setup-ui-data' project in the Playwright config with testDir and testMatch
  • Switch webkit and chromium projects to depend on 'setup-ui-data' instead of 'setup-api-data'
e2e/playwright.config.ts
Refine UI login helper to target Importers page
  • Navigate login helper to '/importers' rather than '/upload'
  • Update the post-login heading assertion to verify 'Importers'
e2e/tests/ui/helpers/Auth.ts
Implement UI-based global.setup for SBOM and advisory ingestion
  • Create global.setup.ts under tests/ui/dependencies to orchestrate uploads via the UI
  • Include environment skip flag, login step, navigation to baseURL, and SBOM/advisory upload functions
e2e/tests/ui/dependencies/global.setup.ts
Update API setup logging for clarity
  • Prefix existing log messages with 'Setup API:' to distinguish API setup steps
e2e/tests/api/dependencies/global.setup.ts

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

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.35%. Comparing base (b680e19) to head (ac86c0e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #686      +/-   ##
==========================================
+ Coverage   57.28%   59.35%   +2.06%     
==========================================
  Files         146      149       +3     
  Lines        2430     2465      +35     
  Branches      552      556       +4     
==========================================
+ Hits         1392     1463      +71     
+ Misses        833      789      -44     
- Partials      205      213       +8     

☔ 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.

Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
@carlosthe19916 carlosthe19916 added the backport release/0.3.z This PR should be backported to release/0.3.z branch. label Aug 27, 2025
@carlosthe19916 carlosthe19916 marked this pull request as ready for review August 27, 2025 09:40
Copy link

@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 there - I've reviewed your changes - here's some feedback:

  • In playwright.config.ts, make sure you update the dependencies for all UI test projects (e.g., Firefox) to use "setup-ui-data" so every browser runs the UI setup.
  • The uploadSboms and uploadAdvisories functions share a lot of logic; consider extracting the common file-upload flow into a shared helper to reduce duplication.
  • Avoid the non-null assertion on baseURL by providing a fallback or ensuring the environment always supplies it, rather than disabling the lint rule.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In playwright.config.ts, make sure you update the dependencies for all UI test projects (e.g., Firefox) to use "setup-ui-data" so every browser runs the UI setup.
- The uploadSboms and uploadAdvisories functions share a lot of logic; consider extracting the common file-upload flow into a shared helper to reduce duplication.
- Avoid the non-null assertion on baseURL by providing a fallback or ensuring the environment always supplies it, rather than disabling the lint rule.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release/0.3.z This PR should be backported to release/0.3.z branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant