Skip to content

Add initial e2e test support - #204

Merged
erseco merged 9 commits into
mainfrom
feature/add-e2e-tests
Jul 10, 2026
Merged

Add initial e2e test support#204
erseco merged 9 commits into
mainfrom
feature/add-e2e-tests

Conversation

@erseco

@erseco erseco commented Nov 28, 2025

Copy link
Copy Markdown
Member

Wires the Playwright E2E suite into CI and makes it pass deterministically.

The E2E specs already lived in the repo but had never actually run in CI. Turning them on surfaced four real problems in a clean environment; this PR fixes all of them and adds Decker-focused coverage.

Why the E2E job was failing (root causes)

Area Root cause
calendar / task-collaboration Decker pages render only on the front end via template_redirect (home_url('?decker_page=…')). The specs navigated to /wp-admin/?decker_page=…, where the Decker router never runs, so they got the dashboard. Fixed by using plain front-end page.goto().
task-locking #task-due-date is a required field, and the front-end save silently no-ops when the form is invalid. The test tasks had no due date, so nothing persisted. Fixed by filling the due date before saving.
task-collaboration Collaborative editing is off by default and loads Yjs from an external CDN (esm.sh) + signalling server (signaling.yjs.dev). It never initialised, so .decker-collab-status never appeared.
task-collaboration (checkbox) The test set max_priority via the REST API, but the plugin does not register its task meta for REST, so the write was dropped. Fixed by driving the value through the real form save.

What changed

Fixes

  • calendar.spec.js, task-collaboration.spec.js → front-end navigation.
  • task-locking.spec.js → fill the required due date before each save.
  • task-collaboration.spec.js → checkbox test round-trips through the real save.

Collaboration kept out of the CI gate

  • Because it depends on external services (CDN + signalling server), the collaboration spec is excluded from the default run (testIgnore unless DECKER_E2E_COLLAB=1).
  • New make test-e2e-collab target enables collaborative_editing, runs the spec, and restores the setting.
  • make setup-tests-env now forces collaborative_editing=0 so the deterministic suite is unaffected.

Coverage: replace WP-core boilerplate with Decker flows

  • Removed edit-posts.test.js and hello.test.js (they tested WordPress core, not Decker).
  • Added smoke.spec.js — the front-end app shell boots and sidebar navigation works.
  • Added board.spec.js — the Kanban board renders its stack columns, and a task created through the real task form lands in the TO-DO column (full create → save → render round-trip).

Results

  • make test-e2e (the CI command): 12 passed.
  • make test-e2e-collab (manual): 6 passed.

Follow-up

The REST endpoint /wp/v2/tasks silently drops stack / max_priority / duedate meta because it is not registered for REST. Tracked separately in #272 (fix in #273).

@github-actions

Copy link
Copy Markdown

WordPress Playground Preview

The changes in this pull request can previewed and tested using a WordPress Playground instance.

Open WordPress Playground Preview

erseco and others added 2 commits July 10, 2026 12:16
The E2E specs already lived in the repo but had never run in CI; enabling
them exposed four real problems, now fixed:

- Decker pages render only on the front end (template_redirect), so the
  calendar and collaboration specs navigated to wp-admin URLs where the
  Decker router never runs. Use plain front-end navigation instead.
- The task form's due date is required; the front-end save silently no-ops
  on an invalid form. Fill #task-due-date before saving in the locking spec.
- Collaborative editing is off by default and pulls Yjs from an external CDN
  plus a signalling server, so it is not a deterministic CI gate. Exclude it
  by default (testIgnore unless DECKER_E2E_COLLAB=1) and add a dedicated
  `make test-e2e-collab` target that toggles the setting around the run.
  setup-tests-env now forces collaborative_editing off for the main suite.
- The collaboration checkbox test relied on REST persisting custom task meta
  (it does not); drive it through the real form save instead.

Also remove the WordPress-core boilerplate specs (edit-posts, hello) and
replace them with Decker-focused coverage:

- smoke.spec.js: the front-end app shell boots and sidebar navigation works.
- board.spec.js: the Kanban board renders its stack columns and a task
  created through the real form lands in the TO-DO column.

make test-e2e: 12 passed. make test-e2e-collab: 6 passed.
erseco added 3 commits July 10, 2026 14:33
The task-locking and today-quick-action specs log two users in via the
wp-login form in separate browser contexts. Under CI timing the previous
`networkidle` wait could return before the auth cookie was committed, so a
follow-up navigation rendered as a different (or anonymous) user and the
server-side edit lock was acquired for the wrong account (the banner showed
"locked by admin" instead of the expected user).

Wait for the post-login redirect to wp-admin before navigating, and force a
clean browser context so no storage state leaks between sessions.
Follow-up to the REST task-meta fix (#273), now merged into this branch:

- board.spec.js: add a test that a task created over REST with an explicit
  stack renders in that column (and not in TO-DO), and refresh the header
  note that previously claimed REST dropped task meta.
- task-collaboration.spec.js: fix the same stale comment on the checkbox test.
- ci.yml: remove the commented-out "Pre-pull Docker images" dead block.
@erseco
erseco merged commit 1ac2c3d into main Jul 10, 2026
7 checks passed
@erseco
erseco deleted the feature/add-e2e-tests branch July 10, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant