chore: acs updated for token association (#1687)

This commit is contained in:
Joe Tsang 2022-10-10 09:22:41 +01:00 committed by GitHub
parent 2edd2d95ff
commit fb9505a8a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 13 deletions

View File

@ -40,6 +40,9 @@ module.exports = defineConfig({
vegaWalletPublicKey:
'02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65',
vegaWalletPublicKeyShort: '02ecea…2f65',
vegaWalletPublicKey2:
'7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535',
vegaWalletPublicKey2Short: '7f9cf0…5535',
vegaTokenContractAddress: '0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7',
vegaTokenAddress: '0x67175Da1D5e966e40D11c4B2519392B2058373de',
txTimeout: { timeout: 70000 },

View File

@ -14,9 +14,11 @@ const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
const ethWalletDissociateButton = '[href="/staking/disassociate"]';
const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
const connectedVegaKey = '[data-testid="connected-vega-key"]';
const associatedKey = '[data-test-id="associated-key"]';
const associatedAmount = '[data-test-id="associated-amount"]';
const disassocitiationWarning = '[data-testid="disassociation-warning"]';
const associateCompleteText = '[data-testid="transaction-complete-body"]';
const disassociationWarning = '[data-testid="disassociation-warning"]';
const vegaWallet = '[data-testid="vega-wallet"]';
context(
@ -47,7 +49,8 @@ context(
);
it('Able to associate tokens - from wallet', function () {
//1004-ASSO-008
//1004-ASSO-003
//1004-ASSO-005
//1004-ASSO-009
//1004-ASSO-030
//1004-ASSO-012
@ -162,7 +165,7 @@ context(
cy.get('button').contains('Select a validator to nominate').click();
cy.get(ethWalletDissociateButton).click();
cy.get(disassocitiationWarning).should('contain', warningText);
cy.get(disassociationWarning).should('contain', warningText);
cy.staking_page_disassociate_all_tokens();
@ -185,6 +188,8 @@ context(
it('Able to associate and disassociate vesting contract tokens', function () {
// 1004-ASSO-006
// 1004-ASSO-007
// 1004-ASSO-018
// 1004-ASSO-024
// 1004-ASSO-023
@ -268,15 +273,44 @@ context(
});
it('Not able to associate more tokens than owned', function () {
// 1004-ASSO-008
// 1004-ASSO-010
// No warning visible as described in AC, but the button is disabled
cy.get(ethWalletAssociateButton).first().click();
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); // button disabled with no input
cy.get(tokenAmountInputBox, { timeout: 10000 }).type(6500000);
cy.get(tokenSubmitButton, txTimeout).should('be.disabled');
});
// 1004-ASSO-004
it('Able to associate tokens to different public key of connected vega wallet', function () {
cy.get(ethWalletAssociateButton).first().click();
cy.get(associateWalletRadioButton).click();
cy.get(connectedVegaKey).should(
'have.text',
Cypress.env('vegaWalletPublicKey')
);
cy.get('[data-testid="manage-vega-wallet"]').click();
cy.get('[data-testid="select-keypair-button"]').click();
cy.get(connectedVegaKey).should(
'have.text',
Cypress.env('vegaWalletPublicKey2')
);
cy.staking_page_associate_tokens('2');
cy.get(vegaWallet).within(() => {
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
});
cy.get(associateCompleteText).should(
'have.text',
`Vega key ${Cypress.env(
'vegaWalletPublicKey2Short'
)} can now participate in governance and nominate a validator with your associated $VEGA.`
);
});
after(
'teardown environment to prevent test data bleeding into other tests',
function () {

View File

@ -11,20 +11,20 @@ declare global {
export function addVegaWalletImport() {
// @ts-ignore - ignoring Cypress type error which gets resolved when Cypress uses the command
Cypress.Commands.add('vega_wallet_import', () => {
cy.highlight(`Importing Vega Wallet ${Cypress.env('vegaWalletName')}`);
cy.exec(`vega wallet init -f --home ${Cypress.env('vegaWalletLocation')}`);
const walletName = Cypress.env('vegaWalletName');
const walletLocation = Cypress.env('vegaWalletLocation');
cy.highlight(`Importing Vega Wallet ${walletName}`);
cy.exec(`vega wallet init -f --home ${walletLocation}`);
cy.exec(
`vega wallet import -w ${Cypress.env(
'vegaWalletName'
)} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ${Cypress.env(
'vegaWalletLocation'
)}`,
`vega wallet import -w ${walletName} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ${walletLocation}`,
{ failOnNonZeroExit: false }
);
cy.exec(
`vega wallet service run --network DV --automatic-consent --home ${Cypress.env(
'vegaWalletLocation'
)}`
`vega wallet key generate -w ${walletName} -p ./src/fixtures/wallet/passphrase --home ${walletLocation}`
);
cy.exec(
`vega wallet service run --network DV --automatic-consent --home ${walletLocation}`
);
});
}