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

Harden scenario tests #200

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scenarioTests/features/account_deletion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ Feature: account deletion
Scenario: test template creation
Given I have a bot
When I create a test template
And I wait 0.2 seconds
Then I should have templates defined

Scenario: delete account
Given I have a bot
When I create a test template
And I wait 0.5 seconds
And I send the message "/config delete_account yes"
And I wait 0.1 seconds
Then 2 messages should be sent back
And the response should include the message "deleted all of your data stored in the bot"
And I should not have templates defined
4 changes: 2 additions & 2 deletions scenarioTests/features/health.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: Health Endpoint
Given I have a bot
When I send the message "/cancel"
And I send the message "/simple"
And I wait 0.4 seconds
And I wait 0.5 seconds
And I get the server endpoint "/health"
Then the response body should include "bc_bot_tx_states_count 1"
When I send the message "/cancel"
And I wait 0.4 seconds
And I wait 0.5 seconds
And I get the server endpoint "/health"
Then the response body should include "bc_bot_tx_states_count 0"
5 changes: 3 additions & 2 deletions scenarioTests/features/keyboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Feature: Bot suggestions keyboard
Scenario: Suggest last used values
Given I have a bot
When I send the message "/suggestions rm account:from"
And I wait 0.1 seconds
And I wait 0.2 seconds
And I send the message "/suggestions add account:from fromAccount"
And I wait 0.1 seconds
And I wait 0.3 seconds
When I send the message "1.00"
And I wait 0.2 seconds
Then 2 messages should be sent back
Expand All @@ -24,6 +24,7 @@ Feature: Bot suggestions keyboard
And I send the message "/suggestions add account:from fromAccount"
And I wait 0.2 seconds
And I create a simple tx with amount 1.23 and desc Test Tx and account:from someFromAccount and account:to someToAccount
And I wait 0.2 seconds
And I send the message "/list"
Then 1 messages should be sent back
And the response should include the message " someFromAccount -1.23 EUR"
Expand Down
32 changes: 16 additions & 16 deletions scenarioTests/features/list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ Feature: List transactions
Scenario: List
Given I have a bot
When I send the message "/deleteAll yes"
And I wait 0.2 seconds
And I wait 0.4 seconds
When I send the message "/list"
And I wait 0.1 seconds
Then 1 messages should be sent back
And the response should include the message "You might also be looking for archived transactions using '/list archived'."
When I create a simple tx with amount 1.23 and desc Test Tx and account:from someFromAccount and account:to someToAccount
And I wait 0.1 seconds
And I wait 0.2 seconds
When I send the message "/list"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "-1.23 EUR"
When I send the message "/archiveAll"
And I wait 0.1 seconds
And I wait 0.2 seconds
And I send the message "/list"
And I wait 0.1 seconds
And I wait 0.3 seconds
Then 1 messages should be sent back
And the response should include the message "You might also be looking for archived transactions using '/list archived'."

Expand All @@ -26,9 +26,9 @@ Feature: List transactions
When I send the message "/deleteAll yes"
And I wait 0.2 seconds
And I create a simple tx with amount 1.23 and desc Test Tx and account:from someFromAccount and account:to someToAccount
And I wait 0.1 seconds
And I wait 0.3 seconds
When I send the message "/list dated"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "; recorded on $today "

Expand All @@ -37,19 +37,19 @@ Feature: List transactions
When I send the message "/deleteAll yes"
And I wait 0.2 seconds
When I send the message "/list archived"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "You might also be looking for transactions using '/list'."
When I create a simple tx with amount 1.23 and desc Test Tx and account:from someFromAccount and account:to someToAccount
And I wait 0.1 seconds
And I wait 0.2 seconds
When I send the message "/list archived"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "You might also be looking for transactions using '/list'."
When I send the message "/archiveAll"
And I wait 0.1 seconds
And I wait 0.3 seconds
And I send the message "/list archived"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "-1.23 EUR"

Expand All @@ -58,11 +58,11 @@ Feature: List transactions
When I send the message "/deleteAll yes"
And I wait 0.2 seconds
And I create a simple tx with amount 1.23 and desc Test Tx and account:from someFromAccount and account:to someToAccount
And I wait 0.1 seconds
And I wait 0.3 seconds
And I create a simple tx with amount 1.23 and desc Another tx and account:from someFromAccount and account:to someToAccount
And I wait 0.1 seconds
And I wait 0.3 seconds
When I send the message "/list numbered"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "1) $today * "Test Tx""
And the same response should include the message "2) $today * "Another tx""
Expand All @@ -71,7 +71,7 @@ Feature: List transactions
Then 1 messages should be sent back
And the response should include the message "Successfully deleted the list entry specified"
When I send the message "/list numbered"
And I wait 0.1 seconds
And I wait 0.2 seconds
Then 1 messages should be sent back
And the response should include the message "1) $today * "Another tx""
When I send the message "/list rm 15"
Expand Down
3 changes: 3 additions & 0 deletions scenarioTests/features/start.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ Feature: start bot interaction
Scenario: Answer to start message
Given I have a bot
When I send the message "/start"
And I wait 0.2 seconds
Then 2 messages should be sent back
And the response should include the message "Welcome to this beancount bot!"
And the response should include the message "/cancel - Cancel any running commands or transactions"

Scenario: Answer to help message
Given I have a bot
When I send the message "/help"
And I wait 0.1 seconds
Then 1 messages should be sent back
And the response should include the message "/cancel - Cancel any running commands or transactions"

Scenario: Don't answer to random text in group chat
Given I have a bot
When I send the message "this is not a command and not a number and I am not in a tx"
And I wait 0.1 seconds
Then 0 messages should be sent back
1 change: 1 addition & 0 deletions scenarioTests/features/transactions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Feature: Transactions
When I send the message "12.34"
Then 2 messages should be sent back
When I send the message "/cancel"
And I wait 0.1 seconds
Then 1 messages should be sent back
And the response should include the message "currently running transaction has been cancelled"

Expand Down