Test/783 cypress tags (#1428)

* test: add tags for slow tests

* chore: remove old flows

* test: added smoke tags to view tests

* test: add tags for trading tests

* test: tags for explorer tests added

* chore: add tags to remaining tests and tidy files

* chore: pass env in test command

* chore: fix build errors

* chore: re-add teardown for manual flow

* chore: ability to only run smoke tests in manual flow

* chore: fix manual input flow
This commit is contained in:
Joe Tsang 2022-09-22 18:40:11 +01:00 committed by GitHub
parent c3cdcede9f
commit ac16ca9ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 3481 additions and 3943 deletions

View File

@ -15,11 +15,11 @@ on:
- stats-e2e
- token-e2e
- trading-e2e
includeFlows:
description: 'Include long flows (if any)?'
runAlltests:
description: 'Run only smoke tests?'
required: true
type: boolean
default: true
default: false
jobs:
manual:
@ -160,14 +160,24 @@ jobs:
run: yarn install
working-directory: frontend-monorepo
- name: Run smoke Cypress tests
if: ${{ github.event.inputs.runAlltests == 'true' }}
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --env.grepTags='@smoke'
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
- name: Run Cypress tests
if: ${{ github.event.inputs.runAlltests == 'false' }}
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: ${{ github.event.inputs.includeFlows }}
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
######

View File

@ -124,7 +124,6 @@ jobs:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_NIGHTLY_RUN: true
CYPRESS_INCLUDE_FLOWS: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
######

View File

@ -157,13 +157,12 @@ jobs:
main-branch-name: ${{github.base_ref}}
- name: Run Cypress tests
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --env.grepTags='@smoke'
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: false
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
######

View File

@ -3,13 +3,17 @@ module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:4200',
fileServerFolder: '.',
fixturesFolder: false,
specPattern: './src/integration/*.ts',
excludeSpecPattern: '**/*.js',
modifyObstructiveCode: false,
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder: '../../dist/cypress/apps/console-lite-e2e/videos',
@ -35,5 +39,8 @@ module.exports = defineConfig({
TRADING_TEST_VEGA_WALLET_PASSPHRASE: '123',
ETH_WALLET_MNEMONIC:
'ugly gallery notice network true range brave clarify flat logic someone chunk',
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

View File

@ -1,4 +1,4 @@
describe('simple trading app', () => {
describe('simple trading app', { tags: '@smoke' }, () => {
beforeEach(() => cy.visit('/'));
it('render', () => {

View File

@ -1,4 +1,4 @@
describe('console lite header', () => {
describe('console lite header', { tags: '@smoke' }, () => {
beforeEach(() => {
window.localStorage.setItem('theme', 'dark');
cy.visit('/');

View File

@ -7,7 +7,7 @@ import {
generateMarketsCandles,
} from '../support/mocks/generate-markets';
describe('market list', () => {
describe('market list', { tags: '@smoke' }, () => {
describe('simple url', () => {
beforeEach(() => {
cy.mockGQL((req) => {

View File

@ -16,7 +16,7 @@ import { generateMarketNames } from '../support/mocks/generate-market-names';
import { generateMarketDepth } from '../support/mocks/generate-market-depth';
import type { Market, Markets } from '@vegaprotocol/market-list';
describe('market selector', () => {
describe('market selector', { tags: '@smoke' }, () => {
let markets: Market[];
beforeEach(() => {
cy.mockGQL((req) => {

View File

@ -15,7 +15,7 @@ import { generateMarketDepth } from '../support/mocks/generate-market-depth';
import { connectVegaWallet } from '../support/connect-wallet';
import type { Markets, Market } from '@vegaprotocol/market-list';
describe('Market trade', () => {
describe('Market trade', { tags: '@smoke' }, () => {
let markets: Market[];
beforeEach(() => {
cy.mockGQL((req) => {

View File

@ -9,7 +9,7 @@ import { generateOrders } from '../support/mocks/generate-orders';
import { generateFills } from '../support/mocks/generate-fills';
import { generateFillsMarkets } from '../support/mocks/generate-markets';
describe('Portfolio page', () => {
describe('Portfolio page', { tags: '@smoke' }, () => {
afterEach(() => {
disconnectVegaWallet();
});

View File

@ -17,3 +17,5 @@ import '@vegaprotocol/cypress';
import 'cypress-real-events/support';
// Import commands.js using ES2015 syntax:
import './commands';
import registerCypressGrep from 'cypress-grep';
registerCypressGrep();

View File

@ -6,7 +6,7 @@
"allowSyntheticDefaultImports": true,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node", "cypress-real-events"]
"types": ["cypress", "node", "cypress-real-events", "cypress-grep"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}

View File

@ -4,12 +4,16 @@ module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:3000',
fileServerFolder: '.',
fixturesFolder: false,
specPattern: '**/*.cy.{js,jsx,ts,tsx}',
modifyObstructiveCode: false,
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder: '../../dist/cypress/apps/explorer-e2e/videos',
@ -24,5 +28,8 @@ module.exports = defineConfig({
ethUrl: 'https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
commitHash: 'dev',
tsConfig: 'tsconfig.json',
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

View File

@ -1,6 +1,6 @@
import '../support/common.functions';
context('Asset page', function () {
context('Asset page', { tags: '@regression' }, function () {
describe('Verify elements on page', function () {
const assetsNavigation = 'a[href="/assets"]';
const assetHeader = '[data-testid="asset-header"]';

View File

@ -1,6 +1,6 @@
import '../support/common.functions';
context('Blocks page', function () {
context('Blocks page', { tags: '@regression' }, function () {
before('visit token home page', function () {
cy.visit('/');
});

View File

@ -3,7 +3,7 @@ context('Home Page', function () {
cy.visit('/');
});
describe('Stats page', function () {
describe('Stats page', { tags: '@smoke' }, function () {
const statsValue = '[data-testid="stats-value"]';
it('Should show connected environment', function () {

View File

@ -1,7 +1,7 @@
import '../support/common.functions';
//Tests set to skip until market bug for capsule checkpoint is fixed
context.skip('Market page', function () {
context.skip('Market page', { tags: '@regression' }, function () {
describe('Verify elements on page', function () {
const marketHeaders = '[data-testid="markets-header"]';
const marketNavigation = 'a[href="/markets"]';

View File

@ -1,6 +1,6 @@
import '../support/common.functions';
context('Network parameters page', function () {
context('Network parameters page', { tags: '@smoke' }, function () {
before('visit token home page', function () {
cy.visit('/');
});

View File

@ -3,7 +3,7 @@ const nodeErrorMsg = 'node-error-message';
const nodeId = 'node-url-0';
const customNodeBtn = 'custom-node';
context.skip('Node switcher', function () {
context.skip('Node switcher', { tags: '@regression' }, function () {
beforeEach('visit home page', function () {
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
hosts: ['http://localhost:3028/query'],

View File

@ -4,7 +4,7 @@ context.skip('Transactions page', function () {
cy.visit('/');
});
describe('Verify elements on page', function () {
describe('Verify elements on page', { tags: '@regression' }, function () {
const transactionNavigation = 'a[href="/txs"]';
const transactionRow = 'transaction-row';
const txHash = 'hash';

View File

@ -1,6 +1,6 @@
import '../support/common.functions';
context('Validator page', function () {
context('Validator page', { tags: '@smoke' }, function () {
describe('Verify elements on page', function () {
const validatorNavigation = 'a[href="/validators"]';

View File

@ -1,2 +0,0 @@
// type definitions for Cypress object "cy"
/// <reference types="cypress" />

View File

@ -14,3 +14,5 @@
// ***********************************************************
import '@vegaprotocol/cypress';
import registerCypressGrep from 'cypress-grep';
registerCypressGrep();

View File

@ -4,7 +4,7 @@
"jsx": "react-jsx",
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"types": ["cypress", "node"],
"types": ["cypress", "node", "cypress-grep"],
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,

View File

@ -4,13 +4,17 @@ module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:4200',
fileServerFolder: '.',
fixturesFolder: false,
specPattern: './src/integration/*.ts',
excludeSpecPattern: '**/*.js',
modifyObstructiveCode: false,
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder:
@ -21,4 +25,9 @@ module.exports = defineConfig({
viewportWidth: 1440,
viewportHeight: 900,
},
env: {
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

View File

@ -1,6 +1,6 @@
import { getGreeting } from '../support/app.po';
describe('liquidity-provision-dashboard', () => {
describe('liquidity-provision-dashboard', { tags: '@smoke' }, () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {

View File

@ -17,3 +17,5 @@ import '@vegaprotocol/cypress';
import 'cypress-real-events/support';
// Import commands.js using ES2015 syntax:
import './commands';
import registerCypressGrep from 'cypress-grep';
registerCypressGrep();

View File

@ -6,7 +6,7 @@
"allowSyntheticDefaultImports": true,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node", "cypress-real-events"]
"types": ["cypress", "node", "cypress-real-events", "cypress-grep"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}

View File

@ -3,6 +3,10 @@ module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:3010',
fileServerFolder: '.',
fixturesFolder: false,
@ -18,4 +22,9 @@ module.exports = defineConfig({
viewportWidth: 1440,
viewportHeight: 900,
},
env: {
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

View File

@ -6,7 +6,7 @@
"allowSyntheticDefaultImports": true,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
"types": ["cypress", "node", "cypress-grep"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}

View File

@ -14,4 +14,3 @@ NX_VEGA_WALLET_URL=http://localhost:1789/api/v1
#Test configuration variables
CYPRESS_FAIRGROUND=false
CYPRESS_INCLUDE_FLOWS=true

View File

@ -1,21 +1,22 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:4210',
fileServerFolder: '.',
fixturesFolder: './src/fixtures',
specPattern:
process.env.CYPRESS_INCLUDE_FLOWS === 'true' ||
process.env.CYPRESS_INCLUDE_FLOWS === true
? [
'./src/integration/view/**/*.cy.{js,jsx,ts,tsx}',
'./src/integration/flow/**/*.cy.{js,jsx,ts,tsx}',
]
: ['./src/integration/view/**/*.cy.{js,jsx,ts,tsx}'],
specPattern: [
'./src/integration/view/**/*.cy.{js,jsx,ts,tsx}',
'./src/integration/flow/**/*.cy.{js,jsx,ts,tsx}',
],
modifyObstructiveCode: false,
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder: '../../dist/cypress/apps/token-e2e/videos',
@ -45,5 +46,8 @@ module.exports = defineConfig({
epochTimeout: { timeout: 6000 },
blockConfirmations: 3,
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true,
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ const vegaWallet = '[data-testid="vega-wallet"]';
context(
'Token association flow - with eth and vega wallets connected',
{ tags: '@slow' },
function () {
before('visit staking tab and connect vega wallet', function () {
cy.vega_wallet_import();

View File

@ -6,67 +6,71 @@ const newProposalLink = '[data-testid="new-proposal-link"]';
const governanceDocsUrl = 'https://vega.xyz/governance';
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
context('Governance Page - verify elements on page', function () {
before('navigate to governance page', function () {
cy.visit('/').navigate_to('governance');
});
describe('with no network change proposals', function () {
it('should have governance tab highlighted', function () {
cy.verify_tab_highlighted('governance');
context(
'Governance Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to governance page', function () {
cy.visit('/').navigate_to('governance');
});
it('should have GOVERNANCE header visible', function () {
cy.verify_page_header('Governance');
});
describe('with no network change proposals', function () {
it('should have governance tab highlighted', function () {
cy.verify_tab_highlighted('governance');
});
it('should be able to see a working link for - find out more about Vega governance', function () {
// 1004-VOTE-001
cy.get(proposalDocumentationLink)
.should('be.visible')
.and('have.text', 'Find out more about Vega governance')
.and('have.attr', 'href')
.and('equal', governanceDocsUrl);
it('should have GOVERNANCE header visible', function () {
cy.verify_page_header('Governance');
});
cy.request(governanceDocsUrl)
.its('body')
.then((body) => {
if (!body.includes('Govern the network')) {
assert.include(
body,
'Govern the network',
`Checking that governance link destination includes 'Govern the network' text`
);
}
});
});
it('should be able to see a working link for - find out more about Vega governance', function () {
// 1004-VOTE-001
cy.get(proposalDocumentationLink)
.should('be.visible')
.and('have.text', 'Find out more about Vega governance')
.and('have.attr', 'href')
.and('equal', governanceDocsUrl);
it('should be able to see button for - new proposal', function () {
// 1004-VOTE-002
cy.get(newProposalLink)
.should('be.visible')
.and('have.text', 'New proposal')
.and('have.attr', 'href')
.and('equal', '/governance/propose');
});
cy.request(governanceDocsUrl)
.its('body')
.then((body) => {
if (!body.includes('Govern the network')) {
assert.include(
body,
'Govern the network',
`Checking that governance link destination includes 'Govern the network' text`
);
}
});
});
it('should be able to see that no proposals exist', function () {
// 1004-VOTE-003
cy.get(noOpenProposals)
.should('be.visible')
.and('have.text', 'There are no open or yet to enact proposals');
cy.get(noClosedProposals)
.should('be.visible')
.and('have.text', 'There are no enacted or rejected proposals');
});
it('should be able to see button for - new proposal', function () {
// 1004-VOTE-002
cy.get(newProposalLink)
.should('be.visible')
.and('have.text', 'New proposal')
.and('have.attr', 'href')
.and('equal', '/governance/propose');
});
it('should be able to see a connect wallet button - if vega wallet disconnected and new proposal button selected', function () {
cy.get(newProposalButton).should('be.visible').click();
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
cy.navigate_to('governance');
cy.wait_for_spinner();
it('should be able to see that no proposals exist', function () {
// 1004-VOTE-003
cy.get(noOpenProposals)
.should('be.visible')
.and('have.text', 'There are no open or yet to enact proposals');
cy.get(noClosedProposals)
.should('be.visible')
.and('have.text', 'There are no enacted or rejected proposals');
});
it('should be able to see a connect wallet button - if vega wallet disconnected and new proposal button selected', function () {
cy.get(newProposalButton).should('be.visible').click();
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
cy.navigate_to('governance');
cy.wait_for_spinner();
});
});
});
});
}
);

View File

@ -23,7 +23,7 @@ const governanceBtn = '[data-testid="governance-button-on-homepage"]';
const vegaTokenAddress = Cypress.env('vegaTokenAddress');
const vegaTokenContractAddress = Cypress.env('vegaTokenContractAddress');
context('Home Page - verify elements on page', function () {
context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
before('visit token home page', function () {
cy.visit('/');
});

View File

@ -1,33 +1,37 @@
const connectToVegaBtn = '[data-testid="connect-to-vega-wallet-btn"]';
const warning = '[data-testid="callout"]';
context('Rewards Page - verify elements on page', function () {
before('navigate to rewards page', function () {
cy.visit('/').navigate_to('rewards');
});
describe('with wallets disconnected', function () {
it('should have REWARDS tab highlighted', function () {
cy.verify_tab_highlighted('rewards');
context(
'Rewards Page - verify elements on page',
{ tags: '@regression' },
function () {
before('navigate to rewards page', function () {
cy.visit('/').navigate_to('rewards');
});
it('should have rewards header visible', function () {
cy.verify_page_header('Rewards');
});
describe('with wallets disconnected', function () {
it('should have REWARDS tab highlighted', function () {
cy.verify_tab_highlighted('rewards');
});
it('should have epoch warning', function () {
cy.get(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 rewards header visible', function () {
cy.verify_page_header('Rewards');
});
it('should have connect Vega wallet button', function () {
cy.get(connectToVegaBtn)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
it('should have epoch warning', function () {
cy.get(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(connectToVegaBtn)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
});
});
});
});
}
);

View File

@ -14,196 +14,202 @@ const stakeNumberRegex = /^\d*\.?\d*$/;
const ownStake = '[data-testid="own-stake"]';
const nominatedStake = '[data-testid="nominated-stake"]';
context('Staking Page - verify elements on page', function () {
before('navigate to staking page', function () {
cy.visit('/').navigate_to('staking');
});
describe('with wallets disconnected', function () {
describe('description section', function () {
it('should have staking tab highlighted', function () {
cy.verify_tab_highlighted('staking');
});
it('should have STAKING ON VEGA header visible', function () {
cy.verify_page_header('Staking');
});
it('should have Staking Guide link visible', function () {
// 1002-STKE-003
cy.get(guideLink)
.should('be.visible')
.and('have.text', 'Read more about staking on Vega')
.and(
'have.attr',
'href',
'https://docs.vega.xyz/docs/mainnet/concepts/vega-chain/#staking-on-vega'
);
});
context(
'Staking Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to staking page', function () {
cy.visit('/').navigate_to('staking');
});
describe('Should be able to see validator list from the staking page', function () {
// 1002-STKE-050
it('Should be able to see validator names', function () {
cy.get('[col-id="validator"]')
.should('have.length.at.least', 1)
.each(($name) => {
cy.wrap($name).should('not.be.empty');
});
});
it('Should be able to see validator status', function () {
cy.get('[col-id="status"]')
.should('have.length.at.least', 1)
.each(($status) => {
cy.wrap($status).should('not.be.empty');
});
});
it('Should be able to see total stake for this epoch', function () {
cy.get('[col-id="totalStakeThisEpoch"]')
.should('have.length.at.least', 1)
.each(($totalStaked) => {
cy.wrap($totalStaked).should('not.be.empty');
});
});
it('Should be able to see validator staked for this epoch', function () {
cy.get('[col-id="validatorStake"]')
.should('have.length.at.least', 1)
.each(($validatorStake) => {
cy.wrap($validatorStake).should('not.be.empty');
});
});
it('Should be able to see validator staked for next epoch', function () {
cy.get('[col-id="pendingStake"]')
.should('have.length.at.least', 1)
.each(($pendingStake) => {
cy.wrap($pendingStake).should('not.be.empty');
});
});
// 1002-STKE-021
it('Should be able to see validator ranking score', function () {
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo('right');
cy.get('[col-id="rankingScore"]')
.should('have.length.at.least', 1)
.each(($rankingScore) => {
cy.wrap($rankingScore).should('not.be.empty');
});
});
// 1002-STKE-022
it('Should be able to see validator stake score', function () {
cy.get('[col-id="stakeScore"]')
.should('have.length.at.least', 1)
.each(($stakeScore) => {
cy.wrap($stakeScore).should('not.be.empty');
});
});
// 1002-STKE-023
it('Should be able to see validator performance score', function () {
cy.get('[col-id="performanceScore"]')
.should('have.length.at.least', 1)
.each(($performanceScore) => {
cy.wrap($performanceScore).should('not.be.empty');
});
});
// 1002-STKE-024
it('Should be able to see validator voting power score', function () {
cy.get('[col-id="votingPower"]')
.should('have.length.at.least', 1)
.each(($votingPower) => {
cy.wrap($votingPower).should('not.be.empty');
});
});
});
});
// 1002-STKE-050
describe('Should be able to see static information about a validator', function () {
before('connect wallets and click on validator', function () {
cy.vega_wallet_import();
cy.vega_wallet_connect();
cy.click_on_validator_from_list(0);
});
// 1002-STKE-005
it('Should be able to see validator name', function () {
cy.get(validatorTitle).should('not.be.empty');
});
// 1002-STKE-007
it('Should be able to see validator id', function () {
cy.get(validatorId).should('not.be.empty');
});
// 1002-STKE-008
it('Should be able to see validator public key', function () {
cy.get(validatorPubKey).should('not.be.empty');
});
// 1002-STKE-010
it('Should be able to see Ethereum address', function () {
cy.get(ethAddressLink).should('not.be.empty').and('have.attr', 'href');
});
// TODO validators missing url for more information about them 1002-STKE-09
// 1002-STKE-012
it('Should be able to see total stake', function () {
cy.get(totalStake).invoke('text').should('match', stakeNumberRegex);
});
it('Should be able to see pending stake', function () {
cy.get(pendingStake).invoke('text').should('match', stakeNumberRegex);
});
it('Should be able to see staked by operator', function () {
cy.get(stakedByOperator).invoke('text').should('match', stakeNumberRegex);
});
it('Should be able to see staked by delegates', function () {
cy.get(stakedByDelegates)
.invoke('text')
.should('match', stakeNumberRegex);
});
// 1002-STKE-051
it('Should be able to see stake share in percentage', function () {
cy.get(stakeShare)
.invoke('text')
.then(($stakePercentage) => {
if ($stakePercentage != '-') {
cy.wrap($stakePercentage).should(
'match',
/\b(?<!\.)(?!0+(?:\.0+)?%)(?:\d|[1-9]\d|100)(?:(?<!100)\.\d+)?%/
);
}
describe('with wallets disconnected', function () {
describe('description section', function () {
it('should have staking tab highlighted', function () {
cy.verify_tab_highlighted('staking');
});
});
// 1002-STKE-013
it('Should be able to see own stake this epoch', function () {
cy.get(ownStake).invoke('text').should('match', stakeNumberRegex);
});
it('should have STAKING ON VEGA header visible', function () {
cy.verify_page_header('Staking');
});
// 1002-STKE-014
it('Should be able to see nominated stake this epoch', function () {
cy.get(nominatedStake).invoke('text').should('match', stakeNumberRegex);
});
it('should have Staking Guide link visible', function () {
// 1002-STKE-003
cy.get(guideLink)
.should('be.visible')
.and('have.text', 'Read more about staking on Vega')
.and(
'have.attr',
'href',
'https://docs.vega.xyz/docs/mainnet/concepts/vega-chain/#staking-on-vega'
);
});
});
// 1002-STKE-011
it('should be able to see epoch information', function () {
const epochTitle = 'h3';
const nextEpochInfo = 'p';
describe('Should be able to see validator list from the staking page', function () {
// 1002-STKE-050
it('Should be able to see validator names', function () {
cy.get('[col-id="validator"]')
.should('have.length.at.least', 1)
.each(($name) => {
cy.wrap($name).should('not.be.empty');
});
});
cy.get(epochCountDown).within(() => {
cy.get(epochTitle).should('not.be.empty');
cy.get(nextEpochInfo).should('contain.text', 'Next epoch');
it('Should be able to see validator status', function () {
cy.get('[col-id="status"]')
.should('have.length.at.least', 1)
.each(($status) => {
cy.wrap($status).should('not.be.empty');
});
});
it('Should be able to see total stake for this epoch', function () {
cy.get('[col-id="totalStakeThisEpoch"]')
.should('have.length.at.least', 1)
.each(($totalStaked) => {
cy.wrap($totalStaked).should('not.be.empty');
});
});
it('Should be able to see validator staked for this epoch', function () {
cy.get('[col-id="validatorStake"]')
.should('have.length.at.least', 1)
.each(($validatorStake) => {
cy.wrap($validatorStake).should('not.be.empty');
});
});
it('Should be able to see validator staked for next epoch', function () {
cy.get('[col-id="pendingStake"]')
.should('have.length.at.least', 1)
.each(($pendingStake) => {
cy.wrap($pendingStake).should('not.be.empty');
});
});
// 1002-STKE-021
it('Should be able to see validator ranking score', function () {
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo('right');
cy.get('[col-id="rankingScore"]')
.should('have.length.at.least', 1)
.each(($rankingScore) => {
cy.wrap($rankingScore).should('not.be.empty');
});
});
// 1002-STKE-022
it('Should be able to see validator stake score', function () {
cy.get('[col-id="stakeScore"]')
.should('have.length.at.least', 1)
.each(($stakeScore) => {
cy.wrap($stakeScore).should('not.be.empty');
});
});
// 1002-STKE-023
it('Should be able to see validator performance score', function () {
cy.get('[col-id="performanceScore"]')
.should('have.length.at.least', 1)
.each(($performanceScore) => {
cy.wrap($performanceScore).should('not.be.empty');
});
});
// 1002-STKE-024
it('Should be able to see validator voting power score', function () {
cy.get('[col-id="votingPower"]')
.should('have.length.at.least', 1)
.each(($votingPower) => {
cy.wrap($votingPower).should('not.be.empty');
});
});
});
});
});
});
// 1002-STKE-050
describe('Should be able to see static information about a validator', function () {
before('connect wallets and click on validator', function () {
cy.vega_wallet_import();
cy.vega_wallet_connect();
cy.click_on_validator_from_list(0);
});
// 1002-STKE-005
it('Should be able to see validator name', function () {
cy.get(validatorTitle).should('not.be.empty');
});
// 1002-STKE-007
it('Should be able to see validator id', function () {
cy.get(validatorId).should('not.be.empty');
});
// 1002-STKE-008
it('Should be able to see validator public key', function () {
cy.get(validatorPubKey).should('not.be.empty');
});
// 1002-STKE-010
it('Should be able to see Ethereum address', function () {
cy.get(ethAddressLink).should('not.be.empty').and('have.attr', 'href');
});
// TODO validators missing url for more information about them 1002-STKE-09
// 1002-STKE-012
it('Should be able to see total stake', function () {
cy.get(totalStake).invoke('text').should('match', stakeNumberRegex);
});
it('Should be able to see pending stake', function () {
cy.get(pendingStake).invoke('text').should('match', stakeNumberRegex);
});
it('Should be able to see staked by operator', function () {
cy.get(stakedByOperator)
.invoke('text')
.should('match', stakeNumberRegex);
});
it('Should be able to see staked by delegates', function () {
cy.get(stakedByDelegates)
.invoke('text')
.should('match', stakeNumberRegex);
});
// 1002-STKE-051
it('Should be able to see stake share in percentage', function () {
cy.get(stakeShare)
.invoke('text')
.then(($stakePercentage) => {
if ($stakePercentage != '-') {
cy.wrap($stakePercentage).should(
'match',
/\b(?<!\.)(?!0+(?:\.0+)?%)(?:\d|[1-9]\d|100)(?:(?<!100)\.\d+)?%/
);
}
});
});
// 1002-STKE-013
it('Should be able to see own stake this epoch', function () {
cy.get(ownStake).invoke('text').should('match', stakeNumberRegex);
});
// 1002-STKE-014
it('Should be able to see nominated stake this epoch', function () {
cy.get(nominatedStake).invoke('text').should('match', stakeNumberRegex);
});
// 1002-STKE-011
it('should be able to see epoch information', function () {
const epochTitle = 'h3';
const nextEpochInfo = 'p';
cy.get(epochCountDown).within(() => {
cy.get(epochTitle).should('not.be.empty');
cy.get(nextEpochInfo).should('contain.text', 'Next epoch');
});
});
});
}
);

View File

@ -1,28 +1,32 @@
const connectPrompt = '[data-testid="eth-connect-prompt"]';
const connectButton = '[data-testid="connect-to-eth-btn"]';
context('Vesting Page - verify elements on page', function () {
before('navigate to vesting page', function () {
cy.visit('/').navigate_to('vesting');
});
describe('with wallets disconnected', function () {
it('should have vesting tab highlighted', function () {
cy.verify_tab_highlighted('vesting');
context(
'Vesting Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to vesting page', function () {
cy.visit('/').navigate_to('vesting');
});
it('should have VESTING header visible', function () {
cy.verify_page_header('Vesting');
});
describe('with wallets disconnected', function () {
it('should have vesting tab highlighted', function () {
cy.verify_tab_highlighted('vesting');
});
it('should have connect Eth wallet info', function () {
cy.get(connectPrompt).should('be.visible');
});
it('should have VESTING header visible', function () {
cy.verify_page_header('Vesting');
});
it('should have connect Eth wallet button', function () {
cy.get(connectButton)
.should('be.visible')
.and('have.text', 'Connect Ethereum wallet');
it('should have connect Eth wallet info', function () {
cy.get(connectPrompt).should('be.visible');
});
it('should have connect Eth wallet button', function () {
cy.get(connectButton)
.should('be.visible')
.and('have.text', 'Connect Ethereum wallet');
});
});
});
});
}
);

View File

@ -17,242 +17,248 @@ const dialog = '[role="dialog"]';
const dialogHeader = '[data-testid="dialog-title"]';
const dialogCloseBtn = '[data-testid="dialog-close"]';
context('Ethereum Wallet - verify elements on widget', function () {
before('visit token home page', function () {
cy.visit('/');
});
describe('with wallets disconnected', function () {
before('wait for widget to load', function () {
cy.get(walletContainer, { timeout: 10000 }).should('be.visible');
context(
'Ethereum Wallet - verify elements on widget',
{ tags: '@smoke' },
function () {
before('visit token home page', function () {
cy.visit('/');
});
it('should have ETHEREUM KEY header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Ethereum key');
describe('with wallets disconnected', function () {
before('wait for widget to load', function () {
cy.get(walletContainer, { timeout: 10000 }).should('be.visible');
});
});
it('should have Connect Ethereum button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(connectToEthButton)
.should('be.visible')
.and('have.text', 'Connect Ethereum wallet to associate $VEGA');
});
});
});
describe('when Connect Ethereum clicked', function () {
// 1000-ASSO-0002
before('', function () {
cy.get(connectToEthButton).click();
});
it('should have Connect Ethereum header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'Connect to your Ethereum wallet');
});
});
it('should have connector list visible', function () {
const connectList = [
'Unknown',
'MetaMask, Brave or other injected web wallet',
'WalletConnect',
];
cy.get(connectorList).within(() => {
cy.get('button').each(($btn, i) => {
cy.wrap($btn).should('be.visible').and('have.text', connectList[i]);
});
});
});
after('close popup', function () {
cy.get(dialog)
.within(() => {
cy.get(dialogCloseBtn).click();
})
.should('not.exist');
});
});
describe('when Ethereum wallet connected', function () {
before('connect to Ethereum wallet', function () {
cy.ethereum_wallet_connect();
});
it('should have ETHEREUM KEY header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Ethereum key');
});
});
it('should have account number visible', function () {
cy.get(walletContainer).within(() => {
cy.get(accountNo)
.should('be.visible')
.and('have.text', Cypress.env('ethWalletPublicKeyTruncated'));
});
});
it('should have Associate button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(associate).should('be.visible').and('have.text', 'Associate');
});
});
it('should have Disassociate button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(disassociate)
.should('be.visible')
.and('have.text', 'Disassociate');
});
});
it('should have Disconnect button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(disconnect).should('be.visible').and('have.text', 'Disconnect');
});
});
describe('VEGA IN VESTING CONTRACT', function () {
// 1000-ASSO-0007
it('should have currency title visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyTitle)
it('should have ETHEREUM KEY header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'VEGAIn vesting contract');
.and('have.text', 'Ethereum key');
});
});
it('should have currency value visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyValue)
it('should have Connect Ethereum button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(connectToEthButton)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{18}$/);
.and('have.text', 'Connect Ethereum wallet to associate $VEGA');
});
});
});
it('should have progress bar visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(progressBar).should('be.visible');
});
describe('when Connect Ethereum clicked', function () {
// 1000-ASSO-0002
before('', function () {
cy.get(connectToEthButton).click();
});
it('should have locked currency visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyLocked)
it('should have Connect Ethereum header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
.and('have.text', 'Connect to your Ethereum wallet');
});
});
it('should have unlocked currency visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyUnlocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should match total & locked/unlocked currency value', function () {
cy.get(vegaInVesting)
.within(() => {
cy.get(currencyValue)
.invoke('text')
.convert_token_value_to_number()
.as('value');
cy.get(currencyLocked)
.invoke('text')
.convert_token_value_to_number()
.as('locked');
cy.get(currencyUnlocked)
.invoke('text')
.convert_token_value_to_number()
.as('unlocked');
})
.then(function () {
expect(parseFloat(this.value).toFixed(1)).to.equal(
parseFloat(
Math.round((this.locked + this.unlocked) * 100) / 100
).toFixed(1)
);
it('should have connector list visible', function () {
const connectList = [
'Unknown',
'MetaMask, Brave or other injected web wallet',
'WalletConnect',
];
cy.get(connectorList).within(() => {
cy.get('button').each(($btn, i) => {
cy.wrap($btn).should('be.visible').and('have.text', connectList[i]);
});
});
});
describe('VEGA IN WALLET', function () {
// 1000-ASSO-0007
it('should have currency title visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyTitle)
.should('be.visible')
.and('have.text', 'VEGAIn Wallet');
});
});
it('should have currency value visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyValue)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{18}$/);
});
});
it('should have progress bar visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(progressBar).should('be.visible');
});
});
it('should have locked currency visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyLocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should have unlocked currency visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyUnlocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should match total & locked/unlocked currency value', function () {
cy.get(vegaInWallet)
after('close popup', function () {
cy.get(dialog)
.within(() => {
cy.get(currencyValue)
.invoke('text')
.convert_token_value_to_number()
.as('value');
cy.get(currencyLocked)
.invoke('text')
.convert_token_value_to_number()
.as('locked');
cy.get(currencyUnlocked)
.invoke('text')
.convert_token_value_to_number()
.as('unlocked');
cy.get(dialogCloseBtn).click();
})
.then(function () {
expect(this.value).to.equal(this.locked + this.unlocked);
});
.should('not.exist');
});
});
});
});
describe('when Ethereum wallet connected', function () {
before('connect to Ethereum wallet', function () {
cy.ethereum_wallet_connect();
});
it('should have ETHEREUM KEY header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Ethereum key');
});
});
it('should have account number visible', function () {
cy.get(walletContainer).within(() => {
cy.get(accountNo)
.should('be.visible')
.and('have.text', Cypress.env('ethWalletPublicKeyTruncated'));
});
});
it('should have Associate button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(associate).should('be.visible').and('have.text', 'Associate');
});
});
it('should have Disassociate button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(disassociate)
.should('be.visible')
.and('have.text', 'Disassociate');
});
});
it('should have Disconnect button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(disconnect)
.should('be.visible')
.and('have.text', 'Disconnect');
});
});
describe('VEGA IN VESTING CONTRACT', function () {
// 1000-ASSO-0007
it('should have currency title visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyTitle)
.should('be.visible')
.and('have.text', 'VEGAIn vesting contract');
});
});
it('should have currency value visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyValue)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{18}$/);
});
});
it('should have progress bar visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(progressBar).should('be.visible');
});
});
it('should have locked currency visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyLocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should have unlocked currency visible', function () {
cy.get(vegaInVesting).within(() => {
cy.get(currencyUnlocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should match total & locked/unlocked currency value', function () {
cy.get(vegaInVesting)
.within(() => {
cy.get(currencyValue)
.invoke('text')
.convert_token_value_to_number()
.as('value');
cy.get(currencyLocked)
.invoke('text')
.convert_token_value_to_number()
.as('locked');
cy.get(currencyUnlocked)
.invoke('text')
.convert_token_value_to_number()
.as('unlocked');
})
.then(function () {
expect(parseFloat(this.value).toFixed(1)).to.equal(
parseFloat(
Math.round((this.locked + this.unlocked) * 100) / 100
).toFixed(1)
);
});
});
});
describe('VEGA IN WALLET', function () {
// 1000-ASSO-0007
it('should have currency title visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyTitle)
.should('be.visible')
.and('have.text', 'VEGAIn Wallet');
});
});
it('should have currency value visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyValue)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{18}$/);
});
});
it('should have progress bar visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(progressBar).should('be.visible');
});
});
it('should have locked currency visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyLocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should have unlocked currency visible', function () {
cy.get(vegaInWallet).within(() => {
cy.get(currencyUnlocked)
.should('be.visible')
.invoke('text')
.should('match', /\d{0,3}(,\d{3})*\.\d{2}$/);
});
});
it('should match total & locked/unlocked currency value', function () {
cy.get(vegaInWallet)
.within(() => {
cy.get(currencyValue)
.invoke('text')
.convert_token_value_to_number()
.as('value');
cy.get(currencyLocked)
.invoke('text')
.convert_token_value_to_number()
.as('locked');
cy.get(currencyUnlocked)
.invoke('text')
.convert_token_value_to_number()
.as('unlocked');
})
.then(function () {
expect(this.value).to.equal(this.locked + this.unlocked);
});
});
});
});
}
);

View File

@ -24,251 +24,263 @@ const dialogVegaKey = '[data-testid="vega-public-key-full"]';
const dialogDisconnectBtn = '[data-testid="disconnect"]';
const copyPublicKeyBtn = '[data-testid="copy-vega-public-key"]';
context('Vega Wallet - verify elements on widget', function () {
before('visit token home page', function () {
cy.visit('/');
});
describe('with wallets disconnected', function () {
before('wait for widget to load', function () {
cy.get(walletContainer, { timeout: 10000 }).should('be.visible');
context(
'Vega Wallet - verify elements on widget',
{ tags: '@smoke' },
function () {
before('visit token home page', function () {
cy.visit('/');
});
it('should have VEGA WALLET header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Vega Wallet');
describe('with wallets disconnected', function () {
before('wait for widget to load', function () {
cy.get(walletContainer, { timeout: 10000 }).should('be.visible');
});
it('should have VEGA WALLET header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Vega Wallet');
});
});
it('should have Connect Vega button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(connectButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet to use associated $VEGA');
});
});
it('should have Get a Vega wallet link visible', function () {
cy.get(walletContainer).within(() => {
cy.get(getVegaLink)
.should('be.visible')
.and('have.text', 'Get a Vega wallet')
.and('have.attr', 'href', 'https://vega.xyz/wallet');
});
});
});
it('should have Connect Vega button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(connectButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet to use associated $VEGA');
describe('when connect button clicked', function () {
before('click connect vega wallet button', function () {
cy.get(walletContainer).within(() => {
cy.get(connectButton).click();
});
});
it('should have Connect Vega header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'Connect to your Vega Wallet');
});
});
it('should have REST connector visible on list', function () {
cy.get(connectorsList).within(() => {
cy.get('button')
.should('be.visible')
.and('have.text', 'rest provider');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
});
it('should have Get a Vega wallet link visible', function () {
cy.get(walletContainer).within(() => {
cy.get(getVegaLink)
.should('be.visible')
.and('have.text', 'Get a Vega wallet')
.and('have.attr', 'href', 'https://vega.xyz/wallet');
describe('when rest connector form opened', function () {
before('click rest provider link', function () {
cy.get(connectorsList).within(() => {
cy.get('button').click();
});
});
});
});
describe('when connect button clicked', function () {
before('click connect vega wallet button', function () {
cy.get(walletContainer).within(() => {
cy.get(connectButton).click();
it('should have wallet field visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restWallet).should('be.visible');
});
});
it('should have password field visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restPassphrase).should('be.visible');
});
});
it('should have connect button visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restConnectBtn)
.should('be.visible')
.and('have.text', 'Connect');
});
});
it('should have Connect Vega header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'Connect to your Vega Wallet');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
// after('close dialog', function () {
// cy.get(dialogCloseBtn).click().should('not.exist');
// }); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
});
describe('when vega wallet connected', function () {
before('connect vega wallet', function () {
cy.vega_wallet_import();
// cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
// then code below can be removed
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(Cypress.env('vegaWalletName'));
cy.get('#passphrase')
.click()
.type(Cypress.env('vegaWalletPassphrase'));
cy.get('button').contains('Connect').click();
});
});
it('should have VEGA WALLET header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Vega Wallet');
});
});
it('should have truncated account number visible', function () {
cy.get(walletContainer).within(() => {
cy.get(accountNo)
.should('be.visible')
.and('have.text', Cypress.env('vegaWalletPublicKeyShort'));
});
});
it.skip('should have wallet name visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletName)
.should('be.visible')
.and('have.text', `${Cypress.env('vegaWalletName')} key 1`);
});
});
it('should have Vega Associated currency title visible', function () {
cy.get(walletContainer).within(() => {
cy.get(currencyTitle)
.should('be.visible')
.and('have.text', `VEGAAssociated`);
});
});
it('should have Vega Associated currency value visible', function () {
cy.get(walletContainer).within(() => {
cy.get(currencyValue)
.should('be.visible')
.and('have.text', `0.000000000000000000`);
});
});
it('should have Unstaked value visible', function () {
cy.get(walletContainer).within(() => {
cy.get(vegaUnstaked)
.should('be.visible')
.and('have.text', `0.000000000000000000`);
});
});
it('should have Governance button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(governanceBtn)
.should('be.visible')
.and('have.text', 'Governance');
});
});
it('should have Staking button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(stakingBtn).should('be.visible').and('have.text', 'Staking');
});
});
it('should have Manage link visible', function () {
cy.get(walletContainer).within(() => {
cy.get(manageLink).should('be.visible').and('have.text', 'Manage');
});
});
});
it('should have Connect Vega header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'Connect to your Vega Wallet');
describe('when Manage dialog opened', function () {
before('click Manage link', function () {
cy.get(walletContainer).within(() => {
cy.get(manageLink).click();
});
});
it('should have SELECT A VEGA KEY dialog title visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'SELECT A VEGA KEY');
});
});
it.skip('should have vega wallet public key and name visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogVegaKey)
.should('be.visible')
.and(
'have.text',
`${Cypress.env('vegaWalletName')} key 1 ${truncateByChars(
Cypress.env('vegaWalletPublicKey')
)}`
);
});
});
it('should have copy public key button visible', function () {
cy.get(dialog).within(() => {
cy.get(copyPublicKeyBtn)
.should('be.visible')
.and('have.text', 'Copy');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
it('should have vega Disconnect all keys button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogDisconnectBtn)
.should('be.visible')
.and('have.text', 'Disconnect all keys');
});
});
it('should be able to disconnect all keys', function () {
cy.get(dialog).within(() => {
cy.get(dialogDisconnectBtn).click();
});
cy.get(walletContainer).within(() => {
cy.get(connectButton).should('be.visible');
});
});
});
it('should have REST connector visible on list', function () {
cy.get(connectorsList).within(() => {
cy.get('button').should('be.visible').and('have.text', 'rest provider');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
});
describe('when rest connector form opened', function () {
before('click rest provider link', function () {
cy.get(connectorsList).within(() => {
cy.get('button').click();
});
});
it('should have wallet field visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restWallet).should('be.visible');
});
});
it('should have password field visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restPassphrase).should('be.visible');
});
});
it('should have connect button visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restConnectBtn).should('be.visible').and('have.text', 'Connect');
});
});
it('should have Connect Vega header visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'Connect to your Vega Wallet');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
// after('close dialog', function () {
// cy.get(dialogCloseBtn).click().should('not.exist');
// }); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
});
describe('when vega wallet connected', function () {
before('connect vega wallet', function () {
cy.vega_wallet_import();
// cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
// then code below can be removed
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(Cypress.env('vegaWalletName'));
cy.get('#passphrase').click().type(Cypress.env('vegaWalletPassphrase'));
cy.get('button').contains('Connect').click();
});
});
it('should have VEGA WALLET header visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletHeader)
.should('be.visible')
.and('have.text', 'Vega Wallet');
});
});
it('should have truncated account number visible', function () {
cy.get(walletContainer).within(() => {
cy.get(accountNo)
.should('be.visible')
.and('have.text', Cypress.env('vegaWalletPublicKeyShort'));
});
});
it.skip('should have wallet name visible', function () {
cy.get(walletContainer).within(() => {
cy.get(walletName)
.should('be.visible')
.and('have.text', `${Cypress.env('vegaWalletName')} key 1`);
});
});
it('should have Vega Associated currency title visible', function () {
cy.get(walletContainer).within(() => {
cy.get(currencyTitle)
.should('be.visible')
.and('have.text', `VEGAAssociated`);
});
});
it('should have Vega Associated currency value visible', function () {
cy.get(walletContainer).within(() => {
cy.get(currencyValue)
.should('be.visible')
.and('have.text', `0.000000000000000000`);
});
});
it('should have Unstaked value visible', function () {
cy.get(walletContainer).within(() => {
cy.get(vegaUnstaked)
.should('be.visible')
.and('have.text', `0.000000000000000000`);
});
});
it('should have Governance button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(governanceBtn)
.should('be.visible')
.and('have.text', 'Governance');
});
});
it('should have Staking button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(stakingBtn).should('be.visible').and('have.text', 'Staking');
});
});
it('should have Manage link visible', function () {
cy.get(walletContainer).within(() => {
cy.get(manageLink).should('be.visible').and('have.text', 'Manage');
});
});
});
describe('when Manage dialog opened', function () {
before('click Manage link', function () {
cy.get(walletContainer).within(() => {
cy.get(manageLink).click();
});
});
it('should have SELECT A VEGA KEY dialog title visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogHeader)
.should('be.visible')
.and('have.text', 'SELECT A VEGA KEY');
});
});
it.skip('should have vega wallet public key and name visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogVegaKey)
.should('be.visible')
.and(
'have.text',
`${Cypress.env('vegaWalletName')} key 1 ${truncateByChars(
Cypress.env('vegaWalletPublicKey')
)}`
);
});
});
it('should have copy public key button visible', function () {
cy.get(dialog).within(() => {
cy.get(copyPublicKeyBtn).should('be.visible').and('have.text', 'Copy');
});
});
it('should have close button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogCloseBtn).should('be.visible');
});
});
it('should have vega Disconnect all keys button visible', function () {
cy.get(dialog).within(() => {
cy.get(dialogDisconnectBtn)
.should('be.visible')
.and('have.text', 'Disconnect all keys');
});
});
it('should be able to disconnect all keys', function () {
cy.get(dialog).within(() => {
cy.get(dialogDisconnectBtn).click();
});
cy.get(walletContainer).within(() => {
cy.get(connectButton).should('be.visible');
});
});
});
});
}
);

View File

@ -1,23 +1,27 @@
const connectToVegaBtn = '[data-testid="connect-to-vega-wallet-btn"]';
context('Withdraw Page - verify elements on page', function () {
before('navigate to withdrawals page', function () {
cy.visit('/').navigate_to('withdrawals');
});
describe('with wallets disconnected', function () {
it('should have withdraw tab highlighted', function () {
cy.verify_tab_highlighted('withdrawals');
context(
'Withdraw Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to withdrawals page', function () {
cy.visit('/').navigate_to('withdrawals');
});
it('should have WITHDRAW header visible', function () {
cy.verify_page_header('Withdrawals');
});
describe('with wallets disconnected', function () {
it('should have withdraw tab highlighted', function () {
cy.verify_tab_highlighted('withdrawals');
});
it('should have connect Vega wallet button', function () {
cy.get(connectToVegaBtn)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
it('should have WITHDRAW header visible', function () {
cy.verify_page_header('Withdrawals');
});
it('should have connect Vega wallet button', function () {
cy.get(connectToVegaBtn)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
});
});
});
});
}
);

View File

@ -1,2 +0,0 @@
// type definitions for Cypress object "cy"
/// <reference types="cypress" />

View File

@ -5,6 +5,8 @@ import './staking.functions.js';
import './wallet-eth.functions.js';
import './wallet-teardown.functions.js';
import './wallet-vega.functions.js';
import registerCypressGrep from 'cypress-grep';
registerCypressGrep();
// Hide fetch/XHR requests - They create a lot of noise in command log
const app = window.top;

View File

@ -6,7 +6,7 @@
"allowSyntheticDefaultImports": true,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
"types": ["cypress", "node", "cypress-grep"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}

View File

@ -6,7 +6,7 @@ module.exports = defineConfig({
fileServerFolder: '.',
fixturesFolder: false,
specPattern: '**/*.cy.{js,jsx,ts,tsx}',
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videosFolder: '../../dist/cypress/apps/trading-e2e/videos',
screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots',
@ -15,11 +15,15 @@ module.exports = defineConfig({
defaultCommandTimeout: 10000,
},
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:4200',
fileServerFolder: '.',
fixturesFolder: false,
specPattern: '**/*.cy.{js,jsx,ts,tsx}',
supportFile: './src/support/index.ts',
supportFile: './src/support/index.js',
video: false,
videosFolder: '../../dist/cypress/apps/trading-e2e/videos',
videoUploadOnPasses: false,
@ -49,5 +53,8 @@ module.exports = defineConfig({
TRADING_TEST_VEGA_WALLET_PASSPHRASE: '123',
ETH_WALLET_MNEMONIC:
'ugly gallery notice network true range brave clarify flat logic someone chunk',
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});

View File

@ -8,7 +8,7 @@ const toAddressField = 'input[name="to"]';
const amountField = 'input[name="amount"]';
const formFieldError = 'input-error-text';
describe('deposit form validation', () => {
describe('deposit form validation', { tags: '@smoke' }, () => {
beforeEach(() => {
cy.mockWeb3Provider();
cy.mockGQLSubscription();

View File

@ -1,6 +1,6 @@
import { connectVegaWallet } from '../support/vega-wallet';
describe('vega wallet', () => {
describe('vega wallet', { tags: '@smoke' }, () => {
const connectVegaBtn = 'connect-vega-wallet';
const manageVegaBtn = 'manage-vega-wallet';
const form = 'rest-connector-form';
@ -61,7 +61,7 @@ describe('vega wallet', () => {
});
});
describe('ethereum wallet', () => {
describe('ethereum wallet', { tags: '@smoke' }, () => {
beforeEach(() => {
cy.mockWeb3Provider();
// Using portfolio withdrawals tab is it requires Ethereum wallet connection

View File

@ -2,7 +2,7 @@ import { aliasQuery } from '@vegaprotocol/cypress';
import { MarketState } from '@vegaprotocol/types';
import { mockTradingPage } from '../support/trading';
describe('home', () => {
describe('home', { tags: '@regression' }, () => {
const selectMarketOverlay = 'select-market-list';
beforeEach(() => {
cy.mockGQL((req) => {

View File

@ -7,7 +7,7 @@ const marketTitle = 'accordion-title';
const link = 'link';
const externalLink = 'external-link';
describe('market info is displayed', () => {
describe('market info is displayed', { tags: '@smoke' }, () => {
before(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);

View File

@ -1,7 +1,7 @@
import { MarketState } from '@vegaprotocol/types';
import { mockTradingPage } from '../support/trading';
describe('markets table', () => {
describe('markets table', { tags: '@regression' }, () => {
beforeEach(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);

View File

@ -10,7 +10,7 @@ beforeEach(() => {
cy.visit('/markets/market-0');
});
describe('accounts', () => {
describe('accounts', { tags: '@smoke' }, () => {
it('renders accounts', () => {
const tradingAccountRowId = '[row-id="ACCOUNT_TYPE_GENERAL-asset-id-null"]';
cy.getByTestId('Collateral').click();

View File

@ -10,7 +10,7 @@ beforeEach(() => {
cy.visit('/markets/market-0');
});
describe('collateral', () => {
describe('collateral', { tags: '@smoke' }, () => {
const collateralTab = 'Collateral';
const assetSymbolColumn = "[col-id='asset.symbol']";
const assetTypeColumn = "[col-id='type']";

View File

@ -27,7 +27,7 @@ const mockTx = {
},
};
describe('deal ticket orders', () => {
describe('deal ticket orders', { tags: '@regression' }, () => {
before(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);
@ -158,7 +158,7 @@ describe('deal ticket orders', () => {
it.skip('unsuccessful order due to no collateral');
});
describe('deal ticket validation', () => {
describe('deal ticket validation', { tags: '@regression' }, () => {
before(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);

View File

@ -4,7 +4,7 @@ import { MarketState } from '@vegaprotocol/types';
import { connectVegaWallet } from '../support/vega-wallet';
import { mockTradingPage } from '../support/trading';
describe('fills', () => {
describe('fills', { tags: '@regression' }, () => {
beforeEach(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);

View File

@ -14,7 +14,7 @@ before(() => {
connectVegaWallet();
});
describe('orders', () => {
describe('orders', { tags: '@smoke' }, () => {
const orderSymbol = 'market.tradableInstrument.instrument.code';
const orderSize = 'size';
const orderType = 'type';

View File

@ -9,7 +9,7 @@ beforeEach(() => {
cy.mockGQLSubscription();
});
describe('positions', () => {
describe('positions', { tags: '@smoke' }, () => {
it('renders positions on trading page', () => {
cy.visit('/markets/market-0');
cy.getByTestId('Positions').click();

View File

@ -9,7 +9,7 @@ beforeEach(() => {
cy.visit('/markets/market-0');
});
describe('trades', () => {
describe('trades', { tags: '@smoke' }, () => {
const colIdPrice = 'price';
const colIdSize = 'size';
const colIdCreatedAt = 'createdAt';

View File

@ -6,7 +6,7 @@ import { generateWithdrawFormQuery } from '../support/mocks/generate-withdraw-pa
import { generateWithdrawals } from '../support/mocks/generate-withdrawals';
import { connectVegaWallet } from '../support/vega-wallet';
describe('withdraw', () => {
describe('withdraw', { tags: '@smoke' }, () => {
const formFieldError = 'input-error-text';
const toAddressField = 'input[name="to"]';
const assetSelectField = 'select[name="asset"]';

View File

@ -0,0 +1,4 @@
import '@vegaprotocol/cypress';
import 'cypress-real-events/support';
import registerCypressGrep from 'cypress-grep';
registerCypressGrep();

View File

@ -1,2 +0,0 @@
import '@vegaprotocol/cypress';
import 'cypress-real-events/support';

View File

@ -5,7 +5,7 @@
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node", "cypress-real-events"],
"types": ["cypress", "node", "cypress-real-events", "cypress-grep"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,

View File

@ -139,7 +139,7 @@
"babel-jest": "27.5.1",
"babel-loader": "8.1.0",
"cypress": "^10.2.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-grep": "^3.0.3",
"cypress-real-events": "^1.7.1",
"dotenv": "^16.0.1",
"eslint": "8.15.0",

1360
yarn.lock

File diff suppressed because it is too large Load Diff