test(2061): token vegawallet v2 (#2150)
* test: use vega wallet v2 connect flow * test: update tests using wallet v2 * test: fix failing token test * test: add wait for spinner * chore: purge capsule teardown
This commit is contained in:
parent
f77fc9e131
commit
6b6c05f04d
@ -58,4 +58,3 @@ jobs:
|
||||
gobin: ${{needs.manual.outputs.gobin}}
|
||||
skip-cache: ${{needs.manual.outputs.skip-cache}}
|
||||
tags: ${{needs.manual.outputs.tags}}
|
||||
capsule-teardown: false
|
||||
|
@ -17,4 +17,3 @@ jobs:
|
||||
gobin: /home/runner/go/bin
|
||||
tags: --env.grepTags '[ @smoke, @regression, @slow ]'
|
||||
night-run: true
|
||||
capsule-teardown: false
|
||||
|
5
.github/workflows/cypress-explorer-e2e.yml
vendored
5
.github/workflows/cypress-explorer-e2e.yml
vendored
@ -24,10 +24,6 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
capsule-teardown:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
explorer-e2e:
|
||||
@ -100,7 +96,6 @@ jobs:
|
||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
|
||||
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
|
||||
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: ${{ inputs.capsule-teardown }}
|
||||
CYPRESS_NIGHTLY_RUN: ${{ inputs.night-run }}
|
||||
|
||||
######
|
||||
|
5
.github/workflows/cypress-token-e2e.yml
vendored
5
.github/workflows/cypress-token-e2e.yml
vendored
@ -20,10 +20,6 @@ on:
|
||||
tags:
|
||||
required: false
|
||||
type: string
|
||||
capsule-teardown:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
token-e2e:
|
||||
@ -96,7 +92,6 @@ jobs:
|
||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
|
||||
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
|
||||
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: ${{ inputs.capsule-teardown }}
|
||||
|
||||
######
|
||||
## Upload logs
|
||||
|
5
.github/workflows/tests-dispatcher.yml
vendored
5
.github/workflows/tests-dispatcher.yml
vendored
@ -20,9 +20,6 @@ on:
|
||||
night-run:
|
||||
required: false
|
||||
type: boolean
|
||||
capsule-teardown:
|
||||
required: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
run-console-lite-e2e:
|
||||
@ -45,7 +42,6 @@ jobs:
|
||||
skip-cache: ${{ inputs.skip-cache }}
|
||||
tags: ${{ inputs.tags }}
|
||||
night-run: ${{ inputs.night-run }}
|
||||
capsule-teardown: ${{ inputs.capsule-teardown }}
|
||||
|
||||
run-liquidity-e2e:
|
||||
uses: ./.github/workflows/cypress-liquidity-provision-dashboard-e2e.yml
|
||||
@ -68,7 +64,6 @@ jobs:
|
||||
gobin: ${{ inputs.gobin }}
|
||||
skip-cache: ${{ inputs.skip-cache }}
|
||||
tags: ${{ inputs.tags }}
|
||||
capsule-teardown: ${{ inputs.capsule-teardown }}
|
||||
|
||||
run-trading-e2e:
|
||||
uses: ./.github/workflows/cypress-trading-e2e.yml
|
||||
|
@ -202,15 +202,6 @@ context('Parties page', { tags: '@regression' }, function () {
|
||||
.and('include', darkThemeSideMenuBackgroundColor);
|
||||
});
|
||||
|
||||
after(
|
||||
'teardown environment to prevent test data bleeding into other tests',
|
||||
function () {
|
||||
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
|
||||
cy.restart_vegacapsule_network();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add('get_asset_decimals', (assetID) => {
|
||||
cy.get_asset_information().then((assetsInfo) => {
|
||||
const assetDecimals = assetsInfo[assetData[assetID].name].decimals;
|
||||
|
@ -51,6 +51,5 @@ module.exports = defineConfig({
|
||||
grepTags: '@regression @smoke @slow',
|
||||
grepFilterSpecs: true,
|
||||
grepOmitFiltered: true,
|
||||
TEARDOWN_NETWORK_AFTER_FLOWS: false,
|
||||
},
|
||||
});
|
||||
|
@ -54,7 +54,6 @@ context(
|
||||
{ tags: '@slow' },
|
||||
function () {
|
||||
before('connect wallets and set approval limit', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.visit('/');
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.get_network_parameters().then((network_parameters) => {
|
||||
@ -96,12 +95,7 @@ context(
|
||||
)[0]
|
||||
).as('maxCloseHours');
|
||||
});
|
||||
cy.vega_wallet_connect();
|
||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.ethereum_wallet_connect();
|
||||
});
|
||||
|
||||
describe('Eth wallet - contains VEGA tokens', function () {
|
||||
@ -137,6 +131,10 @@ context(
|
||||
);
|
||||
|
||||
beforeEach('visit governance tab', function () {
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.vega_wallet_connect();
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
});
|
||||
@ -846,15 +844,6 @@ context(
|
||||
const randomNum = Math.floor(Math.random() * 1000) + 1;
|
||||
return randomNum + ': Freeform e2e proposal';
|
||||
}
|
||||
|
||||
after(
|
||||
'teardown environment to prevent test data bleeding into other tests',
|
||||
function () {
|
||||
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
|
||||
cy.restart_vegacapsule_network();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -40,30 +40,22 @@ context(
|
||||
{ tags: '@slow' },
|
||||
function () {
|
||||
before('connect wallets and set approval limit', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.visit('/');
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.vega_wallet_connect();
|
||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.ethereum_wallet_connect();
|
||||
});
|
||||
|
||||
beforeEach('visit governance tab', function () {
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.vega_wallet_connect();
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.intercept('POST', '/query', (req) => {
|
||||
if (req.body.operationName === 'ProposalEvent') {
|
||||
req.alias = 'proposalSubmissionCompletion';
|
||||
}
|
||||
});
|
||||
cy.ensure_specified_unstaked_tokens_are_associated('1');
|
||||
});
|
||||
|
||||
it('Able to submit valid update network parameter proposal', function () {
|
||||
cy.navigate_to_page_if_not_already_loaded('governance');
|
||||
cy.ensure_specified_unstaked_tokens_are_associated('1');
|
||||
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||
// 3002-PROP-006
|
||||
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
||||
|
@ -33,22 +33,19 @@ context(
|
||||
function () {
|
||||
// 2001-STKE-002, 2001-STKE-032
|
||||
before('visit staking tab and connect vega wallet', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.visit('/');
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.vega_wallet_connect();
|
||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||
cy.reload();
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
});
|
||||
|
||||
describe('Eth wallet - contains VEGA tokens', function () {
|
||||
beforeEach(
|
||||
'teardown wallet & drill into a specific validator',
|
||||
function () {
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.vega_wallet_connect();
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.vega_wallet_teardown();
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
@ -870,15 +867,6 @@ context(
|
||||
|
||||
cy.get(stakeTokenSubmitButton).should('contain', 'Add 1 $VEGA tokens');
|
||||
});
|
||||
|
||||
after(
|
||||
'teardown environment to prevent test data bleeding into other tests',
|
||||
function () {
|
||||
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
|
||||
cy.restart_vegacapsule_network();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -26,22 +26,20 @@ context(
|
||||
{ tags: '@slow' },
|
||||
function () {
|
||||
before('visit staking tab and connect vega wallet', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.visit('/');
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.vega_wallet_connect();
|
||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||
cy.reload();
|
||||
cy.verify_page_header('The $VEGA token');
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
});
|
||||
|
||||
describe('Eth wallet - contains VEGA tokens', function () {
|
||||
beforeEach(
|
||||
'teardown wallet & drill into a specific validator',
|
||||
function () {
|
||||
cy.reload();
|
||||
cy.wait_for_spinner();
|
||||
cy.vega_wallet_connect();
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.vega_wallet_teardown();
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
@ -310,15 +308,6 @@ context(
|
||||
)} 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 () {
|
||||
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
|
||||
cy.restart_vegacapsule_network();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -27,15 +27,17 @@ context(
|
||||
function () {
|
||||
before('visit withdrawals and connect vega wallet', function () {
|
||||
cy.updateCapsuleMultiSig(); // When running tests locally, will fail if run without restarting capsule
|
||||
cy.vega_wallet_import();
|
||||
cy.deposit_asset(usdcEthAddress);
|
||||
});
|
||||
|
||||
beforeEach('Navigate to withdrawal page', function () {
|
||||
cy.reload();
|
||||
cy.visit('/');
|
||||
cy.navigate_to('withdrawals');
|
||||
cy.wait_for_spinner();
|
||||
cy.vega_wallet_connect();
|
||||
cy.ethereum_wallet_connect();
|
||||
cy.vega_wallet_teardown();
|
||||
});
|
||||
|
||||
it('Able to open withdrawal form with vega wallet connected', function () {
|
||||
|
@ -137,7 +137,6 @@ context('Staking Page - verify elements on page', function () {
|
||||
{ tags: '@smoke' },
|
||||
function () {
|
||||
before('connect wallets and click on validator', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.vega_wallet_connect();
|
||||
cy.click_on_validator_from_list(0);
|
||||
});
|
||||
|
@ -152,7 +152,6 @@ context(
|
||||
|
||||
describe('when vega wallet connected', function () {
|
||||
before('connect vega wallet', function () {
|
||||
cy.vega_wallet_import();
|
||||
cy.visit('/');
|
||||
cy.vega_wallet_connect();
|
||||
});
|
||||
@ -400,15 +399,6 @@ context(
|
||||
.contains(currency.name);
|
||||
});
|
||||
});
|
||||
|
||||
after(
|
||||
'teardown environment to prevent test data bleeding into other tests',
|
||||
function () {
|
||||
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
|
||||
cy.restart_vegacapsule_network();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -174,6 +174,8 @@ Cypress.Commands.add('get_sort_order_of_supplied_array', (suppliedArray) => {
|
||||
Cypress.Commands.add('go_to_make_new_proposal', (proposalType) => {
|
||||
cy.navigate_to_page_if_not_already_loaded('governance');
|
||||
cy.get(newProposalButton).should('be.visible').click();
|
||||
cy.url().should('include', '/governance/propose');
|
||||
cy.wait_for_spinner();
|
||||
cy.get('li').contains(proposalType).click();
|
||||
});
|
||||
|
||||
|
@ -98,7 +98,7 @@ Cypress.Commands.add('staking_page_disassociate_tokens', (amount, options) => {
|
||||
);
|
||||
cy.get(ethWalletDissociateButton).first().click();
|
||||
|
||||
cy.get(vegaKeySelector)
|
||||
cy.get(vegaKeySelector, txTimeout)
|
||||
.invoke('attr', 'disabled')
|
||||
.then((disabled) => {
|
||||
if (!disabled) {
|
||||
|
@ -1,12 +1,9 @@
|
||||
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 vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase');
|
||||
|
||||
Cypress.Commands.add('vega_wallet_connect', () => {
|
||||
cy.highlight('Connecting Vega Wallet');
|
||||
cy.get(vegaWalletContainer).within(() => {
|
||||
cy.get(vegaWalletContainer, { timeout: 6000 }).within(() => {
|
||||
cy.get('button')
|
||||
.contains('Connect Vega wallet to use associated $VEGA')
|
||||
.should('be.enabled')
|
||||
@ -15,12 +12,7 @@ Cypress.Commands.add('vega_wallet_connect', () => {
|
||||
});
|
||||
// Connect with gui as its the v1 service and tests should still pass. This will need
|
||||
// to be update to use v2
|
||||
cy.getByTestId('connector-gui').click();
|
||||
cy.get(restConnectorForm).within(() => {
|
||||
cy.get('#wallet').click().type(vegaWalletName);
|
||||
cy.get('#passphrase').click().type(vegaWalletPassphrase);
|
||||
cy.get('button').contains('Connect').click();
|
||||
});
|
||||
cy.getByTestId('connector-cli').click();
|
||||
cy.get(vegaWalletNameElement).should('be.visible');
|
||||
});
|
||||
|
||||
|
@ -9,9 +9,7 @@ import { addSlackCommand } from './lib/commands/slack';
|
||||
import { addHighlightLog } from './lib/commands/highlight-log';
|
||||
import { addGetAssetInformation } from './lib/commands/get-asset-information';
|
||||
import { addVegaWalletReceiveFaucetedAsset } from './lib/commands/vega-wallet-receive-fauceted-asset';
|
||||
import { addVegaWalletImport } from './lib/commands/vega-wallet-import';
|
||||
import { addContainsExactly } from './lib/commands/contains-exactly';
|
||||
import { addRestartVegacapsuleNetwork } from './lib/commands/restart-vegacapsule-network';
|
||||
import { addGetNetworkParameters } from './lib/commands/get-network-parameters';
|
||||
import { addUpdateCapsuleMultiSig } from './lib/commands/add-validators-to-multisig';
|
||||
import { addVegaWalletConnect } from './lib/commands/vega-wallet-connect';
|
||||
@ -25,9 +23,7 @@ addMockWeb3ProviderCommand();
|
||||
addHighlightLog();
|
||||
addVegaWalletReceiveFaucetedAsset();
|
||||
addGetAssetInformation();
|
||||
addVegaWalletImport();
|
||||
addContainsExactly();
|
||||
addRestartVegacapsuleNetwork();
|
||||
addGetNetworkParameters();
|
||||
addUpdateCapsuleMultiSig();
|
||||
addVegaWalletConnect();
|
||||
|
@ -1,49 +0,0 @@
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Cypress {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface Chainable<Subject> {
|
||||
restart_vegacapsule_network(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function addRestartVegacapsuleNetwork() {
|
||||
Cypress.Commands.add('restart_vegacapsule_network', () => {
|
||||
Cypress.on('uncaught:exception', () => {
|
||||
// stopping the network causes errors with pending transactions
|
||||
// This stops those errors from preventing the teardown
|
||||
return false;
|
||||
});
|
||||
cy.log('Destroying capsule network');
|
||||
// We stop the network twice - since it does not always shutdown correctly on first attempt
|
||||
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
|
||||
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
|
||||
.its('stderr')
|
||||
.should('contain', 'Network has been successfully cleaned up');
|
||||
|
||||
cy.log('Bootstrapping network');
|
||||
cy.exec(
|
||||
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
|
||||
{ failOnNonZeroExit: false, timeout: 100000 }
|
||||
)
|
||||
.its('stderr')
|
||||
.then((response) => {
|
||||
if (!response.includes('Network successfully started')) {
|
||||
cy.log('Bootstrapping network second time');
|
||||
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
|
||||
.its('stderr')
|
||||
.should('contain', 'Network has been successfully cleaned up');
|
||||
cy.exec(
|
||||
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
|
||||
{ failOnNonZeroExit: false, timeout: 100000 }
|
||||
)
|
||||
.its('stderr')
|
||||
.then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
})
|
||||
.should('contain', 'Network successfully started');
|
||||
});
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Cypress {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface Chainable<Subject> {
|
||||
vega_wallet_import(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function addVegaWalletImport() {
|
||||
// @ts-ignore - ignoring Cypress type error which gets resolved when Cypress uses the command
|
||||
Cypress.Commands.add('vega_wallet_import', () => {
|
||||
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 ${walletName} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ${walletLocation}`,
|
||||
{ failOnNonZeroExit: false }
|
||||
);
|
||||
cy.exec(
|
||||
`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}`
|
||||
);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user