vega-frontend-monorepo/apps/token-e2e/src/support/wallet-vega.functions.js
AndyWhiteVega d47d754ac9
Test/governance suite expansion (#1372)
* test: initial commit

* test: commit

* test: extra tests and references added also new tag 0.55.0 for builds

* test: lint

* test: back to 0.54 for capsule cypress until tests fixed

* test: skip two tests since wallet name no longer shown soon to be fixed

* test: couple more tests to fulfill ACs

* test: lint

* test: more tests

* test: lint

* test: extra check within test

* test: lint

* test: minor

* test: improve test flake and skip test bugs outstanding

* test: lint and increase epoch length by second

* test: more tests

* test: lint

* test: lint

* test: lint

* test: teardown functionality

* test: lint

* test: epoch speed up and network restart stuff

* test: lint

* test: change epoch duration

* test: timing tweaks due to failures in CI

* test: lint

* test: more timing tweaks

* test: lint

* test: timing tweak

* test: lint

* test: lint

* test: config changes
2022-09-16 18:12:08 +01:00

43 lines
1.6 KiB
JavaScript

const vegaWalletContainer = '[data-testid="vega-wallet"]';
const restConnectorForm = '[data-testid="rest-connector-form"]';
const vegaWalletNameElement = '[data-testid="wallet-name"]';
const vegaWalletName = Cypress.env('vegaWalletName');
const vegaWalletLocation = Cypress.env('vegaWalletLocation');
const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase');
Cypress.Commands.add('vega_wallet_import', () => {
cy.highlight(`Importing Vega Wallet ${vegaWalletName}`);
cy.exec(`vega wallet init -f --home ${vegaWalletLocation}`);
cy.exec(
`vega wallet import -w ${vegaWalletName} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet`,
{ failOnNonZeroExit: false }
);
cy.exec(
`vega wallet service run --network DV --automatic-consent --home ${vegaWalletLocation}`
);
cy.exec(`vega wallet version`)
.its('stdout')
.then((output) => {
cy.log(output);
});
});
Cypress.Commands.add('vega_wallet_connect', () => {
cy.highlight('Connecting Vega Wallet');
cy.get(vegaWalletContainer).within(() => {
cy.get('button')
.contains('Connect Vega wallet to use associated $VEGA')
.should('be.enabled')
.and('be.visible')
.click({ force: true });
});
cy.contains('rest provider').click();
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(vegaWalletName);
cy.get('#passphrase').click().type(vegaWalletPassphrase);
cy.get('button').contains('Connect').click();
});
cy.get(vegaWalletNameElement).should('be.visible');
});