Add streak tracking with auto-submit, login prompts, comprehensive e2e tests, and CI/CD integration - #4
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
|
@copilot Make sure that once an unauthenticated user completes the puzzle and is prompted to log in, after they log in, then their puzzle score should also be submitted |
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Yes! The Neon workflow creates a branch database with the connection URL available as Update playwright:
name: Playwright E2E Tests
needs: create_neon_branch # Add dependency on Neon branch creation
timeout-minutes: 60
runs-on: ubuntu-latest
# Only run if we have a database URL (PR context)
if: always() && (needs.create_neon_branch.result == 'success' || github.event_name == 'push')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test:e2e
env:
# Use the branched database URL from Neon workflow
TEST_DATABASE_URL: ${{ needs.create_neon_branch.outputs.db_url_with_pooler }}
POSTGRES_URL: ${{ needs.create_neon_branch.outputs.db_url_with_pooler }}
DATABASE_URL: ${{ needs.create_neon_branch.outputs.db_url_with_pooler }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30Key changes:
The test setup script ( |
|
@copilot Can you integrate those changes for me |
Co-authored-by: NicolasWinsten <56099103+NicolasWinsten@users.noreply.github.com>
Done! Integrated in commit f2b4311. Changes made:
How it works:
The test setup script ( |
Implementation Plan: Daily Score & Streak Tracking
updateStreak()function to calculate and update user streaksgetStreak()function to retrieve user's current streakChanges Made
Core Functionality
updateStreak()andgetStreak()with proper date handling and edge case management/api/submit-scoreendpoint that submits scores and updates streaks atomicallyTesting Infrastructure
tests/db-test-setup.ts): Utilities to seed test database with 3 test users, streaks, and daily scorestests/global-setup.ts): Automatically seeds database before all Playwright teststests/streak-tracking.spec.ts): 9 comprehensive tests covering:CI/CD Integration
.github/workflows/neon_workflow.yml: Addedrun_testsjob that executes e2e tests with branched database URL.github/workflows/test.yml: Added database environment variables with proper fallbacks for different contextsImplementation Details
page.route()for authentication testing?dev=true&words=X&preventRestore=trueparams for controlled test scenariosDatabase Schema
Requires the following table to be created:
See
STREAKS_MIGRATION.mdfor complete setup details.Testing
CI/CD Workflow
The implementation includes full CI/CD integration:
The implementation provides complete streak tracking functionality with robust testing and CI/CD integration to ensure proper database interaction and user experience across authenticated and unauthenticated flows.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.