Test/add test for successful deposit (#399)
* add test for successful deposit * update tests for deposits page to use magic strings * remove unused variable * used vegapublickey variable
This commit is contained in:
parent
5339788e87
commit
348badca2a
@ -13,10 +13,12 @@
|
||||
"screenshotsFolder": "../../dist/cypress/apps/trading-e2e/screenshots",
|
||||
"chromeWebSecurity": false,
|
||||
"projectId": "et4snf",
|
||||
"defaultCommandTimeout": 10000,
|
||||
|
||||
"env": {
|
||||
"ethereumProviderUrl": "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8",
|
||||
"ethereumChainId": 3,
|
||||
"invalidDepositToAddress": "zzz85edfa7ffdb6ed996ca912e9258998e47bf3515c885cf3c63fb56b15de36f",
|
||||
"vegaPublicKey": "47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278",
|
||||
"vegaPublicKey2": "1a18cdcaaa4f44a57b35a4e9b77e0701c17a476f2b407620f8c17371740cf2e4",
|
||||
"truncatedVegaPubKey": "47836c…c7d278",
|
||||
|
@ -58,19 +58,47 @@ Feature: Deposits to vega wallet
|
||||
# Then I can see the deposit is Successfull
|
||||
# And Balance is updated to reflect deposit amount
|
||||
|
||||
Scenario: Validation errors
|
||||
# wallet is connected on before hook so this step may no longer be required
|
||||
# Given I connect my Ethereum wallet
|
||||
Scenario: Empty form Validation errors
|
||||
When I submit a deposit with empty fields
|
||||
Then I can see validation errors present
|
||||
And I enter an invalid public key
|
||||
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
|
||||
Then Invalid Vega key is shown
|
||||
And I enter an amount less than the minimum viable amount
|
||||
|
||||
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
|
||||
Then Amount too small message shown
|
||||
And I enter a valid amount
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
@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
|
||||
|
@ -10,12 +10,17 @@ export default class DepositsPage extends BasePage {
|
||||
cy.visit('/portfolio');
|
||||
cy.get(`a[href='/portfolio/deposit']`).click();
|
||||
cy.url().should('include', '/portfolio/deposit');
|
||||
cy.getByTestId('deposit-form').should('be.visible');
|
||||
}
|
||||
|
||||
verifyFormDisplayed() {
|
||||
cy.getByTestId('deposit-form').should('be.visible');
|
||||
}
|
||||
|
||||
checkModalContains(text: string) {
|
||||
cy.get('[role="dialog"]').contains(text).should('be.visible');
|
||||
}
|
||||
|
||||
updateForm(args?: { asset?: string; to?: string; amount?: string }) {
|
||||
if (args?.asset) {
|
||||
cy.get('select[name="asset"]').select(args.asset);
|
||||
@ -49,6 +54,12 @@ export default class DepositsPage extends BasePage {
|
||||
.should('be.visible');
|
||||
}
|
||||
|
||||
verifyInsufficientAmountMessage() {
|
||||
cy.getByTestId('input-error-text')
|
||||
.contains('Insufficient amount in Ethereum wallet')
|
||||
.should('be.visible');
|
||||
}
|
||||
|
||||
verifyNotApproved() {
|
||||
cy.get(this.amountError)
|
||||
.contains('Amount is above approved amount')
|
||||
|
@ -5,10 +5,6 @@ import DepositsPage from '../pages/deposits-page';
|
||||
const depositsPage = new DepositsPage();
|
||||
const ethWallet = new EthereumWallet();
|
||||
|
||||
const tBTC = Cypress.env('tBtcContract');
|
||||
const invalidPublicKey =
|
||||
'zzz85edfa7ffdb6ed996ca912e9258998e47bf3515c885cf3c63fb56b15de36f';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.mockWeb3Provider();
|
||||
});
|
||||
@ -38,30 +34,26 @@ When('I submit a deposit with empty fields', () => {
|
||||
depositsPage.submitForm();
|
||||
});
|
||||
|
||||
Then('I can see validation errors present', () => {
|
||||
Then('I can see empty form validation errors present', () => {
|
||||
depositsPage.verifyFieldsAreRequired();
|
||||
});
|
||||
|
||||
And('I enter an invalid public key', () => {
|
||||
Then('I enter the following deposit details in deposit form', (table) => {
|
||||
depositsPage.updateForm({
|
||||
asset: tBTC,
|
||||
to: invalidPublicKey,
|
||||
amount: '1',
|
||||
asset: table.rowsHash().asset,
|
||||
to: Cypress.env(table.rowsHash().to),
|
||||
amount: table.rowsHash().amount,
|
||||
});
|
||||
});
|
||||
|
||||
And('I submit the form', () => {
|
||||
depositsPage.submitForm();
|
||||
});
|
||||
|
||||
Then('Invalid Vega key is shown', () => {
|
||||
depositsPage.verifyInvalidPublicKey();
|
||||
});
|
||||
|
||||
And('I enter an amount less than the minimum viable amount', () => {
|
||||
depositsPage.updateForm({
|
||||
asset: tBTC,
|
||||
to: invalidPublicKey,
|
||||
amount: '0.00000000000001',
|
||||
});
|
||||
});
|
||||
|
||||
Then('Amount too small message shown', () => {
|
||||
depositsPage.verifyAmountTooSmall();
|
||||
});
|
||||
@ -73,3 +65,11 @@ And('I enter a valid amount', () => {
|
||||
Then('Not approved message shown', () => {
|
||||
depositsPage.verifyNotApproved();
|
||||
});
|
||||
|
||||
And('I can see the {string} modal is shown', (text) => {
|
||||
depositsPage.checkModalContains(text);
|
||||
});
|
||||
|
||||
And('Insufficient amount message shown', () => {
|
||||
depositsPage.verifyInsufficientAmountMessage();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user