test: working with capsule still needs rounding issues sorting

This commit is contained in:
AndyWhiteVega 2022-06-24 18:07:09 +01:00
parent ef6b79e1f8
commit aaae6e087e
10 changed files with 170 additions and 430 deletions

View File

@ -1,99 +0,0 @@
/// <reference types="cypress" />
import navigation from '../../locators/navigation.locators';
import staking from '../../locators/staking.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
context('Staking Tab - with vega wallet connected', function () {
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
});
describe('Vega wallet - contains VEGA tokens', function () {
before('ensure environment fit for test', function () {
assert.isAtLeast(
parseInt(this.initialUnstakedBalance),
0.1,
'Checking we have at least 0.1 unstaked vega to play with'
);
assert.isAtLeast(
this.validatorNames.length,
2,
'Checking we have at least 2 validators'
);
// Choose the first validator from top of sorted list
this.validatorName = this.validatorNames[0];
});
before('drill into a specific validator - and note values', function () {
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
});
describe('Flow - Able to stake against a validator', function () {
before(
'Check - ability to fill in fields and request a stake of 0.1 tokens',
function () {
cy.get(staking.addStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
}
);
it('Check - relevant successfull feedback provided after staking', function () {
// Wallet auto approves at this stage
cy.contains(
`Adding 0.1 $VEGA to validator ${this.validatorName}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
'At the beginning of the next epoch your $VEGA will be nominated to the validator'
);
});
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function () {
cy.stakingValidatorPage_check_stakeNextEpochValue(
parseFloat(this.initialStakeNextEpoch) + 0.1
);
});
it('Check - wallet - next epoch amount - updates balance for validator', function () {
cy.walletVega_checkValidator_StakeNextEpochValue_is(
this.validatorName,
parseFloat(this.initialStakeNextEpoch) + 0.1
);
});
it.skip('Check - wallet - unstaked amount - updates balance', function () {
// Skipping until capsule can enable this test
cy.walletVega_check_UnstakedValue_is(
parseFloat(this.initialUnstakedBalance) - 0.1
);
});
});
});
});

View File

@ -1,102 +0,0 @@
/// <reference types="cypress" />
import navigation from '../../locators/navigation.locators';
import staking from '../../locators/staking.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
context('Staking Tab - with vega wallet connected', function () {
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
});
describe('Vega wallet - contains VEGA tokens', function () {
before('ensure environment fit for test', function () {
assert.isAtLeast(
this.validatorNames.length,
2,
'Checking we have at least 2 validators'
);
// Choose the first validator from top of sorted list
this.validatorName = this.validatorNames[0];
});
before('drill into a specific validator - and note values', function () {
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
});
describe('Flow - Ability to remove a stake against a validator', function () {
before('Check - validator has tokens to remove', function () {
assert.isAtLeast(
parseFloat(this.initialStakeNextEpoch),
0.1,
'Checking we have tokens to remove'
);
});
before(
'Check - ability to fill in fields and request a stake of 0.1 tokens',
function () {
cy.get(staking.removeStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button').contains('Remove 0.1 $VEGA tokens').click();
}
);
it('Check - relevant successfull feedback provided after staking', function () {
// Wallet auto approves at this stage
cy.contains(
`Removing 0.1 $VEGA from validator ${this.validatorName}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
`0.1 $VEGA has been removed from validator ${this.validatorName}`
);
});
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function () {
cy.stakingValidatorPage_check_stakeNextEpochValue(
parseFloat(this.initialStakeNextEpoch) - 0.1
);
});
it('Check - wallet - next epoch amount - updates balance for validator', function () {
cy.walletVega_checkValidator_StakeNextEpochValue_is(
this.validatorName,
parseFloat(this.initialStakeNextEpoch) - 0.1
);
});
it.skip('Check - wallet - unstaked amount - updates balance', function () {
// Skipping until capsule can enable this test
cy.walletVega_check_UnstakedValue_is(
parseFloat(this.initialUnstakedBalance) - 0.1
);
});
});
});
});

View File

