Skip to content

[codex] Add Playwright E2E coverage - #39

Merged
sak0a merged 3 commits into
masterfrom
feature/playwright-e2e
May 5, 2026
Merged

sak0a merged 3 commits into
masterfrom
feature/playwright-e2e

Conversation

@sak0a

@sak0a sak0a commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • add Docker-backed Playwright browser E2E coverage for Notur admin and runtime flows
  • add GitHub Actions E2E workflow wiring with cached Docker base/app/test-runner images
  • add bootstrap scripts for deterministic panel state, browser users, extension install/remove checks, and install/uninstall lifecycle validation
  • tighten admin UI feedback and remove command coverage used by the E2E scenarios

Validation

  • git diff --cached --check
  • npx playwright test --config=playwright.config.ts --list
  • bash docker/e2e/run-e2e.sh --suite browser - 19 passed

Notes

Generated local artifacts were intentionally left out of the commit: root checksums.json, test.txt.rej, examples/hello-world/package-lock.json, and examples/hello-world/node_modules/.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added end-to-end browser test suite for admin UI and extension management flows
    • Implemented Docker-based E2E testing environment with automated setup
  • Documentation

    • Added Docker E2E testing guide with instructions for local test execution
  • Tests

    • Introduced Playwright browser automation tests for UI validation
    • Added integration test coverage for command safety features
  • Chores

    • Configured GitHub Actions CI workflows for automated E2E testing
    • Updated Docker build infrastructure and dependency settings

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dcf3ee27-1bdb-40f2-9724-9bcc20d13d61

📥 Commits

Reviewing files that changed from the base of the PR and between 369f79a and 80747ba.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • .dockerignore
  • .github/workflows/e2e-base-image.yml
  • .github/workflows/e2e.yml
  • .gitignore
  • README.md
  • composer.json
  • docker/e2e/Dockerfile
  • docker/e2e/Dockerfile.base
  • docker/e2e/build-base.sh
  • docker/e2e/docker-compose.yml
  • docker/e2e/install-uninstall.sh
  • docker/e2e/run-e2e.sh
  • docker/e2e/setup-panel.sh
  • package.json
  • playwright.config.ts
  • resources/views/admin/extension-detail.blade.php
  • resources/views/admin/extensions.blade.php
  • resources/views/admin/health.blade.php
  • src/Console/Commands/RemoveCommand.php
  • src/Http/Controllers/ExtensionAdminController.php
  • tests/E2E/bootstrap-state.php
  • tests/E2E/browser/notur-admin.spec.ts
  • tests/E2E/run-tests.sh
  • tests/Integration/Console/CommandCoverageTest.php
  • tests/Integration/Http/ExtensionAdminControllerTest.php

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive Docker-based E2E testing infrastructure with multi-stage builds, a reusable base image, and Playwright browser tests. It adds suite-based E2E execution (browser/shell/install-uninstall), panel bootstrap scripts, UI test instrumentation via data-testid attributes, and a safety check requiring --force for non-interactive extension removal.

Changes

Docker E2E Testing Infrastructure with Playwright

Layer / File(s) Summary
Docker Build Refactoring
docker/e2e/Dockerfile.base, docker/e2e/Dockerfile, docker/e2e/docker-compose.yml
Refactored monolithic E2E Dockerfile into a reusable multi-stage base image (Dockerfile.base) with PHP/Node/Composer/Bun/Panel preinstalled, and parameterized Dockerfile now pulls from the base image, defines notur-node-deps, panel-base, app, and test-runner stages. Compose file parameterizes app/test-runner images, updates healthchecks, adds Playwright/E2E env vars, and switches test-runner to service networking with 1GB shm.
E2E Build & Orchestration Scripts
docker/e2e/build-base.sh, docker/e2e/run-e2e.sh, docker/e2e/setup-panel.sh, docker/e2e/install-uninstall.sh
New build script for reusable base image. Enhanced run-e2e.sh adds suite selection (--suite with validation), --rebuild-base, --no-cache flags, image env-var resolution, and delegates panel setup/install-uninstall to external scripts. Added setup-panel.sh for end-to-end panel bootstrap (Notur install, migrations, example extensions, database validation). Added install-uninstall.sh lifecycle verification for Notur uninstall and state cleanup.
GitHub Actions Workflow
.github/workflows/e2e-base-image.yml, .github/workflows/e2e.yml
New workflow to publish base image to GHCR on manual trigger. Refactored main E2E workflow from inline setup to image-driven pipeline: resolves/builds base image, builds app/test-runner images with GHCR cache, runs suites via run-e2e.sh, resets containers between shell/install-uninstall tests, and logs extended runtime artifacts (.env, extensions.json).
Playwright Configuration
playwright.config.ts, package.json, tests/E2E/run-tests.sh
Added Playwright config with test directory, CI-based gating, single-worker execution, and baseURL resolution from env. Added test:e2e:browser npm script and @playwright/test dev dependency. Created run-tests.sh to route E2E suite execution (browser waits for app readiness, shell runs existing script).
E2E Test Suite
tests/E2E/bootstrap-state.php, tests/E2E/browser/notur-admin.spec.ts
Added E2E bootstrap script that seeds admin/user accounts, reads env credentials, parses extension manifests, upserts InstalledExtension records, and writes extensions.json. Added comprehensive Playwright serial test suite covering extension list, admin UI flows (details/settings/health/install/enable/disable/remove), settings persistence verification via MySQL, and non-admin access control; includes helpers for login, archive building, panel readiness polling, and flash message assertions.
UI Test Instrumentation
resources/views/admin/extension-detail.blade.php, resources/views/admin/extensions.blade.php, resources/views/admin/health.blade.php
Added data-testid attributes to flash alerts, extension rows, settings forms, and health cards to support Playwright selectors and DOM-based test assertions.
Docker Build Context
.dockerignore, .gitignore
Added .dockerignore entries for VCS, dependencies, artifacts, env files, and coverage. Added .gitignore entries for Playwright artifacts (/playwright-report/, /test-results/).
Documentation
README.md
Added "Docker E2E" section documenting base image build, suite selection, container reuse, GHCR usage with fallback, seeded credentials, and browser spec location.

Remove Command Safety

Layer / File(s) Summary
Command Signature & Logic
src/Console/Commands/RemoveCommand.php
Added --force option to notur:remove; non-interactive invocations without --force now error with exit code 1 instead of prompting. Confirmation prompt gated behind --force flag.
Controller Integration
src/Http/Controllers/ExtensionAdminController.php
Updated runRemoveCommand() to pass --force flag alongside --no-interaction when invoking notur:remove for web-based removal.
Test Coverage
tests/Integration/Console/CommandCoverageTest.php, tests/Integration/Http/ExtensionAdminControllerTest.php
Added test for non-interactive remove requiring --force (verifies exit code 1 and extension still exists). Added test verifying controller passes --force flag to Artisan command invocation.

Supporting Configuration Changes

Layer / File(s) Summary
Dependency Stability
composer.json
Changed "minimum-stability" from "stable" to "dev" and added "prefer-stable": true to allow dev-version dependencies while favoring stable releases.

Sequence Diagram(s)

sequenceDiagram
    participant GHA as GitHub Actions
    participant GHCR as GHCR Registry
    participant Docker as Docker Build
    participant Compose as Docker Compose
    participant App as App Container
    participant TestRunner as Test Runner
    participant DB as Database
    participant Browser as Browser
    
    GHA->>Docker: Build E2E base image (PHP/Node/Panel)
    Docker->>GHCR: Push base image to GHCR
    
    GHA->>Docker: Build app image (from base + repo)
    Docker->>Compose: app image ready
    
    GHA->>Docker: Build test-runner image (from base + repo)
    Docker->>Compose: test-runner image ready
    
    Compose->>DB: Start database
    Compose->>App: Start app container
    App->>DB: Connect to database
    
    GHA->>App: Run setup-panel.sh (Notur install/migrations/bootstrap)
    App->>DB: Create/migrate Notur tables
    App->>App: Install extensions, seed data
    
    Compose->>TestRunner: Start test-runner container
    TestRunner->>App: Wait for healthcheck (HTTP 200 on /auth/login)
    TestRunner->>Browser: Launch Playwright
    Browser->>App: POST /sanctum/csrf-cookie
    Browser->>App: POST /login (with XSRF header)
    Browser->>App: GET /admin/extensions (authenticated)
    Browser->>DB: Verify extension settings persist
    Browser->>App: Exercise UI flows (install/enable/disable/remove)
    
    GHA->>Compose: Reset containers between test suites
    GHA->>TestRunner: Run install-uninstall suite
    TestRunner->>App: Assert Notur routes/state before uninstall
    TestRunner->>App: Run notur:uninstall --force
    TestRunner->>App: Assert all Notur state removed
    
    GHA->>GHA: Collect logs (.env, extensions.json, container logs)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

This PR contains substantial, heterogeneous changes across Docker infrastructure, test automation, UI instrumentation, and command safety. The Docker refactoring involves multi-stage build logic, environment variable parameterization, and orchestration changes. The Playwright test suite is comprehensive with 600+ lines covering multiple admin workflows and database assertions. UI testid additions are repetitive but span three view files. The remove command safety feature touches controller, command, and two separate test files. Review requires understanding Docker build/compose mechanics, E2E test patterns, Playwright specifics, and tracing control flow changes across the extension removal feature.

Possibly related PRs

  • sak0a/notur#33: Modifies E2E workflows and Docker build infrastructure (notably .github/workflows/e2e.yml and docker/e2e Dockerfiles), directly overlapping at the Docker pipeline level.

Poem

🐰 Hops with joy as Docker stages dance,
Base images built with careful stance,
Playwright scripts now test with might,
E2E flows burning bright,
Safety guards for removal's plight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/playwright-e2e

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.54)

PHPStan was skipped because the sandbox runner could not parse its output.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sak0a
sak0a marked this pull request as ready for review May 5, 2026 00:41
@sak0a
sak0a merged commit 8cc8b37 into master May 5, 2026
8 of 11 checks passed
@augmentcode

augmentcode Bot commented May 5, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR adds Docker-backed Playwright E2E coverage for Notur’s admin/runtime flows and wires it into CI.

Changes:

  • Introduces a reusable E2E base image (docker/e2e/Dockerfile.base) plus a slimmer multi-stage E2E Dockerfile for app + test-runner.
  • Refactors the GitHub Actions E2E workflow to pull/publish/cache Docker images and run shell + browser suites, plus a dedicated install/uninstall lifecycle suite.
  • Adds deterministic E2E bootstrap tooling (setup-panel.sh, bootstrap-state.php, install-uninstall.sh) to seed users, extension state, and panel settings.
  • Adds Playwright configuration + a comprehensive admin UI spec suite under tests/E2E/browser/.
  • Tightens admin UI testability by adding data-testid hooks and exposing validation errors on the extensions admin pages.
  • Extends notur:remove with a --force flag and updates web-based removal to use non-interactive forced execution.
  • Updates npm scripts/devDependencies to include Playwright and a browser E2E runner command.

Technical Notes: CI prefers a pre-published GHCR base image for speed, but can fall back to building the base layer with GHA cache when unavailable.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread composer.json
"sort-packages": true
},
"minimum-stability": "stable"
"minimum-stability": "dev",

@augmentcode augmentcode Bot May 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

composer.json:56 sets minimum-stability to dev, which changes dependency resolution for all consumers of this package (not just E2E) and can pull dev versions unexpectedly. This could make installs less deterministic even with prefer-stable enabled.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread docker/e2e/run-e2e.sh
ok "Panel migrations complete"
echo ""
if [ "$SUITE" = "install-uninstall" ]; then
info "Checking panel availability before Notur installation..."

@augmentcode augmentcode Bot May 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

docker/e2e/run-e2e.sh:186 checks panel availability for the install-uninstall suite before setup-panel.sh runs migrations/bootstrap. On a fresh DB this will likely never return a 2xx response (curl -f), causing the install/uninstall suite to time out.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread tests/E2E/run-tests.sh
local retries=0

while [ "$retries" -lt "$max_retries" ]; do
if curl -s -o /dev/null --max-time 5 "$url" 2>/dev/null; then

@augmentcode augmentcode Bot May 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tests/E2E/run-tests.sh:13 treats any HTTP response as "ready" because curl doesn't use -f, so 500/404 responses will still pass the readiness gate. This can start Playwright while the panel is still erroring, leading to flaky failures.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread docker/e2e/setup-panel.sh
local value="$2"

if grep -q "^${key}=" .env; then
sed -i "s|^${key}=.*|${key}=${value}|" .env

@augmentcode augmentcode Bot May 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

docker/e2e/setup-panel.sh:21 writes values into .env via sed without escaping replacement metacharacters (notably & and backslashes). If any of the env values contain these characters (e.g., a DB password), the .env line can be corrupted and subsequent artisan/composer steps may fail.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@sak0a
sak0a deleted the feature/playwright-e2e branch May 5, 2026 01:00
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