Skip to content

Feature/implement e2e tests with mock third party services - #490

Merged
webstackdev merged 32 commits into
mainfrom
feature/implement-e2e-tests-with-mock-third-party-services
Dec 2, 2025
Merged

webstackdev merged 32 commits into
mainfrom
feature/implement-e2e-tests-with-mock-third-party-services

Conversation

@webstackdev

@webstackdev webstackdev commented Dec 2, 2025

Copy link
Copy Markdown
Owner

Description

Add a container workflow to E2E tests that mocks third-party services, and implement tests that need the infrastructure

Type of Change

  • 🐛 Bug fix (bugfix/*)
  • 🔥 Hot fix (hotfix/*)
  • ✨ New feature (feature/*)
  • 🏗️ Infrastructure (infrastructure/*)
  • � Maintenance (maintenance/*)
  • �📝 Content update (content/*)
  • 📚 Documentation
  • 🎨 Style/UI change
  • ♻️ Code refactoring

Copilot AI review requested due to automatic review settings December 2, 2025 11:59
@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements comprehensive E2E testing infrastructure with mocked third-party services (Resend, Supabase) to enable full-stack integration testing. The implementation includes WireMock-based service mocks, fetch interception utilities, and extensive test coverage for newsletter workflows, contact forms, consent management, and cron jobs.

Key Changes:

  • Added WireMock client and fetch override utilities for mocking external services during E2E tests
  • Implemented full E2E test suites for newsletter double opt-in, contact forms, consent preferences, cron endpoints, and Supabase RLS policies
  • Enhanced API endpoints with mock service support via x-e2e-mocks header and Supabase fallback mode

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/e2e/specs/15-cron/cron.spec.ts New E2E tests for cron cleanup and ping endpoints with Supabase integration
test/e2e/specs/08-api/*.spec.ts Comprehensive API integration tests for Supabase RLS, newsletter, and contact endpoints
test/e2e/specs/03-forms/*.spec.ts Form E2E tests with fetch interception and mock service validation
test/e2e/specs/04-components/consentPreferences.spec.ts Full-stack consent flow tests with Supabase verification
test/e2e/helpers/mockServices.ts WireMock client for managing mock service requests and assertions
test/e2e/helpers/fetchOverride.ts Fetch interception utilities for spying, mocking, and header injection
test/containers/supabase/*.sh Supabase container management and logging scripts
src/pages/api/newsletter/*.ts E2E mocks support and Resend mock integration
src/pages/api/contact/index.ts Mock Resend support for contact form testing
src/pages/api/gdpr/consent.ts Supabase fallback mode for E2E tests
src/pages/api/_environment/environmentApi.ts Helper functions for mock service URLs and fallback detection
package.json Added test:e2e:full script with E2E_MOCKS environment variable

import {
getCronSecret,
getSuprabaseApiUrl,
getSuprabaseApiServiceRoleKey,

Copilot AI Dec 2, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in function name: "getSuprabaseApiServiceRoleKey" should be "getSupabaseApiServiceRoleKey" to match the correct spelling of "Supabase".

Copilot uses AI. Check for mistakes.
} from '@pages/api/_environment/environmentApi'

const CRON_SECRET = getCronSecret()
const SUPABASE_URL = getSuprabaseApiUrl()

Copilot AI Dec 2, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name uses incorrect spelling: "SUPABASE_URL" is assigned from "getSuprabaseApiUrl()" which contains a typo. Once the function name is corrected to "getSupabaseApiUrl", this will be resolved.

Copilot uses AI. Check for mistakes.

const CRON_SECRET = getCronSecret()
const SUPABASE_URL = getSuprabaseApiUrl()
const SUPABASE_SERVICE_ROLE_KEY = getSuprabaseApiServiceRoleKey()

Copilot AI Dec 2, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name uses incorrect spelling: "SUPABASE_SERVICE_ROLE_KEY" is assigned from "getSuprabaseApiServiceRoleKey()" which contains a typo. Once the function name is corrected to "getSupabaseApiServiceRoleKey", this will be resolved.

Copilot uses AI. Check for mistakes.
*/
import {
getCronSecret,
getSuprabaseApiUrl,

Copilot AI Dec 2, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in function name: "getSuprabaseApiUrl" should be "getSupabaseApiUrl" to match the correct spelling of "Supabase".

Copilot uses AI. Check for mistakes.
…rt animation-frame bursts with the new helper, footer.spec.ts switches to waitForPageLoad() + waitForURL('**/privacy'), so the assertion runs after Astro’s client-side navigation settles, internal privacy/consent links now honor trailingSlash: 'never', updated anchors in index.astro, GDPR checkbox defaults in index.astro, the confirmation copy in [token].astro, and the canonical path metadata in index.astro and index.astro, specs that relied on /privacy/ were aligned with the canonical slug (package-release.spec.ts, privacy-policy-version.spec.ts) so they no longer trigger the trailing-slash 404 banner.
… the listener now installs only once, records status/method/url for each 4xx response, and exposes reset404Errors() so each navigation starts from a clean slate, reworked the @ready main pages have no 404 errors coverage in critical-paths.spec.ts to enable the listener once, reset errors before every goto, and then assert. The loop no longer keeps stale entries from prior navigations or spins up redundant listeners, so the smoke check now exercises exactly one listener per Playwright page.
…ttenly on webkit spinner wait, added state-based selector instead of time-based in waitForSpinnerLoadingState() of NewsletterPage POM
…s by validating/regenerating DataSubjectId inside consent
@webstackdev
webstackdev merged commit 119a684 into main Dec 2, 2025
14 of 19 checks passed
@webstackdev
webstackdev deleted the feature/implement-e2e-tests-with-mock-third-party-services branch December 2, 2025 17:41
@webstackdev
webstackdev restored the feature/implement-e2e-tests-with-mock-third-party-services branch December 2, 2025 18:15
@webstackdev
webstackdev deleted the feature/implement-e2e-tests-with-mock-third-party-services branch December 2, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants