From 457caf4e8c28377797833d570d8422b0daded7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szpiech?= Date: Fri, 1 Jul 2022 14:03:22 +0200 Subject: [PATCH] test(token): add rewards page validations (#697) Co-authored-by: Rado --- apps/token-e2e/src/integration/rewards.cy.js | 41 +++++++++++++++++++ .../src/locators/rewards.locators.js | 6 +++ apps/token/src/routes/rewards/home/index.tsx | 1 + 3 files changed, 48 insertions(+) create mode 100644 apps/token-e2e/src/integration/rewards.cy.js create mode 100644 apps/token-e2e/src/locators/rewards.locators.js diff --git a/apps/token-e2e/src/integration/rewards.cy.js b/apps/token-e2e/src/integration/rewards.cy.js new file mode 100644 index 000000000..5719d2972 --- /dev/null +++ b/apps/token-e2e/src/integration/rewards.cy.js @@ -0,0 +1,41 @@ +import navigation from '../locators/navigation.locators'; +import rewards from '../locators/rewards.locators'; + +context('Rewards Page - verify elements on page', function () { + before('navigate to rewards page', function () { + cy.visit('/') + .get(navigation.section) + .within(() => { + cy.get(navigation.rewards).click(); + }); + }); + + describe('with wallets disconnected', function () { + it('should have REWARDS tab highlighted', function () { + cy.get(navigation.section).within(() => { + cy.get(navigation.rewards).should('have.attr', 'aria-current'); + }); + }); + + it('should have rewards header visible', function () { + cy.get(rewards.pageHeader) + .should('be.visible') + .and('have.text', 'Rewards'); + }); + + it('should have epoch warning', function () { + cy.get(rewards.warning) + .should('be.visible') + .and( + 'have.text', + 'Rewards are credited 5 minutes after the epoch ends.This delay is set by a network parameter' + ); + }); + + it('should have connect Vega wallet button', function () { + cy.get(rewards.connectToVegaBtn) + .should('be.visible') + .and('have.text', 'Connect Vega wallet'); + }); + }); +}); diff --git a/apps/token-e2e/src/locators/rewards.locators.js b/apps/token-e2e/src/locators/rewards.locators.js new file mode 100644 index 000000000..2999773e6 --- /dev/null +++ b/apps/token-e2e/src/locators/rewards.locators.js @@ -0,0 +1,6 @@ +import common from './common.locators'; + +export default { + ...common, + connectToVegaBtn: '[data-testid="connect-to-vega-wallet-btn"]', +}; diff --git a/apps/token/src/routes/rewards/home/index.tsx b/apps/token/src/routes/rewards/home/index.tsx index b3cb01da4..cb1de1a72 100644 --- a/apps/token/src/routes/rewards/home/index.tsx +++ b/apps/token/src/routes/rewards/home/index.tsx @@ -149,6 +149,7 @@ export const RewardsIndex = () => { ) : (