vega-frontend-monorepo/apps/trading-e2e/src/integration/deposits.feature

152 lines
6.0 KiB
Gherkin
Raw Normal View History

Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
Feature: Deposits to vega wallet
Background:
Given I navigate to deposits page
# wallet is already connected before tests start and doesn't prompt the disconnected state
@ignore
Scenario: Connecting Ethereum wallet
Then I can see the eth not connected message "Connect your Ethereum wallet"
And the connect button is displayed
When I connect my Ethereum wallet
Then I can see the deposit form
@todo
Scenario: Cannot deposit if approved amount is 0 (approval amount is 0)
And I connect my Ethereum wallet
When I set "0" tokens to be approved
And I approve the asset tokens
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 50 |
And I click to the deposit the funds
And I approve the ethereum transaction
# The following step is valid and are commented out as currently it cannot be automated
# Then I can see the deposit is unsuccessful
@todo
Scenario: Cannot deposit if approved amount is lower than deposit amount
When I set "2" tokens to be approved
And I approve the asset tokens
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 50 |
And I click to the deposit the funds
And I approve the ethereum transaction
# The following step is valid and are commented out as currently it cannot be automated
# Then I can see the deposit is unsuccessful
@todo
Scenario: Can succesfully deposit (approved amount is greater than deposit)
When I set "200000000" tokens to be approved
And I approve the asset tokens
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 50 |
And I click to the deposit the funds
And I approve the ethereum transaction
# The following steps are valid and are commented out as currently they cannot be automated
# Then I can see the deposit is Successfull
# And Balance is updated to reflect deposit amount
Scenario: Empty form Validation errors
Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
When I submit a deposit with empty fields
Then I can see empty form validation errors present
Scenario: Invalid deposit public key validation error
When I enter the following deposit details in deposit form
| asset | tBTC TEST |
| to | invalidDepositToAddress |
| amount | 1 |
And I submit the form
Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
Then Invalid Vega key is shown
Scenario: Deposit amount too small validation
When I enter the following deposit details in deposit form
| asset | tBTC TEST |
| to | invalidDepositToAddress |
| amount | 0.00000000000000000000000000000000001 |
And I submit the form
Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
Then Amount too small message shown
Scenario: Deposit amount greater than approved amount validation
When I enter the following deposit details in deposit form
| asset | tBTC TEST |
| to | invalidDepositToAddress |
| amount | 788888888888888 |
And I submit the form
And Insufficient amount message shown
# Then Amount too small message shown
# And I enter a valid amount
# And I submit the form
Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
# This next step is being skipped due to account having approved status
# Then Not approved message shown
Scenario: Successful deposit
When I enter the following deposit details in deposit form
| asset | tBTC TEST |
| to | vegaPublicKey |
| amount | 1 |
And I submit the form
And I can see the 'deposit pending' modal is shown
Task/252 Eth wallet connection and deposit form validation tests (#309) * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add feature/scenarios for deposits * add file for auction orders tests * update feature file for deposits * update feature tests for deposit * add test for wallet not connected * fix lint warning * add mock ethereum provider to allow connecting ethereum wallet * add basic test for required validation errors * add aria for input errors for a11y and test targeting, expand submit form helper * use mnemonic for private key generation, update tests to not submit and just assert validation message updates * add chain id to cypress config * update scenario * remove feature file * lint fix * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * use mnemonic from github secret, update cypress.json env vars to match * fix typo in test name and mnemonic env var * update env variables * update eth wallet mnemonic env * Update libs/cypress/src/lib/eip1193-bridge.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * remove unused reference to chainId * update casing * chainId reference from cypress.json * Update apps/trading-e2e/cypress.json Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * ignore a known failing step in the test due to wallet connected having approved status * update testid * update tests for deposits * tidy up comments in custom cypress commands * add comment about eager connect when running in cypress * update deposits tests Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 19:37:09 +00:00
@todo
Scenario: Use the 'Use Maximum' button to populate amount input with the balance in the connected wallet
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 0 |
When I click the use maximum button
Then I can see the field is updated with the maximum amount of the asset from my wallet
@todo
Scenario: User is warned if the the amount to deposit is greater than what is available in the connected wallet"
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 60000000 |
And I click to the deposit the funds
Then an error message is shown stating not enough tokens in wallet to deposit
@todo
Scenario: Deposit to a vega wallet key which is not your own
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | VEGA KEY of another wallet |
| Amount | 50 |
And I click to the deposit the funds
And I approve the ethereum transaction
# The following steps are valid and are commented out as currently they cannot be automated
# Then I can see the deposit is Successfull
# And Balance is updated to reflect deposit amount
@todo
Scenario: Deposit when vega wallet is not connected
And I disconnect my vega wallet
And I can see the deposit form is displayed
And I select "" asset from the dropdown list
When I enter the following details
| Field | Value |
| To (Vega key) | xxxxxxxx |
| Amount | 50 |
And I click to the deposit the funds
And I approve the ethereum transaction
# The following step is valid and are commented out as currently it cannot be automated
# Then I can see the deposit is unsuccessful