Skip to content
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

test(angel): acceptance tests #732

Merged
merged 1 commit into from
Aug 9, 2024
Merged

Conversation

antoinezanardi
Copy link
Owner

@antoinezanardi antoinezanardi commented Aug 9, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration for managing "Angel Role" test scenarios in the Cucumber.js environment.
    • Added detailed scenarios for the "Angel" role in the game, highlighting unique win conditions that enhance gameplay complexity.
  • Bug Fixes

    • Adjusted settings for improved execution of automated tests related to the "Angel Role."

@antoinezanardi antoinezanardi added the ✅ test Adding missing tests or correcting existing tests label Aug 9, 2024
@antoinezanardi antoinezanardi self-assigned this Aug 9, 2024
Copy link

coderabbitai bot commented Aug 9, 2024

Walkthrough

This update introduces a new XML configuration for Cucumber.js, specifically for the "Angel Role" in a game, enhancing automated testing capabilities. Additionally, a feature file is added, detailing scenarios where the Angel wins under specific conditions, thereby enriching the game's narrative and mechanics. These changes facilitate structured test execution and provide clearer gameplay interactions.

Changes

Files Change Summary
.run/Angel Role.run.xml Introduced a new XML configuration for the "Angel Role", detailing test paths, filters, command-line arguments, and environment settings.
tests/acceptance/features/game/features/role/angel.feature Added scenarios for the Angel role, outlining win conditions if eliminated by votes or killed by werewolves, thereby enhancing gameplay complexity.

Poem

🐰 In a world where angels play,
Votes and werewolves weave their sway.
With new roles, the game takes flight,
Twists of fate in moonlit night.
A little hop to cheer the fun,
Let the Angel's victory run! 🌕✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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 (2)
.run/Angel Role.run.xml (1)

3-3: Update the test path in configuration

The path $PROJECT_DIR$/tests/acceptance specified in .run/Angel Role.run.xml does not exist in the current repository structure. Test files are primarily located under tests/unit. Please update the configuration to reflect the correct path for your test files.

  • Consider organizing acceptance tests under a new directory if needed, or update the path to match existing test directories.
Analysis chain

Verify the file path for tests.

Ensure that the path $PROJECT_DIR$/tests/acceptance correctly points to the location of your test files.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the specified test path exists.

# Test: Check if the directory exists. Expect: Directory should exist.
if [ -d "$PROJECT_DIR/tests/acceptance" ]; then
  echo "Test path exists."
else
  echo "Test path does not exist."
fi

Length of output: 91


Script:

#!/bin/bash
# Search for test files in the repository to determine their location.
fd --type f --name '*test*' --exec echo "Test file found: {}"

Length of output: 314


Script:

#!/bin/bash
# Corrected command to search for test files in the repository.
fd 'test' --type f --exec echo "Test file found: {}"

Length of output: 1008

tests/acceptance/features/game/features/role/angel.feature (1)

48-87: Ensure clarity and consistency in scenario narratives.

The scenarios are well-structured, but ensure that the narrative is clear and consistent across different scenarios to avoid confusion.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 467a0ff and c8c1e75.

Files selected for processing (2)
  • .run/Angel Role.run.xml (1 hunks)
  • tests/acceptance/features/game/features/role/angel.feature (1 hunks)
Additional comments not posted (7)
.run/Angel Role.run.xml (1)

5-5: Review Cucumber.js arguments.

Ensure that the configuration file config/cucumber/cucumber.json exists and is correctly set up. Also, verify that the tag @angel-role is used in your feature files.

tests/acceptance/features/game/features/role/angel.feature (6)

5-13: Verify step definitions for scenario setup.

Ensure that the step definitions for disabling the sheriff, creating a game, and closing the toast are correctly implemented in your step definition files.


42-47: Verify step definitions for game conclusion.

Ensure that the step definitions for skipping all game events and checking the game's conclusion are correctly implemented.

Verification successful

Step definitions for game conclusion are correctly implemented.

The step definitions for skipping all game events and checking the game's conclusion are present in the codebase:

  • Skipping all game events: Implemented in tests/acceptance/features/game/step-definitions/game-event/game-event.when-steps.ts.
  • Game conclusion with title and subtitle: Implemented in tests/acceptance/features/game/step-definitions/game-over/game-victory/game-victory.then-steps.ts.
  • Game winners: Also implemented in tests/acceptance/features/game/step-definitions/game-over/game-victory/game-victory.then-steps.ts.

