Commit Graph

23 Commits

Author SHA1 Message Date
peptiderepo
4f574a3986 test(e2e): add smoke specs for Peptide News + PR Vision admin (#20)
* feat(e2e): add Peptide News admin smoke spec (07)

Covers dashboard (HTTP 200, no fatal, heading + summary cards + date filter),
settings (form present), articles, and LLM costs sub-pages.
Skip-if-absent guard on all tests: when plugin is not installed on the
environment, tests skip loudly instead of hard-failing.

Selectors sourced from:
  admin/class-pn-admin-menu.php  (slugs)
  admin/partials/dashboard.php   (.pn-summary-cards, .pn-date-filter, h1)

Agent-Session: claude/e2e-news-vision-admin-20260617

* feat(e2e): add PR Vision admin smoke spec (08)

Covers:
- Dashboard: HTTP 200, no fatal, h1 "PR Vision" heading visible
- Settings: page loads + API-key-manager card (#prv-key-card) present +
  status indicator (#prv-key-source-badge) visible
- Write-only invariant: #prv_api_key input has value="" (stored key never
  output); full page HTML asserted to not contain "sk-or-" prefix
- Costs (pr-vision-costs): loads without fatal
- Call Log (pr-vision-calls): loads without fatal

Skip-if-absent on every test: plugin absent or Settings page (v0.2.0
admin) not yet deployed => loud annotation + test.skip().

Selectors sourced from:
  includes/core/class-prv-admin-page.php      (h1 heading)
  includes/core/class-prv-key-manager-renderer.php (#prv-key-card,
    #prv-key-source-badge, #prv_api_key)
  includes/core/class-prv-settings-page.php   (MENU_SLUG)
  includes/core/class-prv-costs-page.php      (MENU_SLUG)
  includes/core/class-prv-call-log-page.php   (MENU_SLUG)

Agent-Session: claude/e2e-news-vision-admin-20260617

* chore(e2e): CHANGELOG 1.7.0 — Peptide News + PR Vision admin smoke specs

Agent-Session: claude/e2e-news-vision-admin-20260617

* chore(e2e): bump version to 1.7.0

Agent-Session: claude/e2e-news-vision-admin-20260617

* fix(e2e): guard-first ordering in specs 07+08 — skip before Invalid-plugin-page assert

In 07-peptide-news-admin (Articles + LLM Costs) and 08-pr-vision-admin
(Costs + Call Log), the hard expect(body).not.toContain('Invalid plugin page')
assertion fired BEFORE the isPluginAbsent() skip guard. If either plugin is
absent from staging, those tests would hard-fail — gating prod for all apps.

Fix: move isPluginAbsent() + test.skip() above the Invalid-plugin-page assert
in all four affected tests, mirroring the Dashboard/Settings guard-first pattern
already used in the same files.

- 07 Articles: skip guard now before Invalid plugin page check
- 07 LLM Costs: skip guard now before Invalid plugin page check
- 08 Costs: skip guard now before Invalid plugin page check
- 08 Call Log: skip guard now before Invalid plugin page check

Validated: npx playwright test --list lists all 38 tests cleanly.

Agent-Session: engineer-infra-e2e-guardfix-20260617

---------

Co-authored-by: peptiderepo <bot@peptiderepo.com>
2026-06-17 01:41:11 +07:00
peptiderepo
7c7f46b127 Add reusable ci.yml standard workflow (#19)
Reusable workflow_call CI keystone (ADR 2026-06-16). QA-approved 6adf255d.
2026-06-16 19:12:07 +07:00
peptiderepo
b9ffad1db3 test: board Generate-Now skip-if-absent smoke (M4 surface) (#18)
Skip-if-absent Playwright spec for the board New Article / Generate Now control; now live with prautoblogger v0.21.0. Gates future deploys.

Agent-Session: m4-generate-now-smoke-20260614
2026-06-15 01:53:49 +07:00
peptiderepo
7fa91ec975 fix(ci): sync package-lock.json with package.json (unblock smoke npm ci) (#17)
Lockfile-only sync (Playwright 1.60.0 + typescript). Unblocks org-wide deploy smoke gate.

Agent-Session: e2e-lockfile-sync
2026-06-13 13:19:43 +07:00
peptiderepo
65c5de61cb test: dossier edit+rerun smoke (M3, skip-if-absent) — v1.4.0 (#15)
QA: APPROVE (companion verdict in qa-reviews/prautoblogger/2026-06-12-6ed639d.md check 10). Skip-if-absent per M3 binding.

Agent-Session: cto-e2e-merge-20260612
2026-06-12 22:04:20 +07:00
peptiderepo
d590dc9dee fix(auth): survive ERR_ABORTED in login retry — recreate context, 5 attempts with backoff (#16)
QA: APPROVE (qa-reviews/peptide-e2e/). CEO program greenlight 2026-06-12.

Agent-Session: cto-e2e-merge-20260612
2026-06-12 22:02:51 +07:00
peptiderepo
a05d90405d Dossier admin smoke: gate deploys on prautoblogger-dossier rendering (#14)
Merged ahead of the v0.19.3 dossier fix so staging smoke gates it.
QA: APPROVE qa-reviews/peptide-e2e/2026-06-12-0c5c301.md (re-head after conflict resolution)

Agent-Session: cto-dossier-403-hotfix-20260612
2026-06-12 18:29:25 +07:00
peptiderepo
52a05f994c Board admin smoke: assert prautoblogger-board renders for admin (#13)
Guards the submenu-before-parent 404 class in the deploy gate.
QA: APPROVE-W-P2 qa-reviews/peptide-e2e/2026-06-12-113bb17.md

Agent-Session: cto-board-404-hotfix-merge-20260612
2026-06-12 16:05:30 +07:00
peptiderepo
1562d30584 fix(setup): retry login up to 3× with 90s timeout and 15s backoff
Hostinger rate-limits GitHub runner IPs on wp-login.php, causing
TimeoutError (30s) during the auth setup step. This has produced 6
deploy-gate failures over 2 days across multiple repos.

Changes:
- Raise navigation timeout from 30s to 90s per attempt
- Wrap the full login sequence in a retry loop (up to 3 attempts)
- Create a fresh BrowserContext per attempt so stale cookies / throttle
  state cannot carry over between retries
- Wait 15s between attempts to let transient throttle windows clear
- Log each attempt number and outcome clearly (console.log + console.error)
  so any future failure is diagnosable from the CI log without a local repro
- On final failure, surface a hint pointing to the Hostinger throttle cause

Assertion behaviour: unchanged. The #wpadminbar check and storageState
write are identical to before — retries only affect getting past wp-login.

No changes to smoke test assertions, playwright.config.ts, or workflow files.

Agent-Session: e2e-login-flake-20260612
2026-06-12 09:53:06 +07:00
peptiderepo
3c29588824 ci(deploy): promote smoke to a production gate (#10)
deploy-production now needs smoke; a smoke FAILURE blocks prod while a skipped
smoke (run_smoke:false) still allows it. Automated functional gate replacing
the removed human approval gate — hands-off but safe.

Agent-Session: cto gate-smoke

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 22:28:41 +07:00
peptiderepo
a09d210895 test(smoke): label-agnostic admin-menu check (#9)
The peptide CPT menu was restructured (no top-level 'Peptides' label), so the
text=Peptides assertion failed. Assert the CPT's admin link by href
(a[href*='post_type=peptide']) and toBeAttached — robust to label changes and
submenu (hidden-until-hover) placement.

Agent-Session: cto smoke-green

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 22:24:44 +07:00
peptiderepo
3ed4b10ecd test(smoke): fix remaining 6 failures (#8)
- 02 search: target the visible .hero-search instance; the old .first()
  selector matched the hidden header search-overlay (instance 1).
- 01 calculator: it auto-computes from the peptide preset; select the peptide
  and assert #prc-results, scoped to .prc-calculator (the old broad
  button[type=submit] selector clicked the PSA search button).
- 03 admin: 'const nav' had been swallowed into a comment (ReferenceError).
- 04 rest-api: PSA /search returns {results:[]} with no 'status' key; drop it.

Auth fixed separately via a dedicated staging CI admin (ci-smoke) + corrected
STAGING_WP_ADMIN_* secrets; the global.setup failure was cascading into these.

Agent-Session: cto smoke-green

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 22:20:39 +07:00
peptiderepo
655843e42b ci(monitor): drop false drift alerts (#7)
Compare prod-deployment SHA to main and ignore changes confined to .github/,
tests/, and docs/build files (which the deploy excludes) — so infra-only commits
don't trip a false 'prod behind main' alert every day.

Agent-Session: cto monitor-drift-filter

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 14:15:28 +07:00
peptiderepo
afb43e7a41 ci: harden deploy + add health monitor (#5)
* ci(deploy): retry rsync on Hostinger runner-IP throttle + best-effort inventory guard

Pilot surfaced an exit-255 SSH connection timeout (documented Hostinger
rate-limiting of concurrent runner IPs). rsync now retries 4x/25s; the plugin
count guard is best-effort so a throttled check can't fail a good deploy.

Agent-Session: cto harden-deploy

* ci: add daily Deploy Health Monitor (drift + deploy-failure)

Scheduled GitHub Actions check (runs on GitHub infra, not the dead local cron):
for each app repo, compares the latest production deployment SHA to main and
flags failed deploy runs. Opens one de-duplicated 'deploy-health' issue when
something is off — the alarm that was missing when deploys silently broke.

Agent-Session: cto deploy-health-monitor

---------

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 14:11:28 +07:00
peptiderepo
852f7b01a3 ci: add shared reusable deploy workflow (#4)
Single staging→smoke→production pipeline callable by every plugin/theme repo
via workflow_call. Replaces six copy-pasted per-repo deploy.yml files so deploy
logic is fixed once. Includes the pre/post active-plugin-count guard, LiteSpeed
purge, and health checks. Callers pass target_path + secrets: inherit.

Agent-Session: cto reusable-deploy

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 14:03:21 +07:00
peptiderepo
e183e26926 test(smoke): fix three stale assertions (#3)
- 01 calculator: page lives at /calculator/ (confirmed live), not
  /reconstitution-calculator/ — the 404 failed all 3 calc tests.
- 00 homepage: brand title is 'Peptide Repo' (with space); regex /peptiderepo/i
  never matched. Broadened to /peptide ?repo/i.
- 03 admin: required-plugin slug is 'prautoblogger' (WP dir), not 'pr-autoblogger'.

These were test bugs, not site regressions — the site serves all three correctly.

Agent-Session: cto smoke-triage

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-09 13:45:06 +07:00
peptiderepo
a31a39c898 Fix global.setup.ts: tolerate post-login redirect away from wp-admin (#2)
Third bug in the smoke-gate chain. With testDir + GH-Secrets fixes already in place, this unblocks the workflow-driven prod deploy.

Agent-Session: cto merge-peptide-e2e-post-login-fix
2026-05-14 19:30:29 +07:00
peptiderepo
c131db5fef Fix setup project: override testDir so global.setup.ts is discovered (#1)
Unblocks PRAutoBlogger workflow-driven prod deploys (broken since 2026-04-26 smoke gate add).

Agent-Session: cto merge-peptide-e2e-testdir-fix
2026-05-14 16:40:31 +07:00
peptiderepo
da79ee234f fix(ci): explicitly checkout peptide-e2e in workflow_call context
When smoke.yml runs via workflow_call from another repo (peptide-repo-core,
peptide-starter-theme, etc.), GitHub Actions checks out the CALLER's repo
by default. The caller has no package-lock.json, so setup-node's npm cache
lookup fails with 'Some specified paths were not resolved'.

Fix: add repository/ref to the checkout step so we always fetch peptide-e2e
regardless of who calls the workflow. This ensures npm ci and Playwright
have the correct test code and dependency lockfile.
2026-04-27 15:37:34 +00:00
peptiderepo
ef7b705111 fix: complete truncated test files in 03 and 04 specs
03-admin-plugins.spec.ts and 04-rest-api.spec.ts were cut off mid-test,
causing Playwright TypeScript parse failures and the smoke gate to show
0 jobs. Added the missing test bodies, assertions, and closing braces.

New tests added:
- PR Core Settings page loads (03)
- Peptide CPT verified via /wp-json/wp/v2/types/peptide (04)

Fixes smoke gate for all future deploys.
2026-04-27 05:39:26 +00:00
peptiderepo
3b8a7d3065 fix(ci): use inputs.base_url directly (default already declared); drop double-quote expression 2026-04-27 12:32:40 +07:00
peptiderepo
d781207252 fix(ci): correct working-directory — package-lock.json is at repo root, not e2e/ 2026-04-27 12:27:49 +07:00
peptiderepo
d46a1e4680 feat: initial Playwright smoke suite
20 tests across 5 files covering all plugin surfaces on staging:
- Homepage load and PHP fatal detection
- Reconstitution Calculator shortcode + math
- Peptide Search AI widget + AJAX response
- Admin: all plugins active, PSA + PRAutoBlogger settings pages
- REST API: prc/v1/presets, peptides/v1/search, compounds, CPT types

Staging shortcode pages:
  /reconstitution-calculator/ - [prc_calculator]
  /search-peptides/           - [peptide_search]
  /peptide-directory/         - [peptide_directory]

GHA workflow: smoke.yml supports manual dispatch + workflow_call
for use as a deploy gate from plugin repos.
2026-04-26 04:39:13 +00:00