Skip to content

fix(feature-flags): repair e2e tests broken by Products module removal#213

Merged
antosubash merged 2 commits into
mainfrom
fix/feature-flags-e2e
May 23, 2026
Merged

fix(feature-flags): repair e2e tests broken by Products module removal#213
antosubash merged 2 commits into
mainfrom
fix/feature-flags-e2e

Conversation

@antosubash
Copy link
Copy Markdown
Owner

Summary

  • Root cause: When the Products module was removed in b269896, its ProductsFeatures : IModuleFeatures class was deleted. This left IFeatureFlagRegistry empty at runtime — GET /api/feature-flags always returned [] — causing all 4 e2e tests to fail at expect(flags.length).toBeGreaterThan(0).
  • Fix: Added FeatureFlagsFeatures : IModuleFeatures to FeatureFlags.Contracts with one flag (FeatureFlags.OverrideManagement). The source generator auto-registers it. GetAllFlagsAsync reads from the in-memory registry, so the flag is returned even before the sync service persists it to the DB.
  • Improvement: Both playwright.config.ts files now read PLAYWRIGHT_BASE_URL from the environment, enabling parallel agent test runs on different ports without hard-coded 5001.

Test plan

  • npx playwright test tests/e2e/tests/flows/feature-flags-crud.spec.ts --reporter=line --project=chromium → 5/5 pass (including auth setup)
  • npx biome check tests/e2e/ modules/FeatureFlags/ → clean (0 errors)
  • dotnet build template/SimpleModule.Host → Build succeeded, 0 warnings
  • Ran tests twice consecutively — deterministic results

When the Products module was removed (b269896), its ProductsFeatures class
(which implemented IModuleFeatures) was deleted. This left IFeatureFlagRegistry
empty at runtime, so GET /api/feature-flags always returned [] — causing all 4
feature-flags-crud e2e tests to fail at the first assertion.

Fix: add FeatureFlagsFeatures : IModuleFeatures to FeatureFlags.Contracts so the
registry always contains at least one flag (FeatureFlags.OverrideManagement).
The source generator auto-registers it, and GetAllFlagsAsync returns it from the
in-memory registry even before FeatureFlagSyncService persists it to the DB.

Also update both playwright.config.ts files to read PLAYWRIGHT_BASE_URL from
the environment, enabling parallel agent test runs on separate ports.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 23, 2026

Deploying simplemodule-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f9998d
Status: ✅  Deploy successful!
Preview URL: https://f9435882.simplemodule-website.pages.dev
Branch Preview URL: https://fix-feature-flags-e2e.simplemodule-website.pages.dev

View logs

@antosubash antosubash enabled auto-merge (squash) May 23, 2026 22:27
@antosubash antosubash merged commit 52b6290 into main May 23, 2026
6 checks passed
@antosubash antosubash deleted the fix/feature-flags-e2e branch May 23, 2026 22:30
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.

1 participant