2022-07-11 13:32:32 +00:00
|
|
|
import ethWallet from '../locators/wallet-eth.locators';
|
2022-07-08 10:48:51 +00:00
|
|
|
|
|
|
|
cy.ethereum_wallet_connect = () => {
|
|
|
|
cy.highlight('Connecting Eth Wallet');
|
2022-07-11 13:32:32 +00:00
|
|
|
cy.get(ethWallet.connectToEthButton).within(() => {
|
2022-07-08 10:48:51 +00:00
|
|
|
cy.contains('Connect Ethereum wallet to associate $VEGA')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
});
|
2022-07-11 13:32:32 +00:00
|
|
|
cy.get(ethWallet.connectorCapsule).click();
|
|
|
|
cy.get(ethWallet.connectorCapsule, { timeout: 60000 }).should('not.exist');
|
|
|
|
cy.get(ethWallet.walletContainer).within(() => {
|
2022-07-08 10:48:51 +00:00
|
|
|
// this check is required since it ensures the wallet is fully (not partially) loaded
|
|
|
|
cy.contains('Locked', { timeout: 15000 }).should('be.visible');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
cy.ethereum_wallet_check_associated_value_is = (expectedVal) => {
|
|
|
|
cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`);
|
2022-07-11 13:32:32 +00:00
|
|
|
cy.get(ethWallet.walletContainer).within(() => {
|
2022-07-08 10:48:51 +00:00
|
|
|
cy.contains('Associated', { timeout: 20000 })
|
|
|
|
.parent()
|
|
|
|
.siblings()
|
|
|
|
.contains(expectedVal, { timeout: 40000 })
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
cy.ethereum_wallet_check_associated_vega_key_value_is = (
|
|
|
|
vegaShortPublicKey,
|
|
|
|
expectedVal
|
|
|
|
) => {
|
|
|
|
cy.highlight(
|
|
|
|
`Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}`
|
|
|
|
);
|
2022-07-11 13:32:32 +00:00
|
|
|
cy.get(ethWallet.walletContainer).within(() => {
|
2022-07-08 10:48:51 +00:00
|
|
|
cy.contains(vegaShortPublicKey, { timeout: 20000 })
|
|
|
|
.parent()
|
|
|
|
.contains(expectedVal, { timeout: 40000 })
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing = (
|
|
|
|
vegaShortPublicKey
|
|
|
|
) => {
|
|
|
|
cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing');
|
2022-07-11 13:32:32 +00:00
|
|
|
cy.get(ethWallet.walletContainer).within(() => {
|
2022-07-08 10:48:51 +00:00
|
|
|
cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist');
|
|
|
|
});
|
|
|
|
};
|
2022-07-11 13:32:32 +00:00
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
'convertTokenValueToNumber',
|
|
|
|
{ prevSubject: true },
|
|
|
|
(subject) => {
|
|
|
|
return parseFloat(subject.replace(/,/g, ''));
|
|
|
|
}
|
|
|
|
);
|