NutsNews Worker Fully Offline E2E Regression Test
Section titled “NutsNews Worker Fully Offline E2E Regression Test”This test runs the real Cloudflare Worker locally and mocks every external service it normally depends on.
It does not call production Supabase, OpenAI, Upstash Redis, Cloudflare KV, Better Stack, Vercel, or the live NutsNews website.
What it tests
Section titled “What it tests”The test starts local mock services for:
- RSS feed and article pages
- Local AI review endpoint
- Local AI translation endpoint
- Supabase/PostgREST tables and RPCs
- Web API and homepage rendering
Then it runs the real Worker through these scenarios:
- RSS article with a feed image is accepted.
- RSS article without a feed image is hydrated from article-page
og:imageand accepted. - Article with no RSS image and no article-page image is rejected.
- Article with blocked/political/market terms is rejected by local prefilter.
- Article that reaches AI is rejected by the mocked AI provider.
- Accepted articles are stored in the mocked
articlestable. - Review rows are stored in the mocked
article_ai_reviewstable. - French and Japanese summaries are stored in mocked
article_summaries. - Accepted articles are published and included in mocked
public_feed_snapshot. - Worker telemetry is stored in mocked
worker_runsandai_usage_runs. - Mock
/api/articlesreturns English, French, and Japanese versions. - Mock homepage HTML renders an accepted article.
- Translation recovery works if a published article is missing French/Japanese rows.
Run locally
Section titled “Run locally”From the repo root:
cd /Users/ramideltoro/WebstormProjects/nutsnews3/workernpm installcd ..node scripts/worker_offline_e2e_regression.mjsOr use the package script:
cd /Users/ramideltoro/WebstormProjects/nutsnews3/workernpm run test:e2e:offlineA successful run ends with:
✅ NutsNews fully offline Worker E2E regression passed.CI usage
Section titled “CI usage”This test is safe to run in GitHub Actions because it uses mocks only. It does not require repository secrets.
The included workflow is:
.github/workflows/worker-offline-e2e.ymlDefault local ports:
- Worker:
8787 - Mock AI:
8890 - Mock RSS/article pages:
8891 - Mock Supabase/PostgREST:
8892 - Mock web/homepage:
8893
Override ports only if needed:
NUTSNEWS_OFFLINE_E2E_WORKER_PORT=8877 \NUTSNEWS_OFFLINE_E2E_AI_PORT=8894 \NUTSNEWS_OFFLINE_E2E_RSS_PORT=8895 \NUTSNEWS_OFFLINE_E2E_SUPABASE_PORT=8896 \NUTSNEWS_OFFLINE_E2E_WEB_PORT=8897 \node scripts/worker_offline_e2e_regression.mjsThe script writes a temporary generated Wrangler config at:
worker/wrangler.offline-e2e.generated.jsoncThat generated file is ignored by Git.
Fast CI exit behavior
Section titled “Fast CI exit behavior”After the test prints ✅ NutsNews fully offline Worker E2E regression passed., the script stops Wrangler and the mock services, prints Cleanup complete; exiting Worker E2E regression with code 0., then explicitly exits. This prevents lingering Wrangler/server handles from making GitHub Actions appear stuck after success.
The script also has a watchdog timeout. Override it only if needed:
NUTSNEWS_OFFLINE_E2E_WATCHDOG_TIMEOUT_MS=180000 npm run test:e2e:offline