test: env variable handling and cleanup
This commit is contained in:
parent
db81af1f2a
commit
1125d34f03
@ -13,21 +13,5 @@ module.exports = defineConfig({
|
|||||||
videosFolder: '../../dist/cypress/apps/explorer-e2e/videos',
|
videosFolder: '../../dist/cypress/apps/explorer-e2e/videos',
|
||||||
screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots',
|
screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots',
|
||||||
chromeWebSecurity: false,
|
chromeWebSecurity: false,
|
||||||
},
|
}
|
||||||
env: {
|
|
||||||
eth_provider_url: 'http://localhost:8545/',
|
|
||||||
eth_wallet_public_key: '0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F',
|
|
||||||
eth_staking_bridge_contract_address:
|
|
||||||
'0x9135f5afd6F055e731bca2348429482eE614CFfA',
|
|
||||||
vega_wallet_name: 'capsule_wallet',
|
|
||||||
vega_wallet_location: '~/.vegacapsule/testnet/wallet',
|
|
||||||
vega_wallet_passphrase: '123',
|
|
||||||
vega_wallet_mnemonic:
|
|
||||||
'ozone access unlock valid olympic save include omit supply green clown session',
|
|
||||||
vega_wallet_public_key:
|
|
||||||
'02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65',
|
|
||||||
vega_wallet_public_key_short: '02ecea…2f65',
|
|
||||||
vega_token_contract_address: '0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7',
|
|
||||||
vega_token_address: '0x67175Da1D5e966e40D11c4B2519392B2058373de',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
15
apps/token-e2e/src/fixtures/envVars.json
Normal file
15
apps/token-e2e/src/fixtures/envVars.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"tokenAddress": "0x67175Da1D5e966e40D11c4B2519392B2058373de",
|
||||||
|
"vestingContract": "0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7",
|
||||||
|
"ethProviderUrl": "http://localhost:8545/",
|
||||||
|
"ethWalletPublicKey": "0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F",
|
||||||
|
"ethStakingBridgeContractAddress": "0x9135f5afd6F055e731bca2348429482eE614CFfA",
|
||||||
|
"vegaWalletName": "capsule_wallet",
|
||||||
|
"vegaWalletLocation": "~/.vegacapsule/testnet/wallet",
|
||||||
|
"vegaWalletPassphrase": "123",
|
||||||
|
"vegaWalletMnemonic":"ozone access unlock valid olympic save include omit supply green clown session",
|
||||||
|
"vegaWalletPublicKey":"02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65",
|
||||||
|
"vegaWalletPublicKeyShort": "02ecea…2f65",
|
||||||
|
"vegaTokenContractAddress": "0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7",
|
||||||
|
"vegaTokenAddress": "0x67175Da1D5e966e40D11c4B2519392B2058373de"
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"tokenAddress": "0x67175Da1D5e966e40D11c4B2519392B2058373de",
|
|
||||||
"vestingContract": "0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7"
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
const fairgroundSet = Cypress.env('FAIRGROUND');
|
|
||||||
|
|
||||||
describe('token', () => {
|
|
||||||
beforeEach(() => cy.visit('/'));
|
|
||||||
|
|
||||||
it('should always have a header title based on environment', () => {
|
|
||||||
cy.get('[data-testid="header-title"]', { timeout: 8000 }).should(
|
|
||||||
'have.text',
|
|
||||||
`${fairgroundSet ? 'Fairground token' : 'VEGA TOKEN'}`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
@ -3,6 +3,7 @@ import navigation from '../../locators/navigation.locators';
|
|||||||
import staking from '../../locators/staking.locators';
|
import staking from '../../locators/staking.locators';
|
||||||
import '../../support/staking.functions';
|
import '../../support/staking.functions';
|
||||||
import '../../support/wallet.functions';
|
import '../../support/wallet.functions';
|
||||||
|
import envVars from '../../fixtures/envVars.json';
|
||||||
|
|
||||||
context('Staking Tab - with vega wallet connected', function () {
|
context('Staking Tab - with vega wallet connected', function () {
|
||||||
before('visit staking tab and connect vega wallet', function () {
|
before('visit staking tab and connect vega wallet', function () {
|
||||||
@ -16,9 +17,6 @@ context('Staking Tab - with vega wallet connected', function () {
|
|||||||
cy.get(navigation.staking).first().click();
|
cy.get(navigation.staking).first().click();
|
||||||
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
|
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
|
||||||
cy.get(staking.validatorNames).first().invoke('text').as('validatorName');
|
cy.get(staking.validatorNames).first().invoke('text').as('validatorName');
|
||||||
cy.wrap(Cypress.env('vega_wallet_public_key_short')).as(
|
|
||||||
'vegaPublicKeyShort'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Vega wallet - contains VEGA tokens', function () {
|
describe('Vega wallet - contains VEGA tokens', function () {
|
||||||
@ -36,7 +34,7 @@ context('Staking Tab - with vega wallet connected', function () {
|
|||||||
it('Able to associate tokens', function () {
|
it('Able to associate tokens', function () {
|
||||||
cy.ethereum_wallet_associate_tokens('2');
|
cy.ethereum_wallet_associate_tokens('2');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
||||||
this.vegaPublicKeyShort,
|
envVars.vegaWalletPublicKeyShort,
|
||||||
'2.000000000000000000'
|
'2.000000000000000000'
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
||||||
@ -45,7 +43,7 @@ context('Staking Tab - with vega wallet connected', function () {
|
|||||||
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
||||||
cy.ethereum_wallet_associate_tokens('1001', 'Approve');
|
cy.ethereum_wallet_associate_tokens('1001', 'Approve');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
||||||
this.vegaPublicKeyShort,
|
envVars.vegaWalletPublicKeyShort,
|
||||||
'1,001.000000000000000000'
|
'1,001.000000000000000000'
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_associated_value_is('1,001.000000000000000000');
|
cy.vega_wallet_check_associated_value_is('1,001.000000000000000000');
|
||||||
@ -57,7 +55,7 @@ context('Staking Tab - with vega wallet connected', function () {
|
|||||||
|
|
||||||
cy.ethereum_wallet_disassociate_tokens('1');
|
cy.ethereum_wallet_disassociate_tokens('1');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
||||||
this.vegaPublicKeyShort,
|
envVars.vegaWalletPublicKeyShort,
|
||||||
'1.000000000000000000'
|
'1.000000000000000000'
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
|
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
|
||||||
@ -69,7 +67,7 @@ context('Staking Tab - with vega wallet connected', function () {
|
|||||||
|
|
||||||
cy.ethereum_wallet_disassociate_all_tokens();
|
cy.ethereum_wallet_disassociate_all_tokens();
|
||||||
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
|
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
|
||||||
this.vegaPublicKeyShort
|
envVars.vegaWalletPublicKeyShort
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
|
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import navigation from '../locators/navigation.locators';
|
import navigation from '../locators/navigation.locators';
|
||||||
import home from '../locators/home.locators';
|
import home from '../locators/home.locators';
|
||||||
import vegaToken from '../fixtures/vegaToken.json';
|
import envVars from '../fixtures/envVars.json';
|
||||||
|
|
||||||
context('Home Page - verify elements on page', function () {
|
context('Home Page - verify elements on page', function () {
|
||||||
before('visit token home page', function () {
|
before('visit token home page', function () {
|
||||||
@ -51,7 +51,7 @@ context('Home Page - verify elements on page', function () {
|
|||||||
cy.get(home.address)
|
cy.get(home.address)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.should('be.equal', vegaToken.tokenAddress);
|
.should('be.equal', envVars.vegaTokenAddress);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should have VESTING CONTRACT', function () {
|
it('should have VESTING CONTRACT', function () {
|
||||||
@ -59,7 +59,7 @@ context('Home Page - verify elements on page', function () {
|
|||||||
cy.get(home.contract)
|
cy.get(home.contract)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.should('be.equal', vegaToken.vestingContract);
|
.should('be.equal', envVars.vegaTokenContractAddress);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should have TOTAL SUPPLY', function () {
|
it('should have TOTAL SUPPLY', function () {
|
||||||
|
@ -6,21 +6,20 @@ import {
|
|||||||
TokenVesting,
|
TokenVesting,
|
||||||
} from '@vegaprotocol/smart-contracts';
|
} from '@vegaprotocol/smart-contracts';
|
||||||
import { ethers, Wallet } from 'ethers';
|
import { ethers, Wallet } from 'ethers';
|
||||||
|
import envVars from '../fixtures/envVars.json';
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
const vegaWalletName = Cypress.env('vega_wallet_name');
|
const vegaWalletName = envVars.vegaWalletName;
|
||||||
const vegaWalletLocation = Cypress.env('vega_wallet_location');
|
const vegaWalletLocation = envVars.vegaWalletLocation;
|
||||||
const vegaWalletPassphrase = Cypress.env('vega_wallet_passphrase');
|
const vegaWalletPassphrase = envVars.vegaWalletPassphrase;
|
||||||
const vegaWalletMnemonic = Cypress.env('vega_wallet_mnemonic');
|
const vegaWalletMnemonic = envVars.vegaWalletMnemonic;
|
||||||
const vegaWalletPubKey = Cypress.env('vega_wallet_public_key');
|
const vegaWalletPubKey = envVars.vegaWalletPublicKey;
|
||||||
const vegaTokenContractAddress = Cypress.env('vega_token_contract_address');
|
const vegaTokenContractAddress = envVars.vegaTokenContractAddress;
|
||||||
const vegaTokenAddress = Cypress.env('vega_token_address');
|
const vegaTokenAddress = envVars.vegaTokenAddress;
|
||||||
const ethWalletPubKey = Cypress.env('eth_wallet_public_key');
|
const ethWalletPubKey = envVars.ethWalletPublicKey;
|
||||||
const ethStakingBridgeContractAddress = Cypress.env(
|
const ethStakingBridgeContractAddress = envVars.ethStakingBridgeContractAddress;
|
||||||
'eth_staking_bridge_contract_address'
|
const ethProviderUrl = envVars.ethProviderUrl;
|
||||||
);
|
|
||||||
const ethProviderUrl = Cypress.env('eth_provider_url');
|
|
||||||
const getAccount = (number = 0) => `m/44'/60'/0'/0/${number}`;
|
const getAccount = (number = 0) => `m/44'/60'/0'/0/${number}`;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
@ -190,7 +189,6 @@ Cypress.Commands.add('vega_wallet_import', function () {
|
|||||||
|
|
||||||
Cypress.Commands.add('vega_wallet_connect', function () {
|
Cypress.Commands.add('vega_wallet_connect', function () {
|
||||||
cy.log('**_Connecting Vega Wallet_**');
|
cy.log('**_Connecting Vega Wallet_**');
|
||||||
// cy.intercept('POST', queryUrl).as('queryGrab');
|
|
||||||
cy.get(wallet.vegawallet).within(() => {
|
cy.get(wallet.vegawallet).within(() => {
|
||||||
cy.get('button')
|
cy.get('button')
|
||||||
.contains('Connect Vega wallet to use associated $VEGA')
|
.contains('Connect Vega wallet to use associated $VEGA')
|
||||||
|
Loading…
Reference in New Issue
Block a user