diff --git a/apps/token-e2e/src/data/vegaToken.json b/apps/token-e2e/src/data/vegaToken.json new file mode 100644 index 000000000..dbf5d2d60 --- /dev/null +++ b/apps/token-e2e/src/data/vegaToken.json @@ -0,0 +1,4 @@ +{ + "tokenAddress": "0xDc335304979D378255015c33AbFf09B60c31EBAb", + "vestingContract": "0xe2deBB240b43EDfEBc9c38B67c0894B9A92Bf07c" +} diff --git a/apps/token-e2e/src/fixtures/example.json b/apps/token-e2e/src/fixtures/example.json deleted file mode 100644 index 294cbed6c..000000000 --- a/apps/token-e2e/src/fixtures/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io" -} diff --git a/apps/token-e2e/src/integration/view/home.test.js b/apps/token-e2e/src/integration/view/home.test.js new file mode 100644 index 000000000..519fe9041 --- /dev/null +++ b/apps/token-e2e/src/integration/view/home.test.js @@ -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'); + }); + }); + }); +}); diff --git a/apps/token-e2e/src/locators/home.locators.js b/apps/token-e2e/src/locators/home.locators.js new file mode 100644 index 000000000..240bc3415 --- /dev/null +++ b/apps/token-e2e/src/locators/home.locators.js @@ -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"]', +}; diff --git a/apps/token-e2e/src/locators/navigation.locators.js b/apps/token-e2e/src/locators/navigation.locators.js new file mode 100644 index 000000000..333b370a2 --- /dev/null +++ b/apps/token-e2e/src/locators/navigation.locators.js @@ -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"]', +}; diff --git a/apps/token/src/routes/home/index.tsx b/apps/token/src/routes/home/index.tsx index a4b88b841..5956e3cf6 100644 --- a/apps/token/src/routes/home/index.tsx +++ b/apps/token/src/routes/home/index.tsx @@ -52,7 +52,9 @@ const Home = ({ name }: RouteChildProps) => { , + trancheLink: ( + + ), }} />

@@ -62,7 +64,7 @@ const Home = ({ name }: RouteChildProps) => { )}

- @@ -81,7 +83,7 @@ const Home = ({ name }: RouteChildProps) => {

{ {t('Get a Vega wallet')}

-

+

@@ -110,7 +113,12 @@ const Home = ({ name }: RouteChildProps) => {

- +

@@ -125,7 +133,10 @@ const Home = ({ name }: RouteChildProps) => {

-