Skip to content

Release: Staging improvements batch#211

Merged
zainfathoni merged 29 commits intomainfrom
staging
Feb 1, 2026
Merged

Release: Staging improvements batch#211
zainfathoni merged 29 commits intomainfrom
staging

Conversation

@zainfathoni
Copy link
Copy Markdown
Owner

Summary

This PR merges accumulated staging improvements to main.

Security

Database

Testing Infrastructure

Developer Experience

Accessibility

  • ARIA fix: Use aria-hidden on duplicate profile heading

Test Results

  • ✅ Type-check passes
  • ✅ 84/84 unit tests pass
  • ✅ 12/32 staging E2E tests pass (20 skipped by design - auth-dependent)

zainfathoni and others added 28 commits January 11, 2026 14:09
Add comprehensive testing guidelines covering:
- Unit testing with Vitest and Testing Library
- E2E testing with Playwright
- Test data generation patterns with test-data-bot
- Mocking strategies with MSW
- Coverage requirements and troubleshooting tips
- Add zod package for runtime schema validation
- Create schemas.ts with reusable validation schemas for:
  - Phone numbers (E.164 format)
  - Optional social media usernames
  - User profile form data
- Add parseFormData utility for Remix action functions
- Refactor profile edit route to use zod validation
- Add comprehensive tests for schema utilities
- Add aria-label to mobile profile name heading for accessibility
- Handle empty string redirectTo in schema (transform to default)
- Update test to use waitForURL instead of deprecated waitForNavigation
- Add test case for empty redirectTo string
feat(dx): improve developer experience with testing docs and zod validation
Switch from ElementHandle-based queries to Locator-based screen
queries from @playwright-testing-library/test. This provides proper
integration with Playwright's expect assertions and resolves the
"toBeVisible can be only used with Locator object" error.

- Use locatorFixtures instead of fixtures in base-test.ts
- Replace queries.getByRole with screen.getByRole
- Re-export expect from base-test for consistency
Configure MSW to intercept Mailgun API calls during E2E tests:
- Start MSW server automatically when RUNNING_E2E=true
- Capture magic links from intercepted email requests
- Write magic link to fixture file for login tests to consume
- Remove conditional logic from email service in favor of MSW interception
Remove duplicate aria-label by marking the desktop heading as aria-hidden.
This keeps one accessible heading (mobile) and avoids strict mode violations
in Playwright's getByLabel selector.

Closes rb-testing.4
feat(e2e): improve testing infrastructure with MSW and flaky test fixes
…uditLog entities

- Replace UUID with 12-character alphanumeric NanoID for shorter URLs
- Add Content entity for course content management
- Add Consumption entity to track user content progress
- Add AuditLog entity for compliance and debugging
- Add integration tests for seed script data integrity
- Update all entity creation code to use generateId()
- Create Prisma migration for new schema entities
- Add fixture directories for e2e tests

Amp-Thread-ID: https://ampcode.com/threads/T-019bbc11-36d1-71cb-9575-d090589f9c1b
Co-authored-by: Amp <amp@ampcode.com>
- Add Prisma middleware to auto-generate NanoID for missing IDs on create
- Add foreign key relation from Consumption.courseId to Course
- Update mock builders to use generateId() instead of faker UUID
- Update testing principles docs to use NanoID examples
The ~ path alias doesn't resolve when running seed.ts with esbuild-register
feat(db): update schema with NanoID, Content, Consumption, and AuditLog entities
WebKit doesn't reliably trigger blur-based validation error messages.
This is a known browser limitation documented in rb-webkit-validation.
The previous implementation relied solely on onBlur to show validation
errors, which is unreliable on WebKit/Safari browsers. The new approach:

- Tracks 'interacted' state (set on focus or change)
- Tracks 'focused' state (set on focus, cleared on blur)
- Shows errors when: interacted && !focused && errorMessage

This makes validation work consistently across all browsers without
needing to skip the E2E test on WebKit.

Closes: rb-webkit-validation
- Create playwright.staging.config.ts with staging baseURL and increased timeouts
- Add playwright-staging-setup.ts for auth fixture validation
- Create e2e/fixtures/auth/staging/ directory structure
- Add npm script test:e2e:staging
- Document staging E2E workflow in docs/testing-principles.md
- Update CLAUDE.md with staging test command
- Add *.staging.json to .gitignore for auth fixtures
Replace manual cookie export instructions with playwright codegen approach:
- Update playwright-staging-setup.ts documentation
- Update docs/testing-principles.md with codegen commands
Add test:e2e:staging:auth:member and test:e2e:staging:auth:author scripts
using playwright codegen --save-storage approach
- Update npm scripts to echo the correct email for each role
- Add admin auth script
- Update playwright-staging-setup.ts with staging emails
- Update docs/testing-principles.md with email table

Staging emails:
- member: member@rumahberbagi.com
- author: vika@rumahberbagi.com
- admin: admin@rumahberbagi.com
Session cookies were expiring immediately because the expires date was
calculated at server startup time. After 7+ days of server uptime, all
new cookies would have an expiration date in the past.

Also adds error feedback display on login page when email verification
fails (e.g., burner email, invalid format).

Closes rb-login-broken

Amp-Thread-ID: https://ampcode.com/threads/T-019bed38-9b38-74b0-8aa7-70eaf424dcc6

Co-authored-by: Amp <amp@ampcode.com>
feat(e2e): staging auth generation for E2E tests
- Create e2e/fixtures/index.ts with auto-detection of staging environment
- Update test files to use authFixtures helper instead of hardcoded paths
- Skip tests that require fixtures not available on staging:
  - profile.spec.ts (needs member-edit fixture)
  - transaction-details.spec.ts (needs data fixtures)
- Fix hardcoded localhost URL in transaction-details.spec.ts

Amp-Thread-ID: https://ampcode.com/threads/T-019bf342-cc32-75ec-8607-df28efdf96cd
Co-authored-by: Amp <amp@ampcode.com>
- Update transaction-details.spec.ts to use getDataFixturePath()
- Skip data-dependent tests on staging (DB refreshed from production)
- Profile tests skip on staging due to member state requirements

Amp-Thread-ID: https://ampcode.com/threads/T-019bf47c-5314-713b-bcfb-031a3b3f2da2
Co-authored-by: Amp <amp@ampcode.com>
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