-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(thief): thief playground #723
Conversation
WalkthroughThe recent updates significantly enhance the game application by refining UI elements, expanding interactive card selection features, and improving game logic for managing player actions and roles. These enhancements elevate the user experience with better visuals and increased interactivity, resulting in a more engaging and immersive gameplay environment. Changes
Sequence Diagram(s)sequenceDiagram
participant Player
participant Game as Game Component
participant Card as Card Component
participant Store as Game Store
Player->>Game: Choose option
Game->>Store: Update game state
Store-->>Game: Return updated state
Game->>Card: Render additional cards
Card->>Player: Display card options
Player->>Card: Select card
Card-->>Store: Update selected card
Store-->>Game: Notify selection change
Game->>Player: Update UI with selected card
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (1)
app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue (1)
1-28
: Consider using unique IDs or classes.Using IDs like
additional-card-button
andadditional-card-image
can lead to conflicts if multiple instances of this component are rendered. Consider using classes or ensuring IDs are unique.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (8)
public/svg/role/thief.svg
is excluded by!**/*.svg
tests/unit/specs/components/pages/about/AboutHowToContribute/__snapshots__/AboutHowToContribute.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubCompositionTab/__snapshots__/GameLobbyOptionsHubCompositionTab.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubRolesTab/GameLobbyOptionsHubRolesTabWolfHound/__snapshots__/GameLobbyOptionsHubRolesTabWolfHound.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/__snapshots__/GameLobbyOptionsHubTabView.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/__snapshots__/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/__snapshots__/GameChooseCardPlayground.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseSidePlayground/__snapshots__/GameChooseSidePlayground.nuxt.spec.ts.snap
is excluded by!**/*.snap
Files selected for processing (23)
- app/components/pages/about/AboutHowToContribute.vue (1 hunks)
- app/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubCompositionTab/GameLobbyOptionsHubCompositionTab.vue (1 hunks)
- app/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubRolesTab/GameLobbyOptionsHubRolesTabWolfHound/GameLobbyOptionsHubRolesTabWolfHound.vue (1 hunks)
- app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.vue (1 hunks)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue (1 hunks)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue (1 hunks)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/game-choose-card-playground-additional-card.types.ts (1 hunks)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseSidePlayground/GameChooseSidePlayground.vue (1 hunks)
- app/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayer.vue (1 hunks)
- app/composables/api/game/game-play/useCurrentGamePlay.ts (3 hunks)
- app/composables/api/game/types/game.class.ts (2 hunks)
- app/stores/role/useRolesStore.ts (2 hunks)
- modules/i18n/locales/en.json (1 hunks)
- modules/i18n/locales/fr.json (1 hunks)
- tests/unit/specs/components/pages/game-lobby/GameLobbyPlayersParty/GameLobbyPlayersParty.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts (2 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseSidePlayground/GameChooseSidePlayground.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayer.nuxt.spec.ts (3 hunks)
- tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts (2 hunks)
- tests/unit/specs/stores/role/useRolesStore.spec.ts (1 hunks)
- tests/unit/utils/factories/composables/api/game/game.factory.ts (1 hunks)
- tests/unit/utils/helpers/mount.helpers.ts (2 hunks)
Files skipped from review due to trivial changes (6)
- app/components/pages/about/AboutHowToContribute.vue
- app/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubCompositionTab/GameLobbyOptionsHubCompositionTab.vue
- app/components/pages/game-lobby/GameLobbyOptionsHub/GameLobbyOptionsHubTabView/GameLobbyOptionsHubRolesTab/GameLobbyOptionsHubRolesTabWolfHound/GameLobbyOptionsHubRolesTabWolfHound.vue
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseSidePlayground/GameChooseSidePlayground.vue
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseSidePlayground/GameChooseSidePlayground.nuxt.spec.ts
- tests/unit/specs/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayer.nuxt.spec.ts
Additional context used
GitHub Check: Lint 🔍
app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue
[failure] 33-33:
Missing return type on functionapp/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue
[failure] 88-88:
Missing return type on functiontests/unit/specs/components/pages/game-lobby/GameLobbyPlayersParty/GameLobbyPlayersParty.nuxt.spec.ts
[failure] 64-64:
Unsafe call of anany
typed value
[failure] 64-64:
Unsafe member access .$emit on anany
valuetests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts
[failure] 88-88:
Unsafe call of anany
typed value
[failure] 88-88:
Unsafe member access .$emit on anany
value
[failure] 100-100:
Unsafe call of anany
typed value
[failure] 100-100:
Unsafe member access .$emit on anany
valuetests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts
[failure] 39-39:
This line has a length of 240. Maximum allowed is 180tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts
[failure] 280-280:
it should match /^should .+ when .+\S.$|^$test$/u
Additional comments not posted (25)
app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/game-choose-card-playground-additional-card.types.ts (1)
1-14
: Well-structured type definitions.The type definitions for
GameChooseCardPlaygroundAdditionalCardProps
andGameChooseCardPlaygroundAdditionalCardEmits
are clear and follow TypeScript best practices. The imports are correctly typed.tests/unit/utils/factories/composables/api/game/game.factory.ts (1)
18-22
: Enhancement increateFakeGame
function.The addition of the
additionalCards
property and direct assignment ofvictory
andevents
improves the function's flexibility. Ensure that the removal of the default parameter forgame
does not break existing tests or code.Verification successful
No breaking changes detected for
createFakeGame
function.The
createFakeGame
function is used extensively throughout the codebase, primarily in test files. The search results indicate that the function is called with explicit arguments, suggesting that the removal of the default parameter should not cause issues. However, given the number of usages, it's advisable to run the test suite to ensure no unexpected issues arise.
- Ensure all tests pass to confirm the change does not introduce any regressions.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `createFakeGame` to ensure no breaking changes due to removal of default parameter. # Test: Search for the function usage. Expect: No errors due to missing arguments. rg --type javascript -A 5 $'createFakeGame('Length of output: 126
Script:
#!/bin/bash # Description: Verify the usage of `createFakeGame` to ensure no breaking changes due to removal of default parameter. # Test: Search for the function usage. Expect: No errors due to missing arguments. rg --type javascript -A 5 $'createFakeGame\\('Length of output: 81
Script:
#!/bin/bash # Description: Verify the usage of `createFakeGame` to ensure no breaking changes due to removal of default parameter. # Test: Search for the function usage in JavaScript files. Expect: No errors due to missing arguments. rg --glob '*.js' -A 5 $'createFakeGame\\('Length of output: 42
Script:
#!/bin/bash # Description: Verify the usage of `createFakeGame` to ensure no breaking changes due to removal of default parameter. # Test: Search for the function usage in JavaScript and TypeScript files. Expect: No errors due to missing arguments. rg --glob '*.{js,ts}' -A 5 $'createFakeGame\\('Length of output: 313676
app/stores/role/useRolesStore.ts (1)
31-33
: Addition ofgetRoleSideForRoleName
function.The new function
getRoleSideForRoleName
is a useful addition that enhances role management by retrieving the side associated with a given role name. The function is well-integrated into the store.app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue (1)
3-13
: Template logic is well-implemented.The use of
GlowCapture
and the dynamic rendering ofGameChooseCardPlaygroundAdditionalCard
components effectively enhance user interactivity.tests/unit/utils/helpers/mount.helpers.ts (1)
Line range hint
10-28
: Addition ofGlowCapture
to mounting options is appropriate.The inclusion of
GlowCapture
in the component mounting options enhances the flexibility of component testing.app/composables/api/game/types/game.class.ts (1)
44-46
: Addition ofadditionalCards
is well-integrated.The new
additionalCards
property enhances theGame
class's functionality, allowing it to store additional card data.app/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayer.vue (1)
80-80
: Styling update approved.The change from
"glow:border-green-500"
to"glow:border-emerald-500"
in theplayerSideGlowClass
computed property is a minor styling update that enhances the visual appearance for players not on the "werewolves" team.app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.vue (5)
2-14
: Enhanced component structure approved.The introduction of
GameEventWithTexts
andGameEventFlippingPlayersCard
components significantly improves the visual representation and interaction of the game event. This enhances the user experience by providing more context and feedback during the event.
39-43
: Computed properties improve clarity.The computed properties
thiefPlayer
,chosenCard
, andisThiefChosenCardRevealed
effectively encapsulate logic for determining the state of the game event. This approach enhances code readability and maintainability.
45-71
: Dynamic text generation enhances user feedback.The
gameThiefMayHaveChosenCardEventTexts
andgameThiefRevealedChosenCardTexts
computed properties dynamically generate text arrays based on the game state, providing clear and informative feedback to the user.
73-78
: SVG icon path computation approved.The
svgIconPath
computed property allows for conditional display of an SVG icon, which enhances the user interface by providing visual cues related to the game event.
80-80
: Sound effect integration approved.The invocation of
playSoundEffect("evil-laugh")
adds an auditory feedback element, making the game event more immersive and engaging for players.app/composables/api/game/game-play/useCurrentGamePlay.ts (2)
15-15
: New function addition approved.The addition of
getEligibleAdditionalCardsToChooseInCurrentGamePlay
enhances the gameplay logic by allowing retrieval of eligible additional cards based on the current game state. This function improves the interactivity and strategic depth of the game.
54-61
: Eligibility logic for additional cards approved.The logic within
getEligibleAdditionalCardsToChooseInCurrentGamePlay
correctly filters additional cards based on the recipient and usage status, ensuring that only eligible cards are returned. This enhances the game's decision-making processes.tests/unit/specs/components/pages/game-lobby/GameLobbyPlayersParty/GameLobbyPlayersParty.nuxt.spec.ts (1)
64-64
: Ensure safe usage of component instance.The use of
playerCard.vm.$emit
might involve anany
type. Ensure thatplayerCard.vm
is correctly typed to prevent unsafe calls and member access.Verification successful
Ensure type safety for
playerCard.vm
usage.In the test file,
playerCard.vm
is used without an explicit type, which could default toany
. To prevent unsafe calls, ensureplayerCard.vm
is explicitly typed, as seen in other instances where it is cast toVueVm
.
- Consider casting
playerCard.vm
toVueVm
or another appropriate type to ensure type safety.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the type of `playerCard.vm` to ensure it is not `any`. # Test: Search for the type definition of `playerCard.vm`. Expect: A specific type other than `any`. rg --type ts 'playerCard\.vm'Length of output: 3677
Tools
GitHub Check: Lint 🔍
[failure] 64-64:
Unsafe call of anany
typed value
[failure] 64-64:
Unsafe member access .$emit on anany
valuetests/unit/specs/stores/role/useRolesStore.spec.ts (1)
121-146
: Tests forgetRoleSideForRoleName
are well-structured.The new test cases for
getRoleSideForRoleName
effectively cover scenarios for existing and non-existing role names. These additions enhance the test coverage for the roles store.tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts (3)
2-3
: Imports look good.The new utility functions for creating fake game additional cards and simulating game play scenarios are appropriately imported.
45-52
: Function signature update is appropriate.The addition of an optional
options
parameter tomountGameChooseCardPlaygroundComponent
enhances flexibility in component mounting for testing purposes.
71-104
: Test cases for additional cards are comprehensive.The new test cases effectively verify the functionality of setting and unsetting chosen cards, enhancing test coverage.
Tools
GitHub Check: Lint 🔍
[failure] 88-88:
Unsafe call of anany
typed value
[failure] 88-88:
Unsafe member access .$emit on anany
value
[failure] 100-100:
Unsafe call of anany
typed value
[failure] 100-100:
Unsafe member access .$emit on anany
valuetests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts (2)
1-13
: Imports are appropriate for the test setup.The imported utilities and components are necessary for the test cases in this file.
25-284
: Test cases are comprehensive and well-structured.The test cases cover various scenarios for the
GameChooseCardPlaygroundAdditionalCard
component, including button classes and card image settings.Tools
GitHub Check: Lint 🔍
[failure] 39-39:
This line has a length of 240. Maximum allowed is 180tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts (1)
186-320
: New test cases are thorough and validate functionality.The new test cases for
getEligibleAdditionalCardsToChooseInCurrentGamePlay
effectively cover various scenarios and validate the function's behavior.Tools
GitHub Check: Lint 🔍
[failure] 280-280:
it should match /^should .+ when .+\S.$|^$test$/umodules/i18n/locales/en.json (2)
1484-1486
: LGTM: New entry for card selection prompt is well-structured.The key
chooseCardForRecipient
and the use of placeholders{roleName}
and{recipientDefiniteName}
are appropriate and consistent with the file's structure.
1487-1493
: LGTM: New entries for Thief scenarios are clear and consistent.The keys provide clear descriptions of various scenarios involving the Thief character, and the placeholders are used effectively.
modules/i18n/locales/fr.json (1)
1484-1485
: New localization entry looks good.The new entry "GameChooseCardPlaygroundAdditionalCard" with placeholders
{roleName}
and{recipientDefiniteName}
is correctly formatted and provides an appropriate French translation.
...Playground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue
Outdated
Show resolved
Hide resolved
...Playground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue
Show resolved
Hide resolved
...g/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue
Outdated
Show resolved
Hide resolved
...yground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts
Outdated
Show resolved
Hide resolved
...d/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts
Outdated
Show resolved
Hide resolved
tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
tests/acceptance/features/game/step-definitions/game-play/game-play.when-steps.ts (1)
6-6
: Inconsistent Renaming Detected: Update References tochooseSideInPlayground
.The function
chooseSideInPlayground
has not been fully renamed tochooseAdditionalCardInPlayground
throughout the codebase. Please update the following occurrences:
tests/acceptance/features/game/step-definitions/game-play/game-play.when-steps.ts
- Import statement
- Function call
tests/acceptance/features/game/helpers/game-play/game-play.when-steps-helpers.ts
- Function definition
- Export statement
Analysis chain
Verify Helper Function Renaming Consistency.
The function
chooseSideInPlayground
has been renamed tochooseAdditionalCardInPlayground
. Ensure all references to this function are updated throughout the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent renaming of `chooseSideInPlayground` to `chooseAdditionalCardInPlayground`. # Test: Search for the old function name. Expect: No occurrences of the old name. rg --type typescript 'chooseSideInPlayground'Length of output: 80
Script:
#!/bin/bash # Description: Verify consistent renaming of `chooseSideInPlayground` to `chooseAdditionalCardInPlayground`. # Test: Search for the old function name. Expect: No occurrences of the old name. rg --type ts 'chooseSideInPlayground'Length of output: 779
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (12)
tests/acceptance/screenshots/darwin/Hunter shoots Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/darwin/Sheriff delegates Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/darwin/Thief chooses card Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/darwin/Witch out of potions Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Hunter shoots Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Sheriff delegates Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Witch out of potions Playground.png
is excluded by!**/*.png
tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/__snapshots__/GameThiefMayHaveChosenCardEvent.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameTurnStartsEvent/GameThiefTurnStartsEvent/__snapshots__/GameThiefTurnStartsEvent.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/__snapshots__/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/__snapshots__/GameChooseCardPlayground.nuxt.spec.ts.snap
is excluded by!**/*.snap
tests/unit/specs/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayerRoleName/__snapshots__/GameTeamSidePlayerRoleName.nuxt.spec.ts.snap
is excluded by!**/*.snap
Files selected for processing (16)
- .run/Thief Role.run.xml (1 hunks)
- app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.vue (1 hunks)
- app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameTurnStartsEvent/GameThiefTurnStartsEvent/GameThiefTurnStartsEvent.vue (1 hunks)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue (1 hunks)
- app/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayerRoleName/GameTeamSidePlayerRoleName.vue (2 hunks)
- modules/i18n/locales/en.json (3 hunks)
- modules/i18n/locales/fr.json (3 hunks)
- tests/acceptance/features/game/features/role/thief.feature (1 hunks)
- tests/acceptance/features/game/helpers/game-play/game-play.when-steps-helpers.ts (2 hunks)
- tests/acceptance/features/game/step-definitions/game-options/game-options.given-steps.ts (1 hunks)
- tests/acceptance/features/game/step-definitions/game-play/game-play.then-steps.ts (3 hunks)
- tests/acceptance/features/game/step-definitions/game-play/game-play.when-steps.ts (2 hunks)
- tests/acceptance/features/game/step-definitions/player/player.then-steps.ts (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameTurnStartsEvent/GameThiefTurnStartsEvent/GameThiefTurnStartsEvent.nuxt.spec.ts (3 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayerRoleName/GameTeamSidePlayerRoleName.nuxt.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.vue
- modules/i18n/locales/en.json
- modules/i18n/locales/fr.json
Additional comments not posted (42)
.run/Thief Role.run.xml (1)
1-12
: Configuration is correctly set up.The Cucumber.js configuration for the "Thief Role" appears to be correctly defined with appropriate options and environment variables.
app/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayerRoleName/GameTeamSidePlayerRoleName.vue (3)
4-4
: UI Layout Change: Vertical AlignmentThe change from horizontal to vertical alignment of player role information improves visual organization and readability.
7-28
: New Role Icon LogicThe addition of a new
NuxtImg
for displaying a thief role icon when the player's original role was "thief" but is not currently "thief" adds valuable visual feedback for players.
45-45
: New Computed Property: Role LogicThe computed property
isPlayerOriginalRoleThiefButNotCurrently
centralizes role logic, enhancing maintainability and readability.app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameTurnStartsEvent/GameThiefTurnStartsEvent/GameThiefTurnStartsEvent.vue (2)
27-27
: New Computed Property: Werewolf Choice LogicThe computed property
mustThiefChooseBetweenWerewolves
effectively encapsulates the logic for determining if the thief must choose between werewolves, improving code clarity.
31-36
: Dynamic Event Text LogicThe updated logic for generating event texts based on
mustThiefChooseBetweenWerewolves
ensures accurate and context-sensitive messaging during gameplay.tests/acceptance/features/game/helpers/game-play/game-play.when-steps-helpers.ts (2)
54-54
: Export inclusion looks good.The addition of
chooseAdditionalCardInPlayground
to the exports is correctly implemented.
35-40
: Verify the button name construction logic.The logic for constructing the button name seems correct, but verify that the button names in the UI match the expected format.
tests/acceptance/features/game/step-definitions/game-play/game-play.then-steps.ts (2)
61-64
: Check the "Make Play" button state logic.The step definition correctly checks if the "Make Play" button is disabled. Ensure this aligns with the game's logic for when the button should be inactive.
18-28
: Ensure data table format matches expectations.The step definition for additional cards uses a data table. Ensure the format of the data table in the tests matches the expected structure.
Verification successful
Data Table Format Matches Expectations
The data table format used in the scenario matches the expected structure for the step definition. The table includes a
roleName
column, which aligns with the logic in the step definition that processescard.roleName
.
- The data table format in the
.feature
file is correctly structured with aroleName
column.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the data table format in tests matches the expected structure for additional cards. # Test: Search for scenarios using this step definition. Expect: Data tables have the correct format. rg --type feature 'the game\'s current play should have the following additional cards for'Length of output: 93
Script:
#!/bin/bash # Description: Verify that the data table format in tests matches the expected structure for additional cards. # Test: Search for scenarios using this step definition. Expect: Data tables have the correct format. rg --type feature "the game's current play should have the following additional cards for"Length of output: 127
Script:
#!/bin/bash # Description: Search for scenarios using the step definition in .feature files. # Test: Search for scenarios using this step definition in .feature files. fd --extension feature --exec rg "the game's current play should have the following additional cards for" {}Length of output: 200
Script:
#!/bin/bash # Description: Extract scenarios and data tables using the step definition in .feature files. # Test: Extract the scenario and data table for the step definition. fd --extension feature --exec rg -A 10 "the game's current play should have the following additional cards for" {}Length of output: 793
app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.vue (5)
2-13
: Template structure and bindings look correct.The use of
GameEventWithTexts
andGameEventFlippingPlayersCard
components enhances the UI. Ensure the bindings for texts and players are correctly reflecting the game state.
28-28
: Props definition is correctly implemented.The use of
defineProps<CurrentGameEventProps>()
enhances type safety and clarity.
61-72
: Dynamic text generation is well-implemented.The computed properties
gameThiefMayHaveChosenCardEventTexts
andgameThiefRevealedChosenCardTexts
provide contextual feedback. Ensure localization keys exist and are accurate.
74-79
: SVG icon path logic is appropriate.The conditional logic for displaying the SVG icon based on
chosenCard
is appropriate. Ensure the icon path is correct and accessible.
42-46
: Verify computed properties for game state.The computed properties
thiefPlayer
,chosenCard
, andisThiefChosenCardRevealed
are crucial for conditional rendering. Verify their logic aligns with the game state management.Verification successful
Verified: Computed properties align with game state management.
The computed properties
thiefPlayer
,chosenCard
, andisThiefChosenCardRevealed
are used appropriately for conditional rendering and game state checks, confirming their logic aligns with the intended game state management.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the logic of computed properties for game state in `GameThiefMayHaveChosenCardEvent.vue`. # Test: Search for the usage of these properties in the game store and related components. rg --type ts --type vue 'thiefPlayer|chosenCard|isThiefChosenCardRevealed'Length of output: 104
Script:
#!/bin/bash # Description: Verify the logic of computed properties for game state in `GameThiefMayHaveChosenCardEvent.vue`. # Corrected Test: Search for the usage of these properties in the game store and related components. rg --type vue --type ts 'thiefPlayer|chosenCard|isThiefChosenCardRevealed'Length of output: 104
Script:
#!/bin/bash # Description: Find all `.vue` files and search for the usage of the computed properties. # Find all `.vue` files and then search for the computed properties within those files. fd --extension vue --exec rg 'thiefPlayer|chosenCard|isThiefChosenCardRevealed' {}Length of output: 1313
tests/acceptance/features/game/step-definitions/player/player.then-steps.ts (3)
38-44
: LGTM!The step definition correctly checks if the player was originally the thief by verifying the visibility of the relevant image.
45-52
: LGTM!The step definition correctly checks if the player is on the specified side by verifying the visibility of the player element.
54-59
: LGTM!The step definition correctly checks if the player has the specified role by verifying the visibility of the relevant text element.
tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameTurnStartsEvent/GameThiefTurnStartsEvent/GameThiefTurnStartsEvent.nuxt.spec.ts (3)
11-16
: LGTM!The setup and initialization of the testing suite using
defaultGame
anduseGameStore
are clear and maintainable.
28-29
: LGTM!The test correctly verifies that the component matches the snapshot when rendered.
56-71
: LGTM!The test comprehensively verifies the expected texts for the game event, including scenarios with different game options.
tests/unit/specs/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayerRoleName/GameTeamSidePlayerRoleName.nuxt.spec.ts (4)
70-82
: LGTM!The test correctly verifies that the thief logo is displayed for players who were originally thieves but have changed roles.
84-88
: LGTM!The test correctly verifies that the thief logo is not displayed for players who were never originally thieves.
90-101
: LGTM!The test correctly verifies that the thief logo is not displayed for players who are still thieves.
103-118
: LGTM!The test correctly verifies that a tooltip is attached to the thief logo for players who were originally thieves.
tests/acceptance/features/game/step-definitions/game-play/game-play.when-steps.ts (2)
137-139
: New Step Definition Added.The new step definition for a thief or actor choosing a card with a specific role name is correctly implemented. Ensure this integrates well with existing scenarios and is covered by tests.
3-3
: Ensure Type Usage Consistency.The
GameAdditionalCardRecipientRoleName
type is imported but ensure it is used consistently throughout the codebase to maintain type safety.Verification successful
Type Usage is Consistent Across the Codebase
The type
GameAdditionalCardRecipientRoleName
is used consistently in various parts of the codebase, including test files, store files, and component files. No issues with its usage were found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent usage of `GameAdditionalCardRecipientRoleName` type across the codebase. # Test: Search for the type usage. Expect: Consistent usage across related files. rg --type typescript 'GameAdditionalCardRecipientRoleName'Length of output: 93
Script:
#!/bin/bash # Description: Verify consistent usage of `GameAdditionalCardRecipientRoleName` type across the codebase. # Test: Search for the type usage in TypeScript files. Expect: Consistent usage across related files. rg 'GameAdditionalCardRecipientRoleName' --glob '*.ts'Length of output: 6661
tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameThiefMayHaveChosenCardEvent/GameThiefMayHaveChosenCardEvent.nuxt.spec.ts (6)
1-21
: Ensure Proper Use of Factories and Mocks.The use of factory functions for creating fake game data is a good practice for isolating tests. Ensure these factories are up-to-date and correctly simulate real scenarios.
22-51
: Component Mounting and Setup.The setup for mounting the component and initializing the store is well-structured. Ensure that the
beforeEach
block resets the state appropriately for each test.
65-71
: Sound Effect Test.The test for playing the sound effect is specific and uses
toHaveBeenCalledExactlyOnceWith
, which is a good practice for verifying exact calls. Ensure the audio store mock is correctly set up.
73-125
: Game Event Texts Tests.The tests for verifying game event texts cover various scenarios. Ensure that all possible text combinations are tested, especially edge cases.
138-172
: Flipping Card Tests.The tests for the flipping card functionality handle both defined and undefined card scenarios. This is comprehensive, but ensure that any changes to the
GameEventFlippingPlayersCard
component are reflected here.
53-63
: Snapshot Testing.The snapshot tests ensure the component renders correctly. Verify that the snapshots are committed and reflect the expected UI.
Verification successful
Snapshot files are committed and up-to-date. All snapshot files are present in the repository and have been committed, indicating they reflect the expected UI.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all snapshot files are committed and up-to-date. # Test: Check for uncommitted snapshot changes. Expect: No uncommitted changes. git status --short | grep -E '.*\.snap$'Length of output: 42
Script:
#!/bin/bash # Find all snapshot files in the repository and check if they are committed. # List all snapshot files snapshot_files=$(git ls-files '*.snap') # Check if each snapshot file is committed for file in $snapshot_files; do if ! git log --oneline -- $file > /dev/null 2>&1; then echo "Uncommitted snapshot file found: $file" fi done # Output the list of snapshot files for verification echo "Snapshot files in the repository:" echo "$snapshot_files"Length of output: 37590
tests/acceptance/features/game/features/role/thief.feature (7)
1-3
: Feature Tagging and Description.The feature is well-tagged with
@thief-role
and@shard-3
, which helps in organizing and executing tests. Ensure these tags are consistent with the project's tagging strategy.
5-51
: Scenario: Thief Can Incarnate Role.The scenario covers the thief choosing a role from additional cards. Ensure that the game logic supports this scenario and that all steps are correctly implemented.
58-81
: Scenario: Thief Can Remain as Himself.The scenario tests the thief skipping the role choice. This is important for verifying the default behavior. Ensure that the game handles this scenario correctly.
82-114
: Scenario: Thief Chosen Card Revealed.This scenario tests the option where the thief's chosen card is revealed. Ensure that the game settings allow for this and that the scenario reflects the intended gameplay.
115-146
: Scenario: Thief Skipped Card Revealed.Similar to the previous scenario, this one tests the revelation of a skipped card. Ensure that the game logic supports this feature.
147-177
: Scenario: Thief Must Choose a Card.This scenario forces the thief to choose a card if all are werewolf-sided. Verify that the game rules enforce this condition.
178-211
: Scenario: Thief Allowed to Skip Werewolf Cards.This scenario tests the option to allow skipping even when all cards are werewolf-sided. Ensure that the game settings reflect this flexibility.
tests/acceptance/features/game/step-definitions/game-options/game-options.given-steps.ts (2)
217-222
: LGTM!The step definition for setting the thief's chosen card to be revealed to everyone follows the established pattern and appears correct.
224-228
: LGTM!The step definition for not forcing the thief to choose between all werewolves cards follows the established pattern and appears correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts (1)
186-320
: Test suite is comprehensive and well-structured.The test cases cover a wide range of scenarios for
getEligibleAdditionalCardsToChooseInCurrentGamePlay
. Consider standardizing test descriptions for consistency.- should return empty array when game additional cards are not set. + should return an empty array when game additional cards are not set.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts (2 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts (1 hunks)
- tests/unit/specs/composables/api/game/game-play/useCurrentGamePlay.spec.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.nuxt.spec.ts
- tests/unit/specs/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlaygroundAdditionalCard/GameChooseCardPlaygroundAdditionalCard.nuxt.spec.ts
Additional comments not posted (3)
app/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GameChooseCardPlayground/GameChooseCardPlayground.vue (3)
3-11
: Template structure looks good.The use of
GlowCapture
and thev-for
loop to render cards dynamically is appropriate. The event handling with@click-additional-card
is correctly set up.
31-40
: Function implementation is correct.The
onClickFromAdditionalCardButton
function correctly manages the selection state of additional cards.
15-21
: Ensure all imports are necessary.Review the imports to confirm that each one is needed for the component's functionality.
Verification successful
All imports are necessary and used.
The imports in
GameChooseCardPlayground.vue
are utilized appropriately within the component, confirming their necessity.
GameChooseCardPlaygroundAdditionalCard
is used in the template.useCurrentGamePlay
,GameAdditionalCard
,useMakeGamePlayDtoStore
, anduseGameStore
are used in the script logic.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the necessity of imports in the script section. # Test: Check if imported components and stores are used in the file. rg --type vue $'GameChooseCardPlaygroundAdditionalCard|useCurrentGamePlay|GameAdditionalCard|useMakeGamePlayDtoStore|useGameStore'Length of output: 159
Script:
#!/bin/bash # Description: Verify the necessity of imports in the script section. # Find the path of the GameChooseCardPlayground.vue file file_path=$(fd GameChooseCardPlayground.vue) # Check if the imported components and stores are used in the file if [[ -n "$file_path" ]]; then rg 'GameChooseCardPlaygroundAdditionalCard|useCurrentGamePlay|GameAdditionalCard|useMakeGamePlayDtoStore|useGameStore' "$file_path" -A 5 else echo "GameChooseCardPlayground.vue file not found." fiLength of output: 2135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (4)
tests/acceptance/screenshots/linux/Hunter shoots Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Sheriff delegates Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Thief chooses card Playground.png
is excluded by!**/*.png
tests/acceptance/screenshots/linux/Witch out of potions Playground.png
is excluded by!**/*.png
Files selected for processing (1)
- README.md (1 hunks)
Additional context used
Markdownlint
README.md
207-207: null
Multiple spaces after blockquote symbol(MD027, no-multiple-space-blockquote)
209-209: null
Multiple spaces after blockquote symbol(MD027, no-multiple-space-blockquote)
210-210: null
Multiple spaces after blockquote symbol(MD027, no-multiple-space-blockquote)
211-211: null
Multiple spaces after blockquote symbol(MD027, no-multiple-space-blockquote)
Quality Gate passedIssues Measures |
## [1.28.0](v1.27.0...v1.28.0) (2024-08-14) ### 🚀 Features * **game-lobby:** additional cards placement in manager ([#733](#733)) ([dd08cf2](dd08cf2)) * **game-lobby:** confirm leaving lobby with players ([#736](#736)) ([dbad613](dbad613)) * **game:** confirm before leaving ([#738](#738)) ([3c71999](3c71999)) * **thief:** thief playground ([#723](#723)) ([953324f](953324f)) * **wild-child:** transformation event ([#740](#740)) ([ec1a20c](ec1a20c)) ### ✅ Tests * **angel:** acceptance tests ([#732](#732)) ([d7f5c8b](d7f5c8b)) * **stuttering-judge:** acceptance tests ([#737](#737)) ([6840ebd](6840ebd)) ### 🧹 Chore * **deps:** update dependency @cucumber/cucumber to ^10.9.0 ([#744](#744)) ([14339bd](14339bd)) * **deps:** update dependency @nuxt/test-utils to ^3.14.1 ([#743](#743)) ([e86d2be](e86d2be)) * **deps:** update dependency @stylistic/eslint-plugin to ^2.6.2 ([#731](#731)) ([467a0ff](467a0ff)) * **deps:** update dependency @vueuse/core to ^10.11.1 ([#729](#729)) ([efade62](efade62)) * **deps:** update dependency @vueuse/nuxt to ^10.11.1 ([#730](#730)) ([ee4389c](ee4389c)) * **deps:** update dependency eslint to ^9.9.0 ([#734](#734)) ([e0a15a8](e0a15a8)) * **deps:** update dependency lint-staged to ^15.2.9 ([#741](#741)) ([482a616](482a616)) * **deps:** update dependency tailwindcss to ^3.4.10 ([#745](#745)) ([7e9b755](7e9b755)) * **deps:** update dependency tailwindcss to ^3.4.9 ([#727](#727)) ([d4b2e2c](d4b2e2c)) * **deps:** update dependency tsx to ^4.17.0 ([#724](#724)) ([0536f2c](0536f2c)) * **deps:** update dependency type-fest to ^4.24.0 ([#726](#726)) ([9d025a7](9d025a7)) * **deps:** update dependency vue to ^3.4.37 ([#728](#728)) ([c9e29c2](c9e29c2)) * **deps:** update stryker-js monorepo to ^8.5.0 ([#735](#735)) ([f9e692c](f9e692c)) * **deps:** update typescript-eslint monorepo to ^8.1.0 ([#739](#739)) ([7630b11](7630b11)) * **font-awesome:** pass all icons to svg ([#742](#742)) ([ec4a660](ec4a660))
🎉 This PR is included in version 1.28.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
New Features
Improvements
Tests