test: isolate Related Stories partial counts
This commit is contained in:
7 files changed
+33
-283
No files matched your search
@@ -32,7 +32,7 @@
|
||||
- `tests/e2e/global-setup.mjs` only if the existing idempotent fixture seed needs no-op-safe related-story guarantees.
|
||||
- `tests/fixtures/posts.json` only if deterministic five-related-story coverage cannot be formed from the existing twelve posts; keep the approved fixture count invariant unless a failing test proves expansion necessary.
|
||||
- `playwright.config.mjs` — environment-selectable base URL while preserving the default 8888 contract.
|
||||
- `scripts/seed-test-content.sh` and `scripts/seed-test-content.php` — local-only serial `related-1/2/4` scenarios, if the runtime partial-count RED requires them.
|
||||
- `scripts/seed-test-content.sh` and `scripts/seed-test-content.php` — local-only visual scenarios that mutate fixture-owned content only.
|
||||
|
||||
### Create
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
- `tests/js/editor-related-posts.test.js` — registration, numeric coercion, allowlisting, and edit behavior.
|
||||
- `tests/js/related-posts.test.js` — initialization, navigation, focus, resize, failure, and cleanup behavior.
|
||||
- `tests/e2e/related-stories.spec.mjs` — real editor, frontend, responsive, accessibility, no-JS, and permalink coverage.
|
||||
- `tests/e2e/related-stories-scenarios.spec.mjs` — serial mutation scenarios that always restore default fixture state.
|
||||
- `tests/smoke/related-stories-contract.test.mjs` — metadata, CSS, localization, and forbidden-behavior checks.
|
||||
|
||||
## Task 0: Start and prove the isolated environment
|
||||
@@ -374,12 +373,8 @@ git commit -m "style: add Related Stories layouts"
|
||||
**Files:**
|
||||
|
||||
- Modify: `tests/e2e/related-stories.spec.mjs`
|
||||
- Create: `tests/e2e/related-stories-scenarios.spec.mjs`
|
||||
- Modify: `playwright.config.mjs`
|
||||
- Modify: `tests/smoke/e2e-harness.test.mjs`
|
||||
- Modify: `scripts/seed-test-content.sh`
|
||||
- Modify: `scripts/seed-test-content.php`
|
||||
- Modify: `tests/fixtures/posts.json` and `tests/e2e/global-setup.mjs` only if a RED test proves existing fixtures cannot provide five deterministic related stories
|
||||
- Modify as required by a valid RED: `assets/js/related-posts.js`, `blocks/related-posts/render.php`, `blocks/related-posts/style.css`
|
||||
|
||||
- [ ] **Step 1: Write failing browser acceptance tests**
|
||||
@@ -396,23 +391,22 @@ On a seeded single-post route containing the default block, add tests for:
|
||||
- clicking each rendered related card reaches a same-origin published single-post response with HTTP 200 and no PHP warning;
|
||||
- axe finds no automatically detectable WCAG 2.2 AA violations in grid and active carousel states.
|
||||
|
||||
Create the mutation spec before changing the seed. It requests local scenarios `related-1`, `related-2`, and `related-4`, asserts exact rendered counts, and restores `default` in both `finally` and `afterAll`. Add a dedicated Playwright `related-scenarios` project with `workers:1`, `fullyParallel:false`, `dependencies:['scenarios']`, and `testMatch:'related-stories-scenarios.spec.mjs'`. The existing `scenarios` project already depends on every read-only browser project, so this explicit chain guarantees the two database-mutating projects never overlap. Every reader project and the existing `scenarios` project ignore the new mutation spec; `related-scenarios` ignores the older mutation spec.
|
||||
Partial availability counts of one, two, and four are server integration cases. Keep them in `BlockRenderingTest.php`, using isolated PHPUnit factories and parsed article counts. Browser coverage uses the stable seeded `3/5 × adaptive/grid/carousel` matrix and must not mutate unrelated or unowned posts to manufacture smaller result sets.
|
||||
|
||||
Before implementation, extend `tests/smoke/e2e-harness.test.mjs` with a RED contract that recognizes exactly `visual-scenarios.spec.mjs` and `related-stories-scenarios.spec.mjs` as mutation specs, continues rejecting `seed-test-content`, `wp-env`, and `execFileSync` from every reader spec, and requires the dependency chain `chromium/firefox/webkit → scenarios → related-scenarios` with both mutation projects single-worker and non-parallel.
|
||||
Before implementation, extend `tests/smoke/e2e-harness.test.mjs` with a RED contract that recognizes only `visual-scenarios.spec.mjs` as a mutation spec, continues rejecting `seed-test-content`, `wp-env`, and `execFileSync` from every reader spec, and requires the dependency chain `chromium/firefox/webkit → scenarios` with the mutation project single-worker and non-parallel. The contract also rejects Related Stories scenarios or snapshots that could change unowned content.
|
||||
|
||||
- [ ] **Step 2: Run acceptance RED**
|
||||
|
||||
```bash
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories.spec.mjs --project=chromium --grep 'interaction|no JavaScript|permalink|accessibility'
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories-scenarios.spec.mjs --project=related-scenarios
|
||||
node --test tests/smoke/e2e-harness.test.mjs
|
||||
```
|
||||
|
||||
Expected: tests that require the new block behavior fail before final integration; harness smoke fails because the second mutation spec/project is not yet allowlisted and chained; fixture changes are authorized only if the permalink/count precondition itself fails.
|
||||
Expected: tests that require the new block behavior fail before final integration; harness smoke fails until browser specs stay read-only and no unsafe Related Stories mutation scenario exists.
|
||||
|
||||
- [ ] **Step 3: Make the minimum integration/fixture correction**
|
||||
|
||||
Prefer existing published fixtures. Add allowlisted local-only `related-1/2/4` scenarios to both seed entrypoints. Each scenario snapshots the owned fixtures, leaves the current fixture published, leaves exactly the requested number of eligible related fixtures published, and temporarily drafts only the remaining `_chrnx_fixture_key`-owned posts. The serial test restores `default` in `finally`; default republishes the declared fixture statuses. This keeps all scenario behavior inside local seed tooling and leaves the production selector untouched. If five deterministic related posts are impossible, update existing fixture taxonomy/tag assignments without increasing the approved 7-page/12-post count. Keep keys/slugs stable, seed twice, and prove the same 19 owned IDs and default fingerprint before/after serial scenarios. Do not add URL rewriting or test-only production hooks.
|
||||
Keep browser acceptance on the existing published fixtures. The local seed may update only `_chrnx_fixture_key`-owned records and must never snapshot, draft, delete, or otherwise mutate unowned posts. Preserve the approved 7-page/12-post count, stable keys/slugs, and production selector. Exact partial-count behavior remains covered by isolated PHPUnit factories; do not add URL rewriting or test-only production hooks.
|
||||
|
||||
- [ ] **Step 4: Run Chromium GREEN, then all engines**
|
||||
|
||||
@@ -420,7 +414,6 @@ Prefer existing published fixtures. Add allowlisted local-only `related-1/2/4` s
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories.spec.mjs --project=chromium
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories.spec.mjs --project=firefox
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories.spec.mjs --project=webkit
|
||||
CHRNX_E2E_BASE_URL=http://localhost:8908 npx playwright test tests/e2e/related-stories-scenarios.spec.mjs --project=related-scenarios
|
||||
node --test tests/smoke/e2e-harness.test.mjs
|
||||
```
|
||||
|
||||
@@ -429,7 +422,7 @@ Expected: all behavior passes in Chromium, Firefox, and WebKit. Axe may remain i
|
||||
- [ ] **Step 5: Commit Task 5**
|
||||
|
||||
```bash
|
||||
git add tests/e2e/related-stories.spec.mjs tests/e2e/related-stories-scenarios.spec.mjs playwright.config.mjs tests/smoke/e2e-harness.test.mjs scripts/seed-test-content.sh scripts/seed-test-content.php tests/fixtures/posts.json tests/e2e/global-setup.mjs assets/js/related-posts.js blocks/related-posts/render.php blocks/related-posts/style.css
|
||||
git add tests/e2e/related-stories.spec.mjs playwright.config.mjs tests/smoke/e2e-harness.test.mjs assets/js/related-posts.js blocks/related-posts/render.php blocks/related-posts/style.css
|
||||
git commit -m "test: verify Related Stories workflows"
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user