Skip to content

Conversation

@UlisesGascon
Copy link
Member

@UlisesGascon UlisesGascon commented May 2, 2025

Resolve #219

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive end-to-end (E2E) testing using Playwright, including setup and teardown scripts, browser configuration, and test suites covering key website routes and navigation.
    • Added new npm scripts for running, debugging, and reporting Playwright E2E tests.
    • Integrated a new GitHub Actions workflow to automatically run E2E tests on pull requests and main branch updates.
  • Chores

    • Updated ignore files to exclude Playwright test results and reports from version control and Docker context.
    • Adjusted Jest configuration to ignore E2E test directories during test runs.
  • Documentation

    • Added test identifiers to report templates and the Not Found page to support UI testing.

@UlisesGascon UlisesGascon self-assigned this May 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 2, 2025

Walkthrough

This set of changes introduces comprehensive Playwright-based end-to-end (E2E) testing to the project. It includes new test scripts, Playwright configuration, global setup and teardown scripts for database state management, and a detailed E2E test suite for the website router. The CI pipeline is updated to run these E2E tests using GitHub Actions, with PostgreSQL service integration and artifact handling for test reports. Supporting changes to .gitignore and .dockerignore ensure test artifacts are excluded from version control and Docker contexts. Additionally, data-testid attributes were added to report templates to facilitate UI testing.

Changes

Files/Paths Change Summary
.gitignore, .dockerignore Added test-results/ and playwright-report directories to ignore lists for Git and Docker contexts.
.github/workflows/e2e-tests.yml Introduced a new GitHub Actions workflow to run Playwright E2E tests on main branch with PostgreSQL service, migrations, seeding, and artifact upload.
jest.config.js Configured Jest to ignore e2e directory and node_modules during test runs.
package.json Added Playwright dependency and five new npm scripts for E2E testing, debugging, reporting, and UI.
playwright.config.js Added Playwright configuration defining test directory, timeouts, global setup/teardown scripts, browser projects, server management, retries, and HTML reporting.
e2e/global-setup.js, e2e/global-teardown.js Added global setup script to prepare database fixtures before tests and global teardown script to clean database after tests, both using Knex with test environment configuration.
e2e/website.spec.js Added comprehensive Playwright E2E test suite covering website router functionality: index page, project details, error handling, and navigation flows.
src/reports/templates/index.ejs, notFound.ejs, project.ejs Added data-testid attributes to key HTML elements in report templates to support UI testing.

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions
    participant Runner as Ubuntu Runner
    participant DB as PostgreSQL Service
    participant App as Application Server
    participant PW as Playwright

    CI->>Runner: Trigger workflow on push/PR
    Runner->>DB: Start PostgreSQL service
    Runner->>App: Run migrations & seed DB
    Runner->>PW: Install Playwright & dependencies
    PW->>App: Run global-setup (prepare fixtures)
    PW->>App: Start dev server (if needed)
    PW->>App: Execute E2E tests
    PW->>App: Run global-teardown (cleanup DB)
    Runner->>CI: Upload Playwright report artifacts
Loading

Assessment against linked issues

Objective Addressed Explanation
Add support for e2e tests (#219)
Pickup improvements from referenced PRs (#219) Not enough information in the summary to confirm all referenced improvements are included.
JSON Schemas validation in the reports (#219) No direct evidence in the summary regarding JSON Schema validation in reports.
Dynamically generate reports via express server, remove show-reports CLI, keep generate-reports CLI (#219) These aspects are not mentioned in the provided change summaries.

Poem

In the warren, tests now hop with glee,
Playwright scripts run wild and free!
The database cleaned, the fixtures set,
Reports with tags to find and get.
CI bounces, ears held high,
As E2E checks flutter by.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c99d3d and 98b7119.

📒 Files selected for processing (4)
  • e2e/website.spec.js (1 hunks)
  • src/reports/templates/index.ejs (3 hunks)
  • src/reports/templates/notFound.ejs (1 hunks)
  • src/reports/templates/project.ejs (7 hunks)
✅ Files skipped from review due to trivial changes (3)
  • src/reports/templates/notFound.ejs
  • src/reports/templates/project.ejs
  • src/reports/templates/index.ejs
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/website.spec.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Playwright Tests
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@UlisesGascon UlisesGascon added this to the v1.0.0 milestone May 2, 2025
@UlisesGascon UlisesGascon marked this pull request as ready for review May 2, 2025 17:50
coderabbitai[bot]

This comment was marked as resolved.

@socket-security
Copy link

socket-security bot commented May 2, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​playwright/​test@​1.52.010010010099100

View full report

@UlisesGascon UlisesGascon mentioned this pull request May 2, 2025
7 tasks
@UlisesGascon UlisesGascon merged commit 867bd7d into main May 3, 2025
7 checks passed
@UlisesGascon UlisesGascon deleted the ulises/2019-e2e branch May 3, 2025 06:10
@UlisesGascon UlisesGascon mentioned this pull request May 3, 2025
2 tasks
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.

Migrate reporting

2 participants