Skip to content

fix: add database seed step to frontend-tests CI job - #16

Merged
Christopher Harrison (GeekTrainer) merged 4 commits into
mainfrom
fix/ci-seed-database-for-e2e-tests
Mar 11, 2026
Merged

fix: add database seed step to frontend-tests CI job#16
Christopher Harrison (GeekTrainer) merged 4 commits into
mainfrom
fix/ci-seed-database-for-e2e-tests

Conversation

@GeekTrainer

Copy link
Copy Markdown
Contributor

Description

Frontend E2E tests have been consistently failing in CI because the SQLite database is never populated. The *.db files are gitignored, so data/tailspin-toys.db doesn't exist in CI runners. Without data, the Flask API returns 404s/empty responses, causing 17 of 28 E2E tests to fail.

Closes #15

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • Added a "Seed database" step to the frontend-tests job in .github/workflows/run-tests.yml
  • The step activates the Python venv and runs server/utils/seed_database.py after environment setup and before Playwright tests

Testing

Backend Changes

  • Ran ./scripts/run-server-tests.sh - all 24 tests pass
  • No API changes made

Frontend Changes

  • No frontend code changes — this fixes the CI workflow so existing E2E tests can pass

Checklist

  • My code follows the project's coding standards
  • My changes are focused on a single concern
  • I have written clear commit messages explaining what and why

Additional Notes

This is a pre-existing issue affecting all runs on main, not specific to any PR. Every recent workflow run shows the same 17-test failure pattern.

The frontend E2E tests fail in CI because the database is not populated.
The *.db files are gitignored, so the SQLite database doesn't exist in CI.
This adds a step to run seed_database.py after environment setup and before
Playwright tests, ensuring the API returns data during E2E test runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set working-directory to ./server so Python can resolve 'from models import ...'
the same way the test scripts do (by having server/ as CWD).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Instead of a separate seed step in CI, call seed_database() in app.py on
startup. The seed function is idempotent so it's safe to call every time.
This means the database is always populated when the Flask server starts,
whether in CI, local dev, or any other environment.

Also simplify the frontend-tests job to use the existing run-e2e-tests.sh
script, which already handles setup via Playwright's webServer config.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Playwright browsers must be installed after npm ci, otherwise
@playwright/test package is not found.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GeekTrainer
Christopher Harrison (GeekTrainer) merged commit 5e5044a into main Mar 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant