Fix bugs and add Higher or Lower game with Playwright tests#30
Merged
Conversation
Bug fixes: - Landing.jsx: SignalR LobbyCreated handler registered before connection was ready (React child effects run before parent; guard with 'if (!isConnected) return') - CasinoHub.cs: UpdateLobbySettings used case-sensitive JSON deserialization, so camelCase 'chamberCount' from JS never mapped to PascalCase 'ChamberCount' in C# (add PropertyNameCaseInsensitive: true to JsonSerializerOptions) - Game.jsx: after a 'bang', the trigger overlay was never cleared, blocking the finished screen from rendering (SessionFinished handler now clears overlay after 2s) - GameView.jsx + RussianRouletteEngine.cs + IGameEngine.cs: chamberCount was missing from the public game state, showing '?' during active gameplay (add chamberCount to GetPublicState via settings parameter) Test infrastructure: - tests/playwright.config.js: config moved from root, uses local Docker stack - tests/global-setup.js: mints JWT tokens directly, bypasses Google OAuth - tests/casino-roulette-e2e.spec.js: full E2E — two players, lobby creation, settings update, ready-up, start, pull triggers to game over
New game: Higher or Lower - Players take turns guessing if the next card is higher or lower - Pot grows by BaseFine every card drawn; first wrong guess pays the pot - Ties count as correct (game lives on) - Deck auto-reshuffles if exhausted (52-card standard deck) - Ace = highest (14), 2 = lowest Backend: - HigherOrLowerEngine: full IGameEngine implementation with Fisher-Yates shuffle - HigherOrLowerSettings: baseFine + fineUnit (DKK, beers, etc.) - HigherOrLowerState: deck, currentCard, pot, turnOrder, history - New Guess hub method with GuessResult broadcast - IGameEngine.ApplyAction + GetPublicState now take settings parameter - GameStarted/GameStateUpdated broadcasts wrapped with gameType field - HigherOrLowerEngine registered in Program.cs Frontend: - HigherOrLower/GameView.jsx: card table, pot display, Higher/Lower buttons, guess history, correct/wrong overlay, game over screen - HigherOrLower/GameView.css: green card table, playing card components, animated overlays - Game.jsx: routes to correct view by gameType; handles GuessResult event - Lobby.jsx: game-type-specific settings form (baseFine/fineUnit vs chambers) - Landing.jsx: two start buttons (Russian Roulette + Higher or Lower) Tests: - casino-higher-or-lower-e2e.spec.js: full E2E two-player game - casino-roulette-e2e.spec.js: fix button selector after label change
- Button: add href/target/rel props (renders as <a> when href set) - Button: add 'success' variant - Button: update stories with AsLink and Success examples - New AppCard: service tile with icon, title, description, CTA button and badge support - New StatusCard: full-page centered auth status layout (login/pending/rejected) - Export AppCard and StatusCard from index.ts - Add css-modules.d.ts to fix pre-existing CSS module TypeScript errors
- Replace static HTML files (dashboard, login, pending, rejected, admin) with a Vite + React SPA following the same pattern as hello-world-app and casino-service - Pages use NavBar, Button, AppCard, StatusCard, Card, Badge from ui-library - DashboardPage: responsive AppCard grid of all services; admin cards shown conditionally based on user.isAdmin - AdminPage: stats row, tabbed user table with approve/reject/promote/demote/ fine-club/delete actions and confirmation modal — all in ui-library tokens - LoginPage: dark-theme Google sign-in button with proper branding - PendingPage: Check Status flow (refresh tokens then re-check /api/user) - RejectedPage: simple denied screen - server.js: replace inline HTML blobs with serveSPA() helper; all protected routes still enforce JWT auth before serving index.html - Dockerfile: multi-stage build (monorepo root context → build frontend → production Node stage)
- docker-compose.yml: change landing-page build from './landing-page' to context:'.' + dockerfile:'landing-page/Dockerfile' (matches hello-world-app and casino-service pattern) - build-deploy.yml: add landing-page matrix entry with monorepo root build context; add ui-library/** to landing-page change trigger
- Commit tests/package-lock.json (should have been tracked) - Add tests/playwright-report/ and tests/test-results/ to .gitignore (generated artifacts, change every run)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.