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
? [
specPattern: [
'./src/integration/view/**/*.cy.{js,jsx,ts,tsx}',
'./src/integration/flow/**/*.cy.{js,jsx,ts,tsx}',
]
: ['./src/integration/view/**/*.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,
},
});

View File

@ -39,7 +39,10 @@ const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 };
const restConnectorForm = '[data-testid="rest-connector-form"]';
context('Governance flow - with eth and vega wallets connected', function () {
context(
'Governance flow - with eth and vega wallets connected',
{ tags: '@slow' },
function () {
before('connect wallets and set approval limit', function () {
cy.vega_wallet_import();
cy.visit('/');
@ -347,7 +350,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible'
);
cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.contains('Proposal submitted', proposalTimeout).should(
'be.visible'
);
cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync();
}
@ -680,7 +685,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(proposalVoteProgressAgainstPercentage)
.contains('0.00%')
.and('be.visible');
cy.get(proposalVoteProgressForTokens).contains('1.00').and('be.visible');
cy.get(proposalVoteProgressForTokens)
.contains('1.00')
.and('be.visible');
cy.get(proposalVoteProgressAgainstTokens)
.contains('0.00')
.and('be.visible');
@ -745,7 +752,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(proposalVoteProgressAgainstPercentage)
.contains('100.00%')
.and('be.visible');
cy.get(proposalVoteProgressForTokens).contains('0.00').and('be.visible');
cy.get(proposalVoteProgressForTokens)
.contains('0.00')
.and('be.visible');
cy.get(proposalVoteProgressAgainstTokens)
.contains('1.00')
.and('be.visible');
@ -800,7 +809,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(proposalVoteProgressAgainstPercentage)
.contains('0.00%')
.and('be.visible');
cy.get(proposalVoteProgressForTokens).contains('1.00').and('be.visible');
cy.get(proposalVoteProgressForTokens)
.contains('1.00')
.and('be.visible');
cy.get(proposalVoteProgressAgainstTokens)
.contains('0.00')
.and('be.visible');
@ -855,7 +866,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(proposalVoteProgressAgainstPercentage)
.contains('100.00%')
.and('be.visible');
cy.get(proposalVoteProgressForTokens).contains('0.00').and('be.visible');
cy.get(proposalVoteProgressForTokens)
.contains('0.00')
.and('be.visible');
cy.get(proposalVoteProgressAgainstTokens)
.contains('1.00')
.and('be.visible');
@ -1265,7 +1278,8 @@ context('Governance flow - with eth and vega wallets connected', function () {
shortMonth = months[dateSupplied.getMonth()].substring(0, 3),
date = dateSupplied.getDate();
if (monthTextLength === 'longMonth') return `${date} ${month} ${year}`;
if (monthTextLength === 'longMonth')
return `${date} ${month} ${year}`;
else return `${date} ${shortMonth} ${year}`;
}
);
@ -1274,14 +1288,18 @@ context('Governance flow - with eth and vega wallets connected', function () {
'create_ten_digit_unix_timestamp_for_specified_days',
(durationDays) => {
let today = new Date();
let timestamp = today.setDate(today.getDate() + parseInt(durationDays));
let timestamp = today.setDate(
today.getDate() + parseInt(durationDays)
);
timestamp = Math.floor(timestamp / 1000);
return timestamp;
}
);
Cypress.Commands.add('enter_unique_freeform_proposal_body', (timestamp) => {
Cypress.Commands.add(
'enter_unique_freeform_proposal_body',
(timestamp) => {
cy.fixture('/proposals/freeform.json').then((freeformProposal) => {
freeformProposal.terms.closingTimestamp = timestamp;
freeformProposal.rationale.title += timestamp;
@ -1294,7 +1312,8 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.wrap(freeformProposal);
});
});
}
);
Cypress.Commands.add('get_network_parameters', () => {
let mutation = '{networkParameters {key value}}';
@ -1405,4 +1424,5 @@ context('Governance flow - with eth and vega wallets connected', function () {
}
);
});
});
}
);

View File

@ -26,7 +26,10 @@ const partValidatorId = '…';
const txTimeout = Cypress.env('txTimeout');
const epochTimeout = Cypress.env('epochTimeout');
context('Staking Tab - with eth and vega wallets connected', function () {
context(
'Staking Tab - with eth and vega wallets connected',
{ tags: '@slow' },
function () {
// 1002-STKE-002, 1002-STKE-032
before('visit staking tab and connect vega wallet', function () {
cy.vega_wallet_import();
@ -98,7 +101,12 @@ context('Staking Tab - with eth and vega wallets connected', function () {
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '2.00', '100%');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
});
it('Able to stake against a validator - using vega from vesting contract', function () {
@ -145,7 +153,12 @@ context('Staking Tab - with eth and vega wallets connected', function () {
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '2.00', '100%');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
});
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
@ -205,7 +218,12 @@ context('Staking Tab - with eth and vega wallets connected', function () {
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '6.00', '100%');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'6.00',
'100%'
);
});
it('Able to stake against multiple validators', function () {
@ -346,7 +364,12 @@ context('Staking Tab - with eth and vega wallets connected', function () {
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '2.00', '100%');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
});
it('Able to remove a full stake against a validator', function () {
@ -638,7 +661,12 @@ context('Staking Tab - with eth and vega wallets connected', function () {
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '2.00', '100%');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
});
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
@ -846,4 +874,5 @@ context('Staking Tab - with eth and vega wallets connected', function () {
}
);
});
});
}
);

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,7 +6,10 @@ 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 () {
context(
'Governance Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to governance page', function () {
cy.visit('/').navigate_to('governance');
});
@ -69,4 +72,5 @@ context('Governance Page - verify elements on page', function () {
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,7 +1,10 @@
const connectToVegaBtn = '[data-testid="connect-to-vega-wallet-btn"]';
const warning = '[data-testid="callout"]';
context('Rewards Page - verify elements on page', function () {
context(
'Rewards Page - verify elements on page',
{ tags: '@regression' },
function () {
before('navigate to rewards page', function () {
cy.visit('/').navigate_to('rewards');
});
@ -30,4 +33,5 @@ context('Rewards Page - verify elements on page', function () {
.and('have.text', 'Connect Vega wallet');
});
});
});
}
);

View File

@ -14,7 +14,10 @@ const stakeNumberRegex = /^\d*\.?\d*$/;
const ownStake = '[data-testid="own-stake"]';
const nominatedStake = '[data-testid="nominated-stake"]';
context('Staking Page - verify elements on page', function () {
context(
'Staking Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to staking page', function () {
cy.visit('/').navigate_to('staking');
});
@ -162,7 +165,9 @@ context('Staking Page - verify elements on page', function () {
});
it('Should be able to see staked by operator', function () {
cy.get(stakedByOperator).invoke('text').should('match', stakeNumberRegex);
cy.get(stakedByOperator)
.invoke('text')
.should('match', stakeNumberRegex);
});
it('Should be able to see staked by delegates', function () {
@ -206,4 +211,5 @@ context('Staking Page - verify elements on page', function () {
});
});
});
});
}
);

