Test/toke add withdraw page validations (#701)
* fix: always show heading on governance page * test(token): added validation for withdraw and governance pages * chore: remove semicolon Co-authored-by: Dexter <dexter.edwards93@gmail.com> Co-authored-by: Rado <rado@vegaprotocol.io>
This commit is contained in:
parent
457caf4e8c
commit
acef1a8e24
32
apps/token-e2e/src/integration/governance.cy.js
Normal file
32
apps/token-e2e/src/integration/governance.cy.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import navigation from '../locators/navigation.locators';
|
||||||
|
import governance from '../locators/governance.locators';
|
||||||
|
|
||||||
|
context('Governance Page - verify elements on page', function () {
|
||||||
|
before('navigate to governance page', function () {
|
||||||
|
cy.visit('/')
|
||||||
|
.get(navigation.section)
|
||||||
|
.within(() => {
|
||||||
|
cy.get(navigation.governance).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with no network change proposals', function () {
|
||||||
|
it('should have governance tab highlighted', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.governance).should('have.attr', 'aria-current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have GOVERNANCE header visible', function () {
|
||||||
|
cy.get(governance.pageHeader)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Governance');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have information box visible', function () {
|
||||||
|
cy.get(governance.noProposals)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'There are no active network change proposals');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
36
apps/token-e2e/src/integration/withdraw.cy.js
Normal file
36
apps/token-e2e/src/integration/withdraw.cy.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import navigation from '../locators/navigation.locators';
|
||||||
|
import withdraw from '../locators/withdraw.locators';
|
||||||
|
|
||||||
|
context('Withdraw Page - verify elements on page', function () {
|
||||||
|
before('navigate to withdraw page', function () {
|
||||||
|
cy.visit('/')
|
||||||
|
.get(navigation.section)
|
||||||
|
.within(() => {
|
||||||
|
cy.get(navigation.withdraw).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with wallets disconnected', function () {
|
||||||
|
it('should have withdraw tab highlighted', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.withdraw).should('have.attr', 'aria-current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have WITHDRAW header visible', function () {
|
||||||
|
cy.get(withdraw.pageHeader)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Withdraw');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have connect Vega wallet button', function () {
|
||||||
|
cy.get(withdraw.connectToVegaBtn)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Connect Vega wallet');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have withdraw information box', function () {
|
||||||
|
cy.get(withdraw.warning).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -3,4 +3,5 @@ export default {
|
|||||||
sectionHeader: 'h2',
|
sectionHeader: 'h2',
|
||||||
link: '[data-testid="link"]',
|
link: '[data-testid="link"]',
|
||||||
warning: '[data-testid="callout"]',
|
warning: '[data-testid="callout"]',
|
||||||
|
connectToVegaBtn: '[data-testid="connect-to-vega-wallet-btn"]',
|
||||||
};
|
};
|
||||||
|
6
apps/token-e2e/src/locators/governance.locators.js
Normal file
6
apps/token-e2e/src/locators/governance.locators.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import common from './common.locators';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
...common,
|
||||||
|
noProposals: '[data-testid="no-proposals"]',
|
||||||
|
};
|
@ -2,5 +2,4 @@ import common from './common.locators';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
...common,
|
...common,
|
||||||
connectToVegaBtn: '[data-testid="connect-to-vega-wallet-btn"]',
|
|
||||||
};
|
};
|
||||||
|
@ -7,5 +7,4 @@ export default {
|
|||||||
step2: '[data-testid="staking-step-2"]',
|
step2: '[data-testid="staking-step-2"]',
|
||||||
step3: '[data-testid="staking-step-3"]',
|
step3: '[data-testid="staking-step-3"]',
|
||||||
connectToEthBtn: '[data-testid="connect-to-eth-btn"]',
|
connectToEthBtn: '[data-testid="connect-to-eth-btn"]',
|
||||||
connectToVegaBtn: '[data-testid="connect-to-vega-wallet-btn"]',
|
|
||||||
};
|
};
|
||||||
|
5
apps/token-e2e/src/locators/withdraw.locators.js
Normal file
5
apps/token-e2e/src/locators/withdraw.locators.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import common from './common.locators';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
...common,
|
||||||
|
};
|
@ -22,6 +22,7 @@ export const VegaWalletContainer = ({ children }: VegaWalletContainerProps) => {
|
|||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid="connect-to-vega-wallet-btn"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
appDispatch({
|
appDispatch({
|
||||||
type: AppStateActionType.SET_VEGA_WALLET_OVERLAY,
|
type: AppStateActionType.SET_VEGA_WALLET_OVERLAY,
|
||||||
|
@ -3,7 +3,6 @@ import { format, isFuture } from 'date-fns';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { Heading } from '../../../../components/heading';
|
|
||||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||||
import { getProposalName } from '../../../../lib/type-policies/proposal';
|
import { getProposalName } from '../../../../lib/type-policies/proposal';
|
||||||
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
|
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
|
||||||
@ -17,12 +16,11 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
if (proposals.length === 0) {
|
if (proposals.length === 0) {
|
||||||
return <p>{t('noProposals')}</p>;
|
return <p data-testid="no-proposals">{t('noProposals')}</p>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Heading title={t('pageTitleGovernance')} />
|
|
||||||
<p>{t('proposedChangesToVegaNetwork')}</p>
|
<p>{t('proposedChangesToVegaNetwork')}</p>
|
||||||
<p>{t('vegaTokenHoldersCanVote')}</p>
|
<p>{t('vegaTokenHoldersCanVote')}</p>
|
||||||
<p>{t('requiredMajorityDescription')}</p>
|
<p>{t('requiredMajorityDescription')}</p>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
import { gql, useQuery } from '@apollo/client';
|
||||||
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { Heading } from '../../../components/heading';
|
||||||
import compact from 'lodash/compact';
|
import compact from 'lodash/compact';
|
||||||
import flow from 'lodash/flow';
|
import flow from 'lodash/flow';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
@ -63,5 +64,10 @@ export const ProposalsContainer = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <ProposalsList proposals={proposals} />;
|
return (
|
||||||
|
<>
|
||||||
|
<Heading title={t('pageTitleGovernance')} />
|
||||||
|
<ProposalsList proposals={proposals} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user