Add system test infrastructure and critical path browser specs #52

Closed
opened 2026-05-29 23:36:19 +00:00 by ldraney · 0 comments
Owner

Type

Feature

Lineage

Standalone — identified in testing strategy audit (docs/testing-strategy.md). Depends on #51 being merged first (establishes request spec baseline).

Repo

ldraney/landscaping-assistant

User Story

As a developer,
I want Capybara system tests for the critical JS-driven user paths,
So that CI catches regressions in Stimulus controller behavior and Turbo Stream interactions that request specs cannot verify.

Context

The app uses Hotwire (Turbo + Stimulus) extensively. Request specs verify server responses but cannot test:

  • Drag-to-reorder in the work queue (Sortable.js + Stimulus)
  • Auto-submit on file selection (upload_controller.js)
  • Turbo Stream DOM updates after toggle/create actions
  • Active/inactive filter toggle (filter_controller.js)

Rails 8 guidance: system tests should be reserved for critical user paths only. This ticket adds the infrastructure (gems, CI config, base test case) and writes system specs for three flows:

  1. Work queue: add property to queue, toggle completed
  2. Upload: select file triggers auto-submit
  3. Property management: toggle active/inactive

GPS/address entry system tests are deferred — they require Geolocation API mocking which adds complexity.

File Targets

Files the agent should modify:

  • Gemfile — add capybara, selenium-webdriver (or cuprite) to test group
  • .woodpecker.yaml — ensure system tests run in CI (headless Chrome)

Files the agent should create:

  • spec/support/system_test_config.rb — Capybara + headless driver setup
  • spec/system/work_queue_spec.rb — work queue add + complete flow
  • spec/system/uploads_spec.rb — file select auto-submit flow
  • spec/system/properties_spec.rb — toggle active/inactive flow

Files the agent should read for context:

  • app/javascript/controllers/ — all Stimulus controllers (understand what to test)
  • app/views/ — view templates (understand DOM structure for selectors)
  • docs/testing-strategy.md — gap analysis and testing layer guidance
  • docs/hotwire.md — Stimulus controller inventory and CSS conventions
  • spec/rails_helper.rb — existing test config

Files the agent should NOT touch:

  • app/ code — no application changes, test-only
  • spec/requests/ — don't modify existing request specs
  • spec/models/ — don't modify existing model specs

Acceptance Criteria

  • capybara and browser driver gem added to Gemfile test group
  • spec/support/system_test_config.rb configures headless Chrome (or Cuprite)
  • rails_helper.rb requires the system test config
  • Work queue system spec: visit root, add a property to today's queue, verify it appears
  • Work queue system spec: click complete toggle, verify visual state change
  • Upload system spec: visit uploads, select a file, verify upload is created without manual submit
  • Properties system spec: visit manage, toggle active/inactive, verify row updates
  • All system specs pass locally with bundle exec rspec spec/system/
  • All existing specs continue to pass with bundle exec rspec
  • CI pipeline runs system tests (headless, no display needed)

Test Expectations

  • System specs use Capybara DSL (visit, fill_in, click_on, have_content, etc.)
  • Tests use headless Chrome or Cuprite (no visible browser window)
  • Tests are isolated — each creates its own data, no cross-test dependencies
  • Run command: bundle exec rspec spec/system/

Constraints

  • Follow Rails 8 system test conventions (driven_by :selenium, using: :headless_chrome)
  • RSpec system specs, not Minitest (project uses RSpec)
  • Keep system test count small — only critical JS paths per Rails guidance
  • No Tailwind (project uses plain CSS with Propshaft)
  • CI must work in Woodpecker with a headless browser (no X11/display server)
  • The Woodpecker CI image is ruby:3.4.9-slim — Chrome/Chromium must be installed in the test step

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • landscaping-assistant — project board
  • #51 — request spec gaps (should merge first)
### Type Feature ### Lineage Standalone — identified in testing strategy audit (docs/testing-strategy.md). Depends on #51 being merged first (establishes request spec baseline). ### Repo `ldraney/landscaping-assistant` ### User Story As a developer, I want Capybara system tests for the critical JS-driven user paths, So that CI catches regressions in Stimulus controller behavior and Turbo Stream interactions that request specs cannot verify. ### Context The app uses Hotwire (Turbo + Stimulus) extensively. Request specs verify server responses but cannot test: - Drag-to-reorder in the work queue (Sortable.js + Stimulus) - Auto-submit on file selection (upload_controller.js) - Turbo Stream DOM updates after toggle/create actions - Active/inactive filter toggle (filter_controller.js) Rails 8 guidance: system tests should be reserved for critical user paths only. This ticket adds the infrastructure (gems, CI config, base test case) and writes system specs for three flows: 1. Work queue: add property to queue, toggle completed 2. Upload: select file triggers auto-submit 3. Property management: toggle active/inactive GPS/address entry system tests are deferred — they require Geolocation API mocking which adds complexity. ### File Targets Files the agent should modify: - `Gemfile` — add capybara, selenium-webdriver (or cuprite) to test group - `.woodpecker.yaml` — ensure system tests run in CI (headless Chrome) Files the agent should create: - `spec/support/system_test_config.rb` — Capybara + headless driver setup - `spec/system/work_queue_spec.rb` — work queue add + complete flow - `spec/system/uploads_spec.rb` — file select auto-submit flow - `spec/system/properties_spec.rb` — toggle active/inactive flow Files the agent should read for context: - `app/javascript/controllers/` — all Stimulus controllers (understand what to test) - `app/views/` — view templates (understand DOM structure for selectors) - `docs/testing-strategy.md` — gap analysis and testing layer guidance - `docs/hotwire.md` — Stimulus controller inventory and CSS conventions - `spec/rails_helper.rb` — existing test config Files the agent should NOT touch: - `app/` code — no application changes, test-only - `spec/requests/` — don't modify existing request specs - `spec/models/` — don't modify existing model specs ### Acceptance Criteria - [ ] `capybara` and browser driver gem added to Gemfile test group - [ ] `spec/support/system_test_config.rb` configures headless Chrome (or Cuprite) - [ ] `rails_helper.rb` requires the system test config - [ ] Work queue system spec: visit root, add a property to today's queue, verify it appears - [ ] Work queue system spec: click complete toggle, verify visual state change - [ ] Upload system spec: visit uploads, select a file, verify upload is created without manual submit - [ ] Properties system spec: visit manage, toggle active/inactive, verify row updates - [ ] All system specs pass locally with `bundle exec rspec spec/system/` - [ ] All existing specs continue to pass with `bundle exec rspec` - [ ] CI pipeline runs system tests (headless, no display needed) ### Test Expectations - [ ] System specs use Capybara DSL (visit, fill_in, click_on, have_content, etc.) - [ ] Tests use headless Chrome or Cuprite (no visible browser window) - [ ] Tests are isolated — each creates its own data, no cross-test dependencies - Run command: `bundle exec rspec spec/system/` ### Constraints - Follow Rails 8 system test conventions (driven_by :selenium, using: :headless_chrome) - RSpec system specs, not Minitest (project uses RSpec) - Keep system test count small — only critical JS paths per Rails guidance - No Tailwind (project uses plain CSS with Propshaft) - CI must work in Woodpecker with a headless browser (no X11/display server) - The Woodpecker CI image is `ruby:3.4.9-slim` — Chrome/Chromium must be installed in the test step ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `landscaping-assistant` — project board - #51 — request spec gaps (should merge first)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/landscaping-assistant#52
No description provided.