-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor wallet ffi cucumber tests (#3259)
Description Refactored WalletFFI.feature into a working state, tested locally. Further refactoring and dead code removal would be beneficial. Motivation and Context Necessary to get WalletFFI.feature working. How Has This Been Tested? Tested locally, each scenario tested with: `./node_modules/.bin/cucumber-js --name "${scenario_name}"`
- Loading branch information
Showing
24 changed files
with
3,121 additions
and
751 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,136 @@ | ||
@wallet-ffi | ||
Feature: Wallet FFI | ||
# Increase heap memory available to nodejs if frequent crashing occurs with | ||
# error being be similar to this: `0x1a32cd5 V8_Fatal(char const*, ...)` | ||
|
||
Scenario: As a client I want to send Tari to a Public Key | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want to specify a custom fee when I send tari | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want to receive Tari via my Public Key while I am online | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
# It's just calling the encrypt function, we don't test if it's actually encrypted | ||
Scenario: As a client I want to be able to protect my wallet with a passphrase | ||
Given I have a base node BASE | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I set passphrase PASSPHRASE of ffi wallet FFI_WALLET | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
@long-running @broken | ||
Scenario: As a client I want to receive Tari via my Public Key sent while I am offline when I come back online | ||
Scenario: As a client I want to see my whoami info | ||
Given I have a base node BASE | ||
And I have wallet SENDER connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet SENDER | ||
And mining node MINER mines 4 blocks | ||
Then I wait for wallet SENDER to have at least 1000000 uT | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I stop wallet FFI_WALLET | ||
Then I want to get public key of ffi wallet FFI_WALLET | ||
And I want to get emoji id of ffi wallet FFI_WALLET | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
Scenario: As a client I want to be able to restore my ffi wallet from seed words | ||
Given I have a base node BASE | ||
And I have wallet SPECTATOR connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet SPECTATOR | ||
And mining node MINER mines 10 blocks | ||
Then I wait for wallet SPECTATOR to have at least 1000000 uT | ||
Then I recover wallet SPECTATOR into ffi wallet FFI_WALLET from seed words on node BASE | ||
And I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
Scenario: As a client I want to set the base node | ||
Given I have a base node BASE1 | ||
Given I have a base node BASE2 | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE1 | ||
And I set base node BASE2 for ffi wallet FFI_WALLET | ||
And I stop ffi wallet FFI_WALLET | ||
And I stop node BASE1 | ||
And I wait 5 seconds | ||
And I send 2000000 uT from wallet SENDER to wallet FFI_WALLET at fee 100 | ||
And I restart ffi wallet FFI_WALLET | ||
# Possibly check SAF messages, no way to get current connected base node peer from the library itself afaik | ||
# Good idea just to add a fn to do this to the library. | ||
# Then I wait for ffi wallet FFI_WALLET to receive 1 SAF message | ||
And I wait 5 seconds | ||
And I start wallet FFI_WALLET | ||
And wallet SENDER detects all transactions are at least Broadcast | ||
And mining node MINER mines 10 blocks | ||
Then I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
@long-running | ||
Scenario: As a client I want to retrieve a list of transactions I have made and received | ||
Scenario: As a client I want to cancel a transaction | ||
Given I have a base node BASE | ||
And I have wallet SENDER connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet SENDER | ||
And mining node MINER mines 4 blocks | ||
And mining node MINER mines 10 blocks | ||
Then I wait for wallet SENDER to have at least 1000000 uT | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I send 2000000 uT from wallet SENDER to wallet FFI_WALLET at fee 100 | ||
And wallet SENDER detects all transactions are at least Broadcast | ||
And mining node MINER mines 10 blocks | ||
Then I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And Check callbacks for finished inbound tx on ffi wallet FFI_WALLET | ||
And I have wallet RECEIVER connected to base node BASE | ||
And I stop wallet RECEIVER | ||
And I send 1000000 uT from ffi wallet FFI_WALLET to wallet RECEIVER at fee 100 | ||
And ffi wallet FFI_WALLET has 1 broadcast transaction | ||
And mining node MINER mines 4 blocks | ||
Then I wait for wallet RECEIVER to have at least 1000000 uT | ||
And Check callbacks for finished outbound tx on ffi wallet FFI_WALLET | ||
And I have 1 received and 1 send transaction in ffi wallet FFI_WALLET | ||
And I start STXO validation on wallet FFI_WALLET | ||
And I start UTXO validation on wallet FFI_WALLET | ||
|
||
# It's just calling the encrypt function, we don't test if it's actually encrypted | ||
Scenario: As a client I want to be able to protect my wallet with a passphrase | ||
Given I have a base node BASE | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I set passphrase PASSPHRASE of ffi wallet FFI_WALLET | ||
Then I wait for ffi wallet FFI_WALLET to have 1 pending outbound transaction | ||
Then I cancel all outbound transactions on ffi wallet FFI_WALLET and it will cancel 1 transaction | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
Scenario: As a client I want to manage contacts | ||
Given I have a base node BASE | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I have wallet WALLET connected to base node BASE | ||
And I wait 5 seconds | ||
And I add contact with alias ALIAS and pubkey WALLET to ffi wallet FFI_WALLET | ||
Then I have contact with alias ALIAS and pubkey WALLET in ffi wallet FFI_WALLET | ||
When I remove contact with alias ALIAS from ffi wallet FFI_WALLET | ||
Then I don't have contact with alias ALIAS in ffi wallet FFI_WALLET | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
Scenario: As a client I want to set the base node (should be persisted) | ||
Given I have a base node BASE1 | ||
Given I have a base node BASE2 | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE1 | ||
And I set base node BASE2 for ffi wallet FFI_WALLET | ||
Then BASE2 is connected to FFI_WALLET | ||
And I stop wallet FFI_WALLET | ||
And I wait 5 seconds | ||
And I start wallet FFI_WALLET | ||
Then BASE2 is connected to FFI_WALLET | ||
|
||
Scenario: As a client I want to see my public_key, emoji ID, address (whoami) | ||
Given I have a base node BASE | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
Then I want to get public key of ffi wallet FFI_WALLET | ||
And I want to get emoji id of ffi wallet FFI_WALLET | ||
|
||
Scenario: As a client I want to get my balance | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
@long-running | ||
Scenario: As a client I want to cancel a transaction | ||
Scenario: As a client I want to retrieve a list of transactions I have made and received | ||
Given I have a base node BASE | ||
And I have wallet SENDER connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet SENDER | ||
And mining node MINER mines 4 blocks | ||
And mining node MINER mines 10 blocks | ||
Then I wait for wallet SENDER to have at least 1000000 uT | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I send 2000000 uT from wallet SENDER to wallet FFI_WALLET at fee 100 | ||
And wallet SENDER detects all transactions are at least Broadcast | ||
And mining node MINER mines 10 blocks | ||
Then I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And I have wallet RECEIVER connected to base node BASE | ||
And I stop wallet RECEIVER | ||
And I send 1000000 uT from ffi wallet FFI_WALLET to wallet RECEIVER at fee 100 | ||
Then I wait for ffi wallet FFI_WALLET to have 1 pending outbound transaction | ||
Then I cancel all transactions on ffi wallet FFI_WALLET and it will cancel 1 transaction | ||
And mining node MINER mines 10 blocks | ||
Then I wait for wallet RECEIVER to have at least 1000000 uT | ||
And I have 1 received and 1 send transaction in ffi wallet FFI_WALLET | ||
And I start STXO validation on ffi wallet FFI_WALLET | ||
And I start UTXO validation on ffi wallet FFI_WALLET | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
@long-running | ||
Scenario: As a client I want to be able to restore my wallet from seed words | ||
Scenario: As a client I want to receive Tari via my Public Key sent while I am offline when I come back online | ||
Given I have a base node BASE | ||
And I have wallet WALLET connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet WALLET | ||
And mining node MINER mines 4 blocks | ||
Then I wait for wallet WALLET to have at least 1000000 uT | ||
Then I recover wallet WALLET into ffi wallet FFI_WALLET from seed words on node BASE | ||
And I wait for recovery of wallet FFI_WALLET to finish | ||
And I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And I have wallet SENDER connected to base node BASE | ||
And I have mining node MINER connected to base node BASE and wallet SENDER | ||
And mining node MINER mines 10 blocks | ||
Then I wait for wallet SENDER to have at least 1000000 uT | ||
And I have a ffi wallet FFI_WALLET connected to base node BASE | ||
And I stop ffi wallet FFI_WALLET | ||
And I wait 10 seconds | ||
And I send 2000000 uT from wallet SENDER to wallet FFI_WALLET at fee 100 | ||
And I wait 5 seconds | ||
And I restart ffi wallet FFI_WALLET | ||
Then I wait for ffi wallet FFI_WALLET to receive 1 transaction | ||
Then I wait for ffi wallet FFI_WALLET to receive 1 finalization | ||
# Assume tx will be mined to reduce time taken for test, balance is tested in later scenarios. | ||
# And mining node MINER mines 10 blocks | ||
# Then I wait for ffi wallet FFI_WALLET to have at least 1000000 uT | ||
And I stop ffi wallet FFI_WALLET | ||
|
||
# Scenario: As a client I want to get my balance | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
#Scenario: As a client I want to send Tari to a Public Key | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want to be able to initiate TXO and TX validation with the specifed base node. | ||
#Scenario: As a client I want to specify a custom fee when I send tari | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want async feedback about the progress of sending and receiving a transaction | ||
#Scenario: As a client I want to receive Tari via my Public Key while I am online | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want async feedback about my connection status to the specifed Base Node | ||
# Scenario: As a client I want to be able to initiate TXO and TX validation with the specifed base node. | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
# Scenario: As a client I want feedback about the progress of sending and receiving a transaction | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
|
||
Scenario: As a client I want async feedback about the wallet restoration process | ||
# Scenario: As a client I want feedback about my connection status to the specifed Base Node | ||
|
||
# Scenario: As a client I want feedback about the wallet restoration process | ||
# As a client I want to be able to restore my wallet from seed words | ||
|
||
Scenario: As a client I want async feedback about TXO and TX validation processes | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" | ||
# Scenario: As a client I want feedback about TXO and TX validation processes | ||
# It's a subtest of "As a client I want to retrieve a list of transactions I have made and received" |
Oops, something went wrong.