These implementations confirm that the necessary step definitions exist and are likely functioning as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of step definitions for game conclusion.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js 'the user skips all game events'
rg --type js 'the game should be over with title'
rg --type js 'the game winners should be the players'

Length of output: 155


Script:

#!/bin/bash
# Description: Re-verify the existence of step definitions for game conclusion in various file types.

# Test: Check for step definitions in JavaScript, TypeScript, and CoffeeScript files.
rg --type js 'the user skips all game events'
rg --type ts 'the user skips all game events'
rg --type coffee 'the user skips all game events'

rg --type js 'the game should be over with title'
rg --type ts 'the game should be over with title'
rg --type coffee 'the game should be over with title'

rg --type js 'the game winners should be the players'
rg --type ts 'the game winners should be the players'
rg --type coffee 'the game winners should be the players'

Length of output: 1257


22-23: Verify step definitions for advancing game events.

Ensure that the step definitions for advancing to the next game event text are correctly implemented.

Verification successful

Step definitions for advancing game events are correctly implemented.

The step definition for "the user goes to the next game event text" is present in the TypeScript file tests/acceptance/features/game/step-definitions/game-event/game-event.when-steps.ts. This confirms that the step is properly defined and implemented.

  • File: tests/acceptance/features/game/step-definitions/game-event/game-event.when-steps.ts
  • Lines:
    • When(/^the user goes to the next game event text$/u, async function(this: CustomWorld): Promise<void> {
    • When(/^the user goes to the next game event text with keyboard$/u, async function(this: CustomWorld): Promise<void> {
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of step definitions for advancing game events.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js 'the user goes to the next game event text'

Length of output: 58


Script:

#!/bin/bash
# Description: Expand the search for step definitions in different file types and variations in phrasing.

# Test: Check for step definitions in TypeScript files.
rg --type ts 'the user goes to the next game event text'

# Test: Check for step definitions in CoffeeScript files.
rg --type coffee 'the user goes to the next game event text'

# Test: Check for variations in phrasing in JavaScript files.
rg --type js 'user goes to next game event' -A 5

Length of output: 593


25-34: Verify step definitions for voting phase.

Ensure that the step definitions for the voting phase, including checking the play title, phase name, voters, and play status, are correctly implemented.

Verification successful

Step definitions for voting phase are correctly implemented.

The step definitions for the voting phase, including checking the play title, phase name, voters, and play status, are present and correctly implemented in the codebase.

  • Play Title: Implemented in tests/acceptance/features/game/step-definitions/game.then-steps.ts.
  • Phase Name: Implemented in tests/acceptance/features/game/step-definitions/game.then-steps.ts.
  • Voters: Implemented in tests/acceptance/features/game/step-definitions/game-play/game-play.then-steps.ts.
  • Play Status: Implemented in tests/acceptance/features/game/step-definitions/game-play/game-play.then-steps.ts.

These definitions ensure the functionality is covered as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of step definitions for voting phase.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js 'the game\'s current play title should be'
rg --type js 'the game\'s phase name should be'
rg --type js 'the game\'s current play should have the following voters'
rg --type js 'the game\'s current play can\'t be made for now'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify the existence of step definitions for voting phase.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js "the game's current play title should be"
rg --type js "the game's phase name should be"
rg --type js "the game's current play should have the following voters"
rg --type js "the game's current play can't be made for now"

Length of output: 257


Script:

#!/bin/bash
# Description: Verify the existence of step definitions for voting phase across all file types.

# Test: Check for step definitions. Expect: Definitions should be present.
rg "the game's current play title should be"
rg "the game's phase name should be"
rg "the game's current play should have the following voters"
rg "the game's current play can't be made for now"

Length of output: 32353


15-20: Verify step definitions for game event actions.

Ensure that the step definitions for skipping the game event and checking the game's event display and player cards are correctly implemented.

Verification successful

Step definitions for game event actions are implemented correctly.

The step definitions for skipping the game event and checking the game's event display and player cards are present in the codebase. Here are their locations:

  • When the user skips the game event: tests/acceptance/features/game/step-definitions/game-event/game-event.when-steps.ts
  • Then the game's event should display the text: tests/acceptance/features/game/step-definitions/game-event/game-event.then-steps.ts
  • And the game's event player card should have the name: tests/acceptance/features/game/step-definitions/game-event/game-event.then-steps.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of step definitions for game event actions.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js 'the user skips the game event'
rg --type js 'the game\'s event should display the text'
rg --type js 'the game\'s event player card should have the name'

Length of output: 140


Script:

#!/bin/bash
# Description: Verify the existence of step definitions for game event actions.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js "the user skips the game event"
rg --type js "the game's event should display the text"
rg --type js "the game's event player card should have the name"

Length of output: 177


Script:

#!/bin/bash
# Description: Expand the search to include other file types for step definitions.

# Test: Check for step definitions in JavaScript, TypeScript, and CoffeeScript files.
rg --type-add 'steps:*.{js,ts,coffee}' --type steps "the user skips the game event"
rg --type-add 'steps:*.{js,ts,coffee}' --type steps "the game's event should display the text"
rg --type-add 'steps:*.{js,ts,coffee}' --type steps "the game's event player card should have the name"

Length of output: 1099


36-40: Verify step definitions for voting actions.

Ensure that the step definitions for voting actions and checking player status are correctly implemented.

Verification successful

Step Definitions Verified

The step definitions for both voting actions and checking player status are correctly implemented in the codebase. Here are the relevant locations:

  • Voting Action: Found in tests/acceptance/features/game/step-definitions/game-play/game-play.when-steps.ts

    • When(/^the survivors vote with the votes$/u, { timeout: 10000 }, async function(this: CustomWorld, votes: DataTable): Promise<void> { ... }
  • Player Status Check: Found in tests/acceptance/features/game/step-definitions/player/player.then-steps.ts

    • Then(/^the player with name "(?<name>.+)" should be dead in the game$/u, async function(this: CustomWorld, playerName: string): Promise<void> { ... }

These definitions align with the feature file steps, confirming their presence and correctness.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of step definitions for voting actions.

# Test: Check for step definitions. Expect: Definitions should be present.
rg --type js 'the survivors vote with the votes'
rg --type js 'the player with name "Antoine" should be dead in the game'

Length of output: 125


Script:

#!/bin/bash
# Description: Broaden the search for step definitions across multiple file types.

# Test: Check for step definitions in JavaScript and other common step definition file types.
rg --type js,ts,coffee,feature 'the survivors vote with the votes'
rg --type js,ts,coffee,feature 'the player with name "Antoine" should be dead in the game'

Length of output: 251


Script:

#!/bin/bash
# Description: Search for step definitions in individual file types.

# Test: Check for step definitions in JavaScript files.
rg --type js 'the survivors vote with the votes'
rg --type js 'the player with name "Antoine" should be dead in the game'

# Test: Check for step definitions in TypeScript files.
rg --type ts 'the survivors vote with the votes'
rg --type ts 'the player with name "Antoine" should be dead in the game'

# Test: Check for step definitions in CoffeeScript files.
rg --type coffee 'the survivors vote with the votes'
rg --type coffee 'the player with name "Antoine" should be dead in the game'

# Test: Check for step definitions in feature files.
rg --type feature 'the survivors vote with the votes'
rg --type feature 'the player with name "Antoine" should be dead in the game'

Length of output: 863


Script:

#!/bin/bash
# Description: Search for related step definitions in TypeScript files.

# Test: Check for step definitions related to player status in TypeScript files.
rg --type ts 'should be dead in the game'
rg --type ts 'player with name'

Length of output: 12470

Copy link

sonarcloud bot commented Aug 9, 2024

@antoinezanardi antoinezanardi merged commit d7f5c8b into develop Aug 9, 2024
15 checks passed
@antoinezanardi antoinezanardi deleted the test/angel-acceptance-tests branch August 9, 2024 08:12
antoinezanardi pushed a commit that referenced this pull request Aug 14, 2024
## [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))
@antoinezanardi
Copy link
Owner Author

🎉 This PR is included in version 1.28.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released ✅ test Adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant