Test/1540 fix flow tests (#1788)

* fix: local failing tests

* chore: remove capsule restart from manual flow

* fix: try fix failing wallet test

* chore: set capsule teardown to true

* chore: revert attempted fix

* fix: remove wallet steps

* chore: revert investigation changes

* chore: move asset wallet faucets

* chore: add retry to get asset func

* chore: add func for faucet assets without checks

* chore: turn off capsule restart after flows

* chore: remove commented lines
This commit is contained in:
Joe Tsang 2022-10-19 16:48:57 +01:00 committed by GitHub
parent 50611a4ba6
commit 9465543b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 57 deletions

View File

@ -142,7 +142,7 @@ 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: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false
######
## Upload logs

View File

@ -108,7 +108,7 @@ jobs:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
CYPRESS_NIGHTLY_RUN: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false
######
## Upload logs

View File

@ -416,7 +416,7 @@ context(
cy.get_submitted_proposal_from_proposal_list().within(() =>
cy.get(viewProposalButton).click()
);
cy.contains('Currently set to fail').should('be.visible');
cy.contains('currently set to fail').should('be.visible');
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
'be.visible'
);

View File

@ -294,7 +294,7 @@ context(
);
cy.get('[data-testid="manage-vega-wallet"]').click();
cy.get('[data-testid="select-keypair-button"]').click();
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
cy.get(connectedVegaKey).should(
'have.text',
Cypress.env('vegaWalletPublicKey2')

View File

@ -28,6 +28,13 @@ const vegaWalletCurrencyTitle = '[data-testid="currency-title"]';
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
const txTimeout = Cypress.env('txTimeout');
const faucetAssets = {
BTCFake: 'fBTC',
DAIFake: 'fDAI',
EUROFake: 'fEURO',
USDCFake: 'fUSDC',
};
context(
'Vega Wallet - verify elements on widget',
{ tags: '@regression' },
@ -138,31 +145,16 @@ context(
});
});
// after('close dialog', function () {
// cy.get(dialogCloseBtn).click().should('not.exist');
// }); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
after('close dialog', function () {
cy.get(dialogCloseBtn).click().should('not.exist');
});
});
describe('when vega wallet connected', function () {
before('connect vega wallet', function () {
cy.vega_wallet_import();
cy.visit('/');
cy.get(walletContainer).within(() => {
cy.get(connectButton).click();
});
cy.get(connectorsList).within(() => {
// using gui option to connect using wallet service V1
cy.getByTestId('connector-gui').click();
});
// cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
// then code below can be removed
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(Cypress.env('vegaWalletName'));
cy.get('#passphrase')
.click()
.type(Cypress.env('vegaWalletPassphrase'));
cy.get('button').contains('Connect').click();
});
cy.vega_wallet_connect();
});
it('should have VEGA WALLET header visible', function () {
@ -274,7 +266,7 @@ context(
cy.get(dialog).within(() => {
cy.get(copyPublicKeyBtn)
.should('be.visible')
.and('have.text', 'Copy');
.and('contain.text', 'Copy');
});
});
@ -305,48 +297,32 @@ context(
// 2002-SINC-016
describe('when assets exist in vegawallet', function () {
before('send-faucet assets to connected vega wallet', function () {
cy.vega_wallet_receive_fauceted_asset(
'USDC (fake)',
'10',
cy.vega_wallet_faucet_assets_without_check(
faucetAssets.USDCFake,
'1000000',
vegaWalletPublicKey
);
cy.vega_wallet_receive_fauceted_asset(
'BTC (fake)',
'6',
cy.vega_wallet_faucet_assets_without_check(
faucetAssets.BTCFake,
'600000',
vegaWalletPublicKey
);
cy.vega_wallet_receive_fauceted_asset(
'EURO (fake)',
'8',
cy.vega_wallet_faucet_assets_without_check(
faucetAssets.EUROFake,
'800000',
vegaWalletPublicKey
);
cy.vega_wallet_receive_fauceted_asset(
'DAI (fake)',
'2',
cy.vega_wallet_faucet_assets_without_check(
faucetAssets.DAIFake,
'200000',
vegaWalletPublicKey
);
// cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
// then code below can be removed
cy.get(walletContainer).within(() => {
cy.get('button')
.contains('Connect Vega wallet to use associated $VEGA')
.should('be.enabled')
.and('be.visible')
.click({ force: true });
});
cy.getByTestId('connector-gui').click();
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(Cypress.env('vegaWalletName'));
cy.get('#passphrase')
.click()
.type(Cypress.env('vegaWalletPassphrase'));
cy.get('button').contains('Connect').click();
});
cy.vega_wallet_connect();
cy.ethereum_wallet_connect();
});
it('should see fUSDC assets - within vega wallet', function () {
let currency = { id: 'fUSDC', name: 'USDC (fake)' };
let currency = { id: faucetAssets.USDCFake, name: 'USDC (fake)' };
cy.get(walletContainer).within(() => {
cy.get(vegaWalletCurrencyTitle)
.contains(currency.id, txTimeout)
@ -366,7 +342,7 @@ context(
});
it('should see fBTC assets - within vega wallet', function () {
let currency = { id: 'fBTC', name: 'BTC (fake)' };
let currency = { id: faucetAssets.BTCFake, name: 'BTC (fake)' };
cy.get(walletContainer).within(() => {
cy.get(vegaWalletCurrencyTitle)
.contains(currency.id, txTimeout)
@ -386,7 +362,7 @@ context(
});
it('should see fEURO assets - within vega wallet', function () {
let currency = { id: 'fEURO', name: 'EURO (fake)' };
let currency = { id: faucetAssets.EUROFake, name: 'EURO (fake)' };
cy.get(walletContainer).within(() => {
cy.get(vegaWalletCurrencyTitle)
.contains(currency.id, txTimeout)
@ -406,7 +382,7 @@ context(
});
it('should see fDAI assets - within vega wallet', function () {
let currency = { id: 'fDAI', name: 'DAI (fake)' };
let currency = { id: faucetAssets.DAIFake, name: 'DAI (fake)' };
cy.get(walletContainer).within(() => {
cy.get(vegaWalletCurrencyTitle)
.contains(currency.id, txTimeout)

View File

@ -23,3 +23,21 @@ Cypress.Commands.add('vega_wallet_connect', () => {
});
cy.get(vegaWalletNameElement).should('be.visible');
});
Cypress.Commands.add(
'vega_wallet_faucet_assets_without_check',
function (asset, amount, vegaWalletPublicKey) {
cy.highlight(`Topping up vega wallet with ${asset}, amount: ${amount}`);
cy.exec(
`curl -X POST -d '{"amount": "${amount}", "asset": "${asset}", "party": "${vegaWalletPublicKey}"}' http://localhost:1790/api/v1/mint`
)
.its('stdout')
.then((response) => {
assert.include(
response,
`"success":true`,
'Ensuring curl command was successfully undertaken'
);
});
}
);