@ -1,6 +1,7 @@
/// <reference types="cypress" />
import navigation from '../../locators/navigation.locators';
import staking from '../../locators/staking.locators';
import wallet from '../../locators/wallet.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
@ -9,188 +10,99 @@ context('Staking Tab - with vega wallet connected', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_create();
cy.walletEth_connect();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
cy.get(staking.validatorNames).first().invoke('text').as('validatorName');
});
describe('Vega wallet - contains VEGA tokens', function () {
beforeEach(
'drill into a specific validator - and note values',
function () {
before('Associate VEGA tokens', function () {
cy.get(wallet.ethWallet).within(() => cy.get(wallet.ethWalletAssociate).click())
cy.get(staking.stakeAssociateWalletRadio, {timeout : 20000}).click();
cy.get(staking.tokenAmountInput, {timeout : 10000}).type('2');
cy.contains('$VEGA Tokens are approved for staking', {timeout : 20000})
})
beforeEach('drill into a specific validator - and note values', function () {
cy.get(navigation.staking).first().click();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.contains('Manage your stake').should('be.visible');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
cy.get(wallet.vegawallet).contains('Unstaked').siblings()
.invoke('text').as('initialUnstakedBalance');
cy.get(staking.stakeNextEpochValue).invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
cy.get(staking.stakeThisEpochValue).invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
}
);
it('Able to stake against a validator', function () {
// Check - ability to fill in fields and request a stake of 0.1 tokens
cy.get(staking.addStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
// Check - relevant successfull feedback provided after staking - Note: Wallet auto approves at this stage
cy.contains(
`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
'At the beginning of the next epoch your $VEGA will be nominated to the validator'
);
// Check - staking page - stake on node (next epoch) - updates to reflect stake
cy.stakingValidatorPage_check_stakeNextEpochValue(
parseFloat(this.initialStakeNextEpoch) + 0.1
);
// Check - wallet staked amount - updates balance for validator
cy.walletVega_checkValidator_StakeNextEpochValue_is(
this.validatorNames[0],
parseFloat(this.initialStakeNextEpoch) + 0.1
);
//Check - wallet unstaked amount - updates balance - Note: Skipping until capsule can enable this test
// cy.walletVega_check_UnstakedValue_is(
// parseFloat(this.initialUnstakedBalance) - 0.1);
});
it.skip('Able to stake maximum tokens against a validator', function () {
// Check - ability to fill in fields and request a stake of 0.1 tokens
it('Able to stake against a validator', function () {
cy.log("**Check - ability to fill in fields and request an add stake of 0.5 tokens**");
cy.get(staking.addStakeRadioButton).click({ force: true });
cy.get(staking.stakeMaximumTokens).click();
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button')
.contains(`Add ${parseFloat(this.initialUnstakedBalance)} $VEGA tokens`)
cy.get(staking.tokenAmountInput).type('0.5');
cy.contains('Waiting for next epoch to start', {timeout:10000});
cy.get(staking.tokenInputSubmit).should('be.enabled', {timeout:8000})
.and('contain', 'Add 0.5 $VEGA tokens')
.and('be.visible')
.click();
// Check - relevant successfull feedback provided after staking - Note: Wallet auto approves at this stage
cy.contains(
`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
'At the beginning of the next epoch your $VEGA will be nominated to the validator'
);
cy.log("**Check - relevant successfull feedback provided after staking - after auto approval**");
cy.contains('At the beginning of the next epoch your $VEGA will be nominated to the validator');
// Check - staking page - stake on node (next epoch) - updates to reflect stake
cy.stakingValidatorPage_check_stakeNextEpochValue(
parseFloat(this.initialStakeNextEpoch) + 0.1
);
cy.log("**Check - staking page - stake on node (next epoch) - updates to reflect stake**");
cy.stakingValidatorPage_check_stakeNextEpochValue(parseFloat(this.initialStakeNextEpoch) + 0.5);
// Check - wallet staked amount - updates balance for validator
cy.walletVega_checkValidator_StakeNextEpochValue_is(
this.validatorNames[0],
parseFloat(this.initialStakeNextEpoch) + 0.1
);
cy.log("**Check - wallet - next epoch amount - updates balance for validator**");
cy.walletVega_checkThisValidator_StakeNextEpochValue_is(this.validatorName,
parseFloat(this.initialStakeNextEpoch) + 0.5);
//Check - wallet unstaked amount - updates balance - Note: Skipping until capsule can enable this test
// cy.walletVega_check_UnstakedValue_is(
// parseFloat(this.initialUnstakedBalance) - 0.1);
cy.log("**Check - wallet - unstaked amount - updates balance**");
cy.walletVega_check_UnstakedValue_is(parseFloat(this.initialUnstakedBalance) - 0.5);
});
it('Able to remove stake against a validator', function () {
// Check - ability to fill in fields and request a stake of 0.1 tokens
cy.log("**Check - ability to fill in fields and request a removal stake of 0.1 tokens**");
cy.get(staking.removeStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button').contains('Remove 0.1 $VEGA tokens').click();
cy.contains('Waiting for next epoch to start', {timeout:10000});
cy.get(staking.tokenInputSubmit).should('be.enabled', {timeout:8000})
.and('contain', 'Remove 0.1 $VEGA tokens').and('be.visible').click();
// Check - relevant successfull feedback provided after staking
// Wallet auto approves at this stage
cy.contains(
`Removing 0.1 $VEGA from validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
`0.1 $VEGA has been removed from validator ${this.validatorNames[0]}`
);
cy.log("**Check - relevant successfull feedback provided after staking - after auto approval**");
cy.contains(`0.1 $VEGA has been removed from validator`).should('be.visible');
// Check - staking page - stake on node (next epoch) - updates to reflect stake
cy.stakingValidatorPage_check_stakeNextEpochValue(
parseFloat(this.initialStakeNextEpoch) - 0.1
);
cy.log("**Check - staking page - stake on node (next epoch) - updates to reflect stake**");
cy.stakingValidatorPage_check_stakeNextEpochValue(parseFloat(this.initialStakeNextEpoch) - 0.1);
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.then((stakeThisEpochValue) => {
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.then((stakeNextEpochValue) => {
if (stakeNextEpochValue == stakeThisEpochValue) {
cy.log('nothing');
} else {
cy.walletVega_checkValidator_StakeNextEpochValue_is(
this.validatorNames[0],
parseFloat(this.initialStakeNextEpoch) + 0.1
);
}
});
});
cy.log("**Check - wallet - next epoch amount - updates balance for validator**");
cy.walletVega_checkThisValidator_StakeNextEpochValue_is(this.validatorName,
parseFloat(this.initialStakeNextEpoch) - 0.1);
// Check - wallet - next epoch amount - updates balance for validator
// cy.walletVega_checkValidator_StakeNextEpochValue_is(
// this.validatorNames[0],
// parseFloat(this.initialStakeNextEpoch) - 0.1
// );
// Check - wallet - unstaked amount - updates balance'
// Skipping until capsule can enable this test
// cy.walletVega_check_UnstakedValue_is(
// parseFloat(this.initialUnstakedBalance) - 0.1
// );
cy.log("**Check - wallet - unstaked amount - updates balance**");
cy.walletVega_check_UnstakedValue_is(parseFloat(this.initialUnstakedBalance) + 0.1);
});
it('Unable to remove a stake with a negative value for a validator', function () {
// Check - ability to fill in fields and request a stake of 0.1 tokens
cy.get(staking.removeStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('-0.1');
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button')
.contains('Remove -0.1 $VEGA tokens at the end of epoch')
.should('be.disabled');
cy.contains('Waiting for next epoch to start', {timeout:10000});
cy.get(staking.tokenInputSubmit).should('be.disabled', {timeout:8000})
.and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`)
.and('be.visible')
});
it('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
let amountToTry = this.initialStakeNextEpoch.slice(0, -1) + '1';
cy.get(staking.removeStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type(amountToTry);
// cy.staking_waitForEpochRemainingSeconds(5);
cy.get('button')
.contains(`Remove ${amountToTry} $VEGA tokens at the end of epoch`)
.should('be.disabled');
cy.contains('Waiting for next epoch to start', {timeout:10000});
cy.get(staking.tokenInputSubmit).should('be.disabled', {timeout:8000})
.and('contain', `Remove ${amountToTry} $VEGA tokens at the end of epoch`)
.and('be.visible')
});
});
});

View File

@ -1,11 +1,14 @@
export default {
validatorNames: '[data-testid="node-list-item"] > :nth-child(1)',
validatorNames: '[data-testid="node-list-item-name"]',
epochEndingText: '[data-testid="epoch-countdown"]',
addStakeRadioButton: '[data-testid="add-stake-radio"]',
removeStakeRadioButton: '[data-testid="remove-stake-radio"]',
tokenAmountInput: '[data-testid="token-amount-input"]',
tokenInputApprove: '[data-testid="token-input-approve-button"]',
tokenInputSubmit: '[data-testid="token-input-submit-button"]',
stakedAmounts: '[data-testid="staked-validator-item"]',
stakeNextEpochValue: '[data-testid="stake-next-epoch"]',
stakeThisEpochValue: '[data-testid="stake-this-epoch"]',
stakeMaximumTokens: '[data-testid="token-amount-use-maximum"]',
stakeAssociateWalletRadio: '[data-testid="associate-radio-wallet"]'
};

View File

@ -2,5 +2,9 @@ export default {
connectRestForm: '[data-testid="rest-connector-form"]',
name: '#wallet',
passphrase: '#passphrase',
vegawallet: '.vega-wallet',
vegawallet: '[data-testid="vega-wallet"]',
ethWallet : '[data-testid="ethereum-wallet"]',
ethWalletConnectToEth: '[data-testid="connect-to-eth-wallet-button"]',
ethWalletConnect: '[data-testid="web3-connector-Unknown"]',
ethWalletAssociate: '[href="/staking/associate"]'
};

View File

@ -1,15 +1,6 @@
import staking from '../locators/staking.locators';
Cypress.Commands.add('stakingPage_getValidatorNamesSorted', function () {
let validatorNames = [];
cy.get(staking.validatorNames)
.each(($validatorName) => {
validatorNames.push($validatorName.text());
})
.then(() => {
return validatorNames.sort();
});
});
// ----------------------------------------------------------------------
Cypress.Commands.add(
'stakingValidatorPage_check_stakeNextEpochValue',
@ -21,6 +12,8 @@ Cypress.Commands.add(
}
);
// ----------------------------------------------------------------------
Cypress.Commands.add(
'staking_waitForEpochRemainingSeconds',
function (secondsRemaining) {
@ -31,3 +24,5 @@ Cypress.Commands.add(
.should('be.visible');
}
);
// ----------------------------------------------------------------------

View File

@ -1,16 +1,31 @@
import wallet from '../locators/wallet.locators';
// ----------------------------------------------------------------------
Cypress.Commands.add('walletVega_create', function () {
cy.exec('vegawallet init -f --home ~/.vegacapsule/testnet/wallet').then(() => {
cy.exec('echo "123" > ~/.vegacapsule/testnet/wallet/passphrase.txt').then(() => {
cy.exec('vegawallet create --wallet capsule_wallet -p ./passphrase.txt --home ~/.vegacapsule/testnet/wallet', {failOnNonZeroExit: false}).then(() => {
cy.exec('vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet').then(() => {
return
})
})
})
})
});
// ----------------------------------------------------------------------
Cypress.Commands.add('walletVega_connect', function () {
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
const walletTruncatedKey = Cypress.env('TRUNCATED_VEGA_PUBLIC_KEY');
const walletName = "capsule_wallet";
const walletPassphrase = "123"
cy.get(wallet.vegawallet).within(() => {
cy.get('button')
.contains('Connect Vega wallet to use associated $VEGA')
.should('be.enabled')
.click();
});
.should('be.enabled').and('be.visible').click({force:true})
});
cy.get('button').contains('rest provider').click();
@ -20,18 +35,13 @@ Cypress.Commands.add('walletVega_connect', function () {
cy.get('button').contains('Connect').click();
});
cy.get(wallet.vegawallet).within(() => {
cy.contains(walletTruncatedKey).should('be.visible');
cy.contains('Assets', { timeout: 20000 }).should('be.visible');
});
cy.contains('capsule_wallet key 1', { timeout: 20000 }).should('be.visible');
});
Cypress.Commands.add('walletVega_getUnstakedAmount', function () {
cy.get(wallet.vegawallet).contains('Unstaked').siblings().invoke('text');
});
// ----------------------------------------------------------------------
Cypress.Commands.add(
'walletVega_checkValidator_StakeNextEpochValue_is',
'walletVega_checkThisValidator_StakeNextEpochValue_is',
function (validatorName, expectedVal) {
cy.get(wallet.vegawallet).within(() => {
cy.contains(`${validatorName} (Next epoch)`)
@ -41,13 +51,27 @@ Cypress.Commands.add(
}
);
// ----------------------------------------------------------------------
Cypress.Commands.add(
'walletVega_check_UnstakedValue_is',
function (expectedVal) {
cy.get(wallet.vegawallet).within(() => {
cy.contains(`Unstaked`)
.siblings()
.contains(parseFloat(expectedVal).toPrecision(16));
.contains(parseFloat(expectedVal).toPrecision(16), {timeout:10000});
});
}
);
// ----------------------------------------------------------------------
Cypress.Commands.add('walletEth_connect', function () {
cy.get(wallet.ethWalletConnectToEth).within(() => {
cy.contains('Connect Ethereum wallet to associate $VEGA')
.should('be.visible').click();
});
cy.get(wallet.ethWalletConnect).click();
cy.contains('Ethereum wallet connected').should('be.visible');
});

View File

@ -191,60 +191,62 @@ export const EthWallet = () => {
return (
<WalletCard dark={true}>
<WalletCardHeader>
<h1 className="text-h3 uppercase">{t('ethereumKey')}</h1>
{account && (
<div className="px-4 text-right">
<div className="font-mono">{truncateMiddle(account)}</div>
{pendingTxs && (
<div>
<button
className="flex items-center gap-4 p-4 border whitespace-nowrap"
data-testid="pending-transactions-btn"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_TRANSACTION_OVERLAY,
isOpen: true,
})
}
>
<Loader size="small" forceTheme="dark" />
{t('pendingTransactions')}
</button>
</div>
)}
</div>
)}
</WalletCardHeader>
<WalletCardContent>
{account ? (
<ConnectedKey />
) : (
<Button
variant={'secondary'}
className="w-full px-28 border h-28"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_ETH_WALLET_OVERLAY,
isOpen: true,
})
}
data-test-id="connect-to-eth-wallet-button"
>
{t('connectEthWalletToAssociate')}
</Button>
)}
{account && (
<WalletCardActions>
<button
className="mt-4 underline"
onClick={() => connector.deactivate()}
<section data-testid="ethereum-wallet">
<WalletCardHeader>
<h1 className="text-h3 uppercase">{t('ethereumKey')}</h1>
{account && (
<div className="px-4 text-right">
<div className="font-mono">{truncateMiddle(account)}</div>
{pendingTxs && (
<div>
<button
className="flex items-center gap-4 p-4 border whitespace-nowrap"
data-testid="pending-transactions-btn"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_TRANSACTION_OVERLAY,
isOpen: true,
})
}
>
<Loader size="small" forceTheme="dark" />
{t('pendingTransactions')}
</button>
</div>
)}
</div>
)}
</WalletCardHeader>
<WalletCardContent>
{account ? (
<ConnectedKey />
) : (
<Button
variant={'secondary'}
className="w-full px-28 border h-28"
onClick={() =>
appDispatch({
type: AppStateActionType.SET_ETH_WALLET_OVERLAY,
isOpen: true,
})
}
data-testid="connect-to-eth-wallet-button"
>
{t('disconnect')}
</button>
</WalletCardActions>
)}
</WalletCardContent>
{t('connectEthWalletToAssociate')}
</Button>
)}
{account && (
<WalletCardActions>
<button
className="mt-4 underline"
onClick={() => connector.deactivate()}
>
{t('disconnect')}
</button>
</WalletCardActions>
)}
</WalletCardContent>
</section>
</WalletCard>
);
};

View File

@ -37,7 +37,7 @@ export const VegaWallet = () => {
);
return (
<section className="vega-wallet">
<section className="vega-wallet" data-testid="vega-wallet">
<WalletCard dark={true}>
<WalletCardHeader dark={true}>
<div>

View File

@ -178,14 +178,15 @@ export const NodeListItem = ({
data-testid="node-list-item"
>
<Link to={id}>
{name ? (
<NodeListItemName>{name}</NodeListItemName>
) : (
<>
{name ? (
<NodeListItemName>{name}</NodeListItemName>
) : (
<>
<NodeListItemName>{t('validatorTitleFallback')}</NodeListItemName>
<span
className="uppercase text-white-60"
title={`${t('id')}: ${id}`}
data-testid="node-list-item-name"
>
{truncateMiddle(id)}
</span>