vega-frontend-monorepo/apps/token-e2e/src/integration/flow/token-association-flow.cy.js

99 lines
4.0 KiB
JavaScript
Raw Normal View History

const pageSpinner = 'splash-loader';
const menuBar = 'nav';
const validatorList = '[data-testid="node-list-item-name"]';
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
context(
'Token association flow - with eth and vega wallets connected',
function () {
before('visit staking tab and connect vega wallet', function () {
cy.vega_wallet_import();
cy.visit('/');
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
cy.vega_wallet_connect();
cy.vega_wallet_set_specified_approval_amount('1000');
cy.reload();
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
cy.ethereum_wallet_connect();
cy.navigate_to('staking');
cy.get(pageSpinner, { timeout: 20000 }).should('not.exist');
cy.get(validatorList).first().invoke('text').as('validatorName');
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
});
describe('Eth wallet - contains VEGA tokens', function () {
beforeEach(
'teardown wallet & drill into a specific validator',
function () {
cy.vega_wallet_teardown();
cy.navigate_to('staking');
cy.get(pageSpinner, { timeout: 20000 }).should('not.exist');
}
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
);
it('Able to associate tokens', function () {
cy.staking_page_associate_tokens('2');
cy.ethereum_wallet_check_associated_vega_key_value_is(
vegaWalletPublicKeyShort,
'2.000000000000000000'
);
cy.ethereum_wallet_check_associated_value_is('2.0');
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
});
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
it('Able to disassociate tokens', function () {
cy.staking_page_associate_tokens('2');
cy.ethereum_wallet_check_associated_vega_key_value_is(
vegaWalletPublicKeyShort,
'2.000000000000000000'
);
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.staking_page_disassociate_tokens('1');
cy.ethereum_wallet_check_associated_vega_key_value_is(
vegaWalletPublicKeyShort,
'1.000000000000000000'
);
cy.ethereum_wallet_check_associated_value_is('1.0');
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
});
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
cy.staking_page_associate_tokens('1001', true);
cy.ethereum_wallet_check_associated_vega_key_value_is(
vegaWalletPublicKeyShort,
'1,001.000000000000000000'
);
cy.ethereum_wallet_check_associated_value_is('1,001.00');
cy.vega_wallet_check_associated_value_is('1,001.000000000000000000');
});
it('Able to disassociate a partial amount of tokens currently associated', function () {
cy.staking_page_associate_tokens('2');
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.staking_page_disassociate_tokens('1');
cy.ethereum_wallet_check_associated_vega_key_value_is(
vegaWalletPublicKeyShort,
'1.000000000000000000'
);
cy.ethereum_wallet_check_associated_value_is('1.0');
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
});
it('Able to disassociate all tokens', function () {
cy.staking_page_associate_tokens('2');
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.staking_page_disassociate_all_tokens();
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
vegaWalletPublicKeyShort
);
cy.ethereum_wallet_check_associated_value_is('0.0');
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
});
Task/token flow tests (#695) * test(token-e2e): initial commit * test(token-e2e): lint * test: function Enhancements * test: linting * test: remove custom command type decs * test: more tests * test: linting * test: working with capsule still needs rounding issues sorting * test: enhancements * test: enhancements * test: check enhancements * test: add brdige logic * test: share instance rather than recreating on each test * test: minor bug fix, add comment * test: ensure working against capsule * test: teardown functions in place * test: linting * test: completion of first iteration of happy paths * test: lint * test: typo change * test: tweaks * test: fix merge issues * test: lint * test: env variable handling and cleanup * test: lint * test: enhancements to logging to aid debugging * test: lint * test: ehancements after feedback * test: lint * Update apps/token-e2e/src/support/wallet-teardown.functions.js Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com> * test: skipping non-essential tests to reduce time * test: typo * test: ci test fails coz capsule runs quicker their - disabled this one check to help * test: reduction of coverage to help PR time * test: disable infinte scroll test since capsule blockchain data to small * test: corrected test: staked tokens field value no longer in a fixed state * test: clearup to stop test bleed across projects plus bugfix * test: lint * test: update .env for trading * Revert "test: update .env for trading" This reverts commit 741743e4d2f9b7ab695dab52935467f9ae26e4a8. Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-07-08 10:48:51 +00:00
});
}
);