View File

@ -1,7 +1,10 @@
const connectPrompt = '[data-testid="eth-connect-prompt"]';
const connectButton = '[data-testid="connect-to-eth-btn"]';
context('Vesting Page - verify elements on page', function () {
context(
'Vesting Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to vesting page', function () {
cy.visit('/').navigate_to('vesting');
});
@ -25,4 +28,5 @@ context('Vesting Page - verify elements on page', function () {
.and('have.text', 'Connect Ethereum wallet');
});
});
});
}
);

View File

@ -17,7 +17,10 @@ const dialog = '[role="dialog"]';
const dialogHeader = '[data-testid="dialog-title"]';
const dialogCloseBtn = '[data-testid="dialog-close"]';
context('Ethereum Wallet - verify elements on widget', function () {
context(
'Ethereum Wallet - verify elements on widget',
{ tags: '@smoke' },
function () {
before('visit token home page', function () {
cy.visit('/');
});
@ -117,7 +120,9 @@ context('Ethereum Wallet - verify elements on widget', function () {
it('should have Disconnect button visible', function () {
cy.get(walletContainer).within(() => {
cy.get(disconnect).should('be.visible').and('have.text', 'Disconnect');
cy.get(disconnect)
.should('be.visible')
.and('have.text', 'Disconnect');
});
});
@ -255,4 +260,5 @@ context('Ethereum Wallet - verify elements on widget', function () {
});
});
});
});
}
);

View File

@ -24,7 +24,10 @@ 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 () {
context(
'Vega Wallet - verify elements on widget',
{ tags: '@smoke' },
function () {
before('visit token home page', function () {
cy.visit('/');
});
@ -77,7 +80,9 @@ context('Vega Wallet - verify elements on widget', function () {
it('should have REST connector visible on list', function () {
cy.get(connectorsList).within(() => {
cy.get('button').should('be.visible').and('have.text', 'rest provider');
cy.get('button')
.should('be.visible')
.and('have.text', 'rest provider');
});
});
@ -109,7 +114,9 @@ context('Vega Wallet - verify elements on widget', function () {
it('should have connect button visible', function () {
cy.get(restConnectorForm).within(() => {
cy.get(restConnectBtn).should('be.visible').and('have.text', 'Connect');
cy.get(restConnectBtn)
.should('be.visible')
.and('have.text', 'Connect');
});
});
@ -140,7 +147,9 @@ context('Vega Wallet - verify elements on widget', function () {
// 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('#passphrase')
.click()
.type(Cypress.env('vegaWalletPassphrase'));
cy.get('button').contains('Connect').click();
});
});
@ -244,7 +253,9 @@ context('Vega Wallet - verify elements on widget', function () {
it('should have copy public key button visible', function () {
cy.get(dialog).within(() => {
cy.get(copyPublicKeyBtn).should('be.visible').and('have.text', 'Copy');
cy.get(copyPublicKeyBtn)
.should('be.visible')
.and('have.text', 'Copy');
});
});
@ -271,4 +282,5 @@ context('Vega Wallet - verify elements on widget', function () {
});
});
});
});
}
);

View File

@ -1,6 +1,9 @@
const connectToVegaBtn = '[data-testid="connect-to-vega-wallet-btn"]';
context('Withdraw Page - verify elements on page', function () {
context(
'Withdraw Page - verify elements on page',
{ tags: '@smoke' },
function () {
before('navigate to withdrawals page', function () {
cy.visit('/').navigate_to('withdrawals');
});
@ -20,4 +23,5 @@ context('Withdraw Page - verify elements on page', function () {
.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