test(token-e2e): add elements verification tests for home page (#616)
* test(token-e2e): add elements verification tests for home page * test(token-e2e): change locators files names * test(token-e2e): change title of describe block * test: add some more validation * test: eol fix Co-authored-by: Rado <rado@vegaprotocol.io>
This commit is contained in:
parent
8acd7a1f3e
commit
32d10af85c
4
apps/token-e2e/src/data/vegaToken.json
Normal file
4
apps/token-e2e/src/data/vegaToken.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"tokenAddress": "0xDc335304979D378255015c33AbFf09B60c31EBAb",
|
||||||
|
"vestingContract": "0xe2deBB240b43EDfEBc9c38B67c0894B9A92Bf07c"
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Using fixtures to represent data",
|
|
||||||
"email": "hello@cypress.io"
|
|
||||||
}
|
|
124
apps/token-e2e/src/integration/view/home.test.js
Normal file
124
apps/token-e2e/src/integration/view/home.test.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import navigation from '../../locators/navigation.locators';
|
||||||
|
import home from '../../locators/home.locators';
|
||||||
|
import vegaToken from '../../data/vegaToken.json';
|
||||||
|
|
||||||
|
context('Home Page - verify elements on page', function () {
|
||||||
|
before('visit token home page', function () {
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with wallets disconnected', function () {
|
||||||
|
before('wait for page to load', function () {
|
||||||
|
cy.get(navigation.section, { timeout: 10000 }).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Navigation tabs', function () {
|
||||||
|
it('should have HOME tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.home).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have VESTING tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.vesting).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have STAKING tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.staking).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have REWARDS tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.rewards).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have WITHDRAW tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.withdraw).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have GOVERNANCE tab', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.governance).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('THE $VEGA TOKEN table', function () {
|
||||||
|
it('should have TOKEN ADDRESS', function () {
|
||||||
|
cy.get(home.tokenDetailsTable).within(() => {
|
||||||
|
cy.get(home.address)
|
||||||
|
.should('be.visible')
|
||||||
|
.invoke('text')
|
||||||
|
.should('be.equal', vegaToken.tokenAddress);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have VESTING CONTRACT', function () {
|
||||||
|
cy.get(home.tokenDetailsTable).within(() => {
|
||||||
|
cy.get(home.contract)
|
||||||
|
.should('be.visible')
|
||||||
|
.invoke('text')
|
||||||
|
.should('be.equal', vegaToken.vestingContract);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have TOTAL SUPPLY', function () {
|
||||||
|
cy.get(home.tokenDetailsTable).within(() => {
|
||||||
|
cy.get(home.totalSupply).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have CIRCULATING SUPPLY', function () {
|
||||||
|
cy.get(home.tokenDetailsTable).within(() => {
|
||||||
|
cy.get(home.circulatingSupply).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have STAKED $VEGA', function () {
|
||||||
|
cy.get(home.tokenDetailsTable).within(() => {
|
||||||
|
cy.get(home.staked).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('links and buttons', function () {
|
||||||
|
it('should have TRANCHES link', function () {
|
||||||
|
cy.get(home.tranchesLink)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('equal', '/tranches');
|
||||||
|
});
|
||||||
|
it('should have REDEEM button', function () {
|
||||||
|
cy.get(home.redeemBtn)
|
||||||
|
.should('be.visible')
|
||||||
|
.parent()
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('equal', '/vesting');
|
||||||
|
});
|
||||||
|
it('should have GET VEGA WALLET link', function () {
|
||||||
|
cy.get(home.getVegaWalletLink)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('equal', 'https://vega.xyz/wallet');
|
||||||
|
});
|
||||||
|
it('should have ASSOCIATE VEGA TOKENS link', function () {
|
||||||
|
cy.get(home.associateVegaLink)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('equal', '/staking/associate');
|
||||||
|
});
|
||||||
|
it('should have STAKING button', function () {
|
||||||
|
cy.get(home.stakingBtn)
|
||||||
|
.should('be.visible')
|
||||||
|
.parent()
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('equal', '/staking');
|
||||||
|
});
|
||||||
|
it('should have GOVERNANCE button', function () {
|
||||||
|
cy.get(home.governanceBtn)
|
||||||
|
.should('be.visible')
|
||||||
|
.parent()
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('equal', '/governance');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
15
apps/token-e2e/src/locators/home.locators.js
Normal file
15
apps/token-e2e/src/locators/home.locators.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
tokenDetailsTable: '.token-details',
|
||||||
|
address: '[data-testid="token-address"]',
|
||||||
|
contract: '[data-testid="token-contract"]',
|
||||||
|
totalSupply: '[data-testid="total-supply"]',
|
||||||
|
circulatingSupply: '[data-testid="circulating-supply"]',
|
||||||
|
staked: '[data-testid="staked"]',
|
||||||
|
|
||||||
|
tranchesLink: '[data-testid="tranches-link"]',
|
||||||
|
redeemBtn: '[data-testid="check-vesting-page-btn"]',
|
||||||
|
getVegaWalletLink: '[data-testid="get-vega-wallet-link"]',
|
||||||
|
associateVegaLink: '[data-testid="associate-vega-tokens-link-on-homepage"]',
|
||||||
|
stakingBtn: '[data-testid="staking-button-on-homepage"]',
|
||||||
|
governanceBtn: '[data-testid="governance-button-on-homepage"]',
|
||||||
|
};
|
9
apps/token-e2e/src/locators/navigation.locators.js
Normal file
9
apps/token-e2e/src/locators/navigation.locators.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
section: 'nav',
|
||||||
|
home: '[href="/"]',
|
||||||
|
vesting: '[href="/vesting"]',
|
||||||
|
staking: '[href="/staking"]',
|
||||||
|
rewards: '[href="/rewards"]',
|
||||||
|
withdraw: '[href="/withdraw"]',
|
||||||
|
governance: '[href="/governance"]',
|
||||||
|
};
|
@ -52,7 +52,9 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
<Trans
|
<Trans
|
||||||
i18nKey="Tokens are held in different <trancheLink>Tranches</trancheLink>. Each tranche has its own schedule for how the tokens are unlocked."
|
i18nKey="Tokens are held in different <trancheLink>Tranches</trancheLink>. Each tranche has its own schedule for how the tokens are unlocked."
|
||||||
components={{
|
components={{
|
||||||
trancheLink: <Link to={Routes.TRANCHES} />,
|
trancheLink: (
|
||||||
|
<Link data-testid="tranches-link" to={Routes.TRANCHES} />
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
@ -62,7 +64,7 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<Link to={Routes.VESTING}>
|
<Link to={Routes.VESTING}>
|
||||||
<Button variant="secondary" data-test-id="check-vesting-page-btn">
|
<Button variant="secondary" data-testid="check-vesting-page-btn">
|
||||||
{t('Check to see if you can redeem unlocked VEGA tokens')}
|
{t('Check to see if you can redeem unlocked VEGA tokens')}
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
@ -81,7 +83,7 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a
|
<a
|
||||||
data-test-id="get-vega-wallet-link"
|
data-testid="get-vega-wallet-link"
|
||||||
href={Links.WALLET_GUIDE}
|
href={Links.WALLET_GUIDE}
|
||||||
className="underline text-white"
|
className="underline text-white"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@ -90,8 +92,9 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
{t('Get a Vega wallet')}
|
{t('Get a Vega wallet')}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p data-test-id="associate-vega-tokens-link-on-homepage">
|
<p>
|
||||||
<Link
|
<Link
|
||||||
|
data-testid="associate-vega-tokens-link-on-homepage"
|
||||||
to={`${Routes.STAKING}/associate`}
|
to={`${Routes.STAKING}/associate`}
|
||||||
className="underline text-white"
|
className="underline text-white"
|
||||||
>
|
>
|
||||||
@ -110,7 +113,12 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<Link to={Routes.STAKING}>
|
<Link to={Routes.STAKING}>
|
||||||
<Button variant="secondary">{t('Nominate a validator')}</Button>
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
data-testid="staking-button-on-homepage"
|
||||||
|
>
|
||||||
|
{t('Nominate a validator')}
|
||||||
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</HomeSection>
|
</HomeSection>
|
||||||
@ -125,7 +133,10 @@ const Home = ({ name }: RouteChildProps) => {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<Link to={Routes.GOVERNANCE}>
|
<Link to={Routes.GOVERNANCE}>
|
||||||
<Button variant="secondary">
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
data-testid="governance-button-on-homepage"
|
||||||
|
>
|
||||||
{t('View Governance proposals')}
|
{t('View Governance proposals')}
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
Loading…
Reference in New Issue
Block a user