Skip to content

Commit

Permalink
test(acceptance): white werewolf acceptance tests (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Jun 18, 2024
1 parent 5a87e23 commit 700f730
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .run/White Werewolf Role.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="White Werewolf Role" type="cucumber.js" factoryName="Cucumber.js" folderName="Tags">
<option name="myFilePath" value="$PROJECT_DIR$/tests/acceptance" />
<option name="myNameFilter" value="" />
<option name="cucumberJsArguments" value="--config config/cucumber/cucumber.json --parallel 1 --tags @white-werewolf-role" />
<option name="workingDirectory" value="$PROJECT_DIR$" />
<envs>
<env name="NODE_OPTIONS" value="--import tsx/esm" />
</envs>
<method v="2" />
</configuration>
</component>
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ Werewolves Assistant Web is a Nuxt Web App using the Werewolves Assistant API. I
>>
>> </details>
>> <details>
>> <summary>🦴🐺 White Werewolf eats Playground</summary>
>>
>> ![White Werewolf eats Playground](https://github.com/antoinezanardi/werewolves-assistant-web-next/main/tests/acceptance/screenshots/darwin/White%20Werewolf%20eats%20Playground.png)
>> </details>
>> <details>
>> <summary>🤷 Game Playground without targets</summary>
>>
>> ![Game Playground without targets](https://github.com/antoinezanardi/werewolves-assistant-web-next/main/tests/acceptance/screenshots/darwin/Game%20Playground%20without%20targets.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: 🐦‍⬛ Scandalmonger role
And the user skips the game event
And the user skips the game event
Then the game's event should display the text "The Scandalmonger wakes up and can mark a player with a feather."
And the game's event player card should have the name "Antoine"

When the user goes to the next game event text
Then the game's event should display the text "The player marked with a feather will have 2 more votes against him the next vote."
Expand Down
134 changes: 134 additions & 0 deletions tests/acceptance/features/game/features/role/white-werewolf.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
@white-werewolf-role

Feature: 🦴🐺 White Werewolf role

Scenario: 🦴🐺 White Werewolf eats another wolf or can skip its turn every other night

Given the user disables the sheriff in game options
And the user creates a game with the players with name and role
| name | role |
| Antoine | Witch |
| Bob | White Werewolf |
| Charlie | Werewolf |
| David | Villager |
| Nelson | Scapegoat |
| Lucy | Little Girl |
When the user closes the toast
And the user skips all game events

Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "David"
Then the game's event should display the text "The White Werewolf wakes up and can eat another Werewolf if he wants to."
And the game's event player card should have the name "Bob"

When the user goes to the next game event text
Then the game's current play title should be "White Werewolf eats"
And the game's current play question should be "Does the White Werewolf want to eat another Werewolf ?"
And the game's phase name should be "Night 1"
And the game's current play should have the following targets
| name |
| Charlie |
And the page should match or creates the missing snapshot with name "White Werewolf eats Playground"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Witch uses potions"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Survivors vote"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "Lucy"
And the user skips all game events
Then the game's current play title should be "Witch uses potions"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Survivors vote"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "Antoine"
Then the game's event should display the text "The White Werewolf wakes up and can eat another Werewolf if he wants to."
And the game's event player card should have the name "Bob"

When the user goes to the next game event text
Then the game's current play title should be "White Werewolf eats"

When the white werewolf eats the player with name "Charlie"
Then the player with name "Charlie" should have the attribute eaten by white werewolf in the game

When the user skips all game events
Then the game's current play title should be "Witch uses potions"

When the player or group skips his turn
And the user skips all game events
Then the player with name "Charlie" should be dead in the game

Scenario: 🦴🐺 White Werewolf should not have any targets if there is no other werewolf to eat

Given the user disables the sheriff in game options
And the user creates a game with the players with name and role
| name | role |
| Antoine | Witch |
| Bob | White Werewolf |
| David | Villager |
| Nelson | Scapegoat |
And the user closes the toast
And the user skips all game events

Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "David"
Then the game's event should display the text "The White Werewolf wakes up and can eat another Werewolf if he wants to."
And the game's event player card should have the name "Bob"

When the user goes to the next game event text
Then the game's current play title should be "White Werewolf eats"
And the game's current play should not have targets

Scenario: 🦴🐺 White Werewolf wakes every night when game master sets its waking up interval to 1

Given the user disables the sheriff in game options
And the user sets the white werewolf waking up interval to 1 in game options
And the user creates a game with the players with name and role
| name | role |
| Antoine | Witch |
| Bob | White Werewolf |
| Charlie | Werewolf |
| David | Villager |
| Nelson | Scapegoat |
And the user closes the toast
And the user skips all game events

Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "David"
Then the game's event should display the text "The White Werewolf wakes up and can eat another Werewolf if he wants to."
And the game's event player card should have the name "Bob"

When the user goes to the next game event text
Then the game's current play title should be "White Werewolf eats"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Witch uses potions"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Survivors vote"

When the player or group skips his turn
And the user skips all game events
Then the game's current play title should be "Werewolves eat"

When the werewolves eat the player with name "Nelson"
And the user skips all game events
Then the game's current play title should be "White Werewolf eats"
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,11 @@ Given(/^the user sets the scandalmonger mark penalty to (?<markPenalty>\d+) in g
await openGameOptionsDialogInGameLobby(this);
await fillInputNumberInGameOptionsHub(this, "#game-lobby-options-hub-roles-tab-scandalmonger-mark-penalty-input", markPenalty);
await closeDialogWithHeaderButton(this);
});

Given(/^the user sets the white werewolf waking up interval to (?<wakingUpInterval>\d+) in game options$/u, async function(this: CustomWorld, wakingUpInterval: string): Promise<void> {
await goOnPage(this, "/game-lobby");
await openGameOptionsDialogInGameLobby(this);
await fillInputNumberInGameOptionsHub(this, "#game-lobby-options-hub-roles-tab-white-werewolf-waking-up-interval-input", wakingUpInterval);
await closeDialogWithHeaderButton(this);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 700f730

Please sign in to comment.