Skip to content

Conversation

@carlosthe19916
Copy link
Contributor

@carlosthe19916 carlosthe19916 commented Nov 18, 2025

  • Adds github workflows that should execute the playwright tests for each PR
  • Adds the e2e directory which should contain all e2e tests
    • No tests are added yet. Real tests will come in a separate PR

Summary by Sourcery

Integrate a Playwright end-to-end testing skeleton by configuring Docker, npm workspaces, GitHub workflows, and an example test

New Features:

  • Scaffold end-to-end testing setup with Playwright, including an e2e workspace, config, and example test

Enhancements:

  • Add e2e:test, e2e:test:trace, and e2e:test:host scripts to root package.json and include the e2e workspace
  • Introduce a GitHub composite action to start the console stack via Docker Compose for tests

Build:

  • Extend docker-compose with a Playwright service exposing port 5000 for test connections

CI:

  • Add CI workflows for running Playwright end-to-end tests, including a reusable template and job definitions

Documentation:

  • Update README with the new CONSOLE_API_URL environment variable and adjust formatting

Tests:

  • Include a skeleton example.spec.ts under e2e/tests to bootstrap Playwright tests

Signed-off-by: Carlos Feria <[email protected]>
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 18, 2025

Reviewer's Guide

This PR scaffolds Playwright-based end-to-end testing by introducing a dedicated e2e workspace with configuration and example, extends the existing setup with Docker Compose support for the Playwright server and new NPM scripts, and integrates reusable GitHub workflows and a composite action to run these tests in CI.

Class diagram for new e2e workspace and Playwright config

classDiagram
  class ConsoleUI_E2E_PackageJson {
    +scripts: clean, clean:all, lint, lint:fix, format, format:fix, test, test:trace, test:ui:host
    +devDependencies: @playwright/test
  }
  class PlaywrightConfigTs {
    +testDir: './tests'
    +fullyParallel: true
    +forbidOnly: CI-based
    +retries: CI-based
    +workers: CI-based
    +reporter: 'html'
    +use: baseURL, trace, screenshot, ignoreHTTPSErrors
    +projects: chromium, firefox, webkit
  }
  ConsoleUI_E2E_PackageJson --> PlaywrightConfigTs : uses config
Loading

File-Level Changes

Change Details Files
Update project documentation
  • Added CONSOLE_API_URL environment variable entry
  • Corrected list indentation and numbering in Markdown
  • Adjusted whitespace and formatting in examples
README.md
Extend Docker Compose with Playwright service
  • Added playwright service block
  • Configured image, ports, network_mode, working_dir, and command
docker-compose.yaml
Enable e2e workspace and scripts in root package.json
  • Added e2e to workspaces
  • Introduced e2e:test, e2e:test:trace, and e2e:test:host scripts
package.json
Scaffold e2e directory with Playwright setup
  • Created playwright.config.ts with base configuration
  • Initialized e2e/package.json with scripts and dependency
  • Added example test and .gitignore in e2e/tests
e2e/playwright.config.ts
e2e/package.json
e2e/.gitignore
e2e/tests/example.spec.ts
Add GitHub workflows and composite action for e2e CI
  • Introduced ci-e2e-template.yaml as a reusable workflow
  • Created composite action to start console services (start-console)
  • Defined ci-e2e.yaml to build artifact, discover envs, and run e2e
.github/workflows/ci-e2e-template.yaml
.github/actions/start-console/action.yml
.github/workflows/ci-e2e.yaml

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

@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:

  • The README entry for CONSOLE_API_URL still reuses the AUTH_REQUIRED description—please update its description (and the .env template) to accurately reflect its purpose.
  • There’s no actual smoke test in e2e/tests/example.spec.ts—consider adding a basic placeholder test so the CI pipeline can validate something meaningful immediately.
  • The start-console action defines a playwright_version input but the docker-compose service hardcodes the Playwright image; parameterize the service image in docker-compose.yml to respect that input.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The README entry for CONSOLE_API_URL still reuses the AUTH_REQUIRED description—please update its description (and the .env template) to accurately reflect its purpose.
- There’s no actual smoke test in e2e/tests/example.spec.ts—consider adding a basic placeholder test so the CI pipeline can validate something meaningful immediately.
- The start-console action defines a playwright_version input but the docker-compose service hardcodes the Playwright image; parameterize the service image in docker-compose.yml to respect that input.

## Individual Comments

### Comment 1
<location> `.github/actions/start-console/action.yml:65-67` </location>
<code_context>
+      shell: bash
+      run: |
+        # Wait for backend
+        until curl -s http://localhost:8087/healthz | jq -e '.status == "ok"' >/dev/null 2>&1; do
+          echo "Waiting for healthy service response on port 8087..."
+          sleep 2
+        done
+        
</code_context>

<issue_to_address>
**issue:** The health check for backend assumes jq is available; consider adding installation step or fallback.

If 'jq' is missing, the health check will fail. Please ensure 'jq' is installed or replace it with a bash-only solution.
</issue_to_address>

### Comment 2
<location> `.github/actions/start-console/action.yml:71` </location>
<code_context>
+        done
+        
+        # Wait for ui
+        until curl -s http://localhost:8088 | grep -qi "<html"; do
+          echo "Waiting for HTML page on port 8088..."
+          sleep 2
</code_context>

<issue_to_address>
**suggestion:** UI readiness check relies on HTML content; may be fragile if UI changes.

If the UI response format changes, this check could break. Using a dedicated health endpoint or status code would be more reliable.

Suggested implementation:

```
        # Wait for ui
        until curl -s -o /dev/null -w "%{http_code}" http://localhost:8088/healthz | grep -q "200"; do
          echo "Waiting for healthy UI service response on port 8088..."
          sleep 2
        done

```

If your UI does not expose a `/healthz` endpoint, replace `/healthz` with the correct health/status endpoint or path that reliably indicates readiness.
</issue_to_address>

### Comment 3
<location> `e2e/playwright.config.ts:28-29` </location>
<code_context>
+  /* Opt out of parallel tests on CI. */
+  workers: process.env.CI ? 1 : undefined,
+  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
+  reporter: 'html',
+  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
+  use: {
</code_context>

<issue_to_address>
**suggestion:** Only 'html' reporter is configured; consider adding 'list' or 'dot' for CI readability.

For CI, configure a text-based reporter to improve log readability. You can set the reporter conditionally based on the environment.

```suggestion
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: process.env.CI ? 'list' : 'html',
```
</issue_to_address>

### Comment 4
<location> `e2e/playwright.config.ts:33` </location>
<code_context>
+  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
+  use: {
+    /* Base URL to use in actions like `await page.goto('')`. */
+    baseURL: process.env.CONSOLE_UI_URL ?? "http://localhost:3000/",
+
+    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
</code_context>

<issue_to_address>
**issue (bug_risk):** Default baseURL is set to localhost:3000; ensure this matches actual UI port (8088 in compose).

Since the UI runs on port 8088 in docker-compose, updating the default baseURL to 'http://localhost:8088/' will prevent test failures when the environment variable is unset.
</issue_to_address>

### Comment 5
<location> `README.md:61` </location>
<code_context>
 | --------------- | ----------------------------- | -------------------------------------- |
 | MOCK            | Enables or disables mock data | `off`                                  |
 | AUTH_REQUIRED   | Enable/Disable authentication | false                                  |
+| CONSOLE_API_URL | Enable/Disable authentication | http://localhost:8080                  |
 | OIDC_CLIENT_ID  | Set Oidc Client               | frontend                               |
 | OIDC_SERVER_URL | Set Oidc Server URL           | `http://localhost:8090/realms/console` |
</code_context>

<issue_to_address>
**issue (typo):** The description for CONSOLE_API_URL appears to be incorrect.

The description for CONSOLE_API_URL should be updated to reflect its actual function, such as 'Set Console API URL'.

```suggestion
| CONSOLE_API_URL | Set Console API URL           | http://localhost:8080                  |
```
</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.

Signed-off-by: Carlos Feria <[email protected]>
@carlosthe19916 carlosthe19916 force-pushed the feat/playwright-skeleton branch from dce6ec9 to 4f520d1 Compare November 18, 2025 19:49
Signed-off-by: Carlos Feria <[email protected]>
@carlosthe19916 carlosthe19916 force-pushed the feat/playwright-skeleton branch from 521b1e4 to db76958 Compare November 18, 2025 20:05
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