chore(cypress): remove cypress project id (#3739)

This commit is contained in:
Joe Tsang 2023-05-12 13:44:22 +01:00 committed by GitHub
parent fcd4541625
commit fae61c28ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 100 deletions

View File

@ -33,5 +33,4 @@ jobs:
config: baseUrl=${{ github.event.inputs.url }}
env: grepTags=@live
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -66,7 +66,7 @@ jobs:
######
- name: Run Cypress tests
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome --env.grepTags="${{ inputs.tags }}"
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --browser chrome --env.grepTags="${{ inputs.tags }}"
working-directory: frontend-monorepo
env:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}

View File

@ -57,7 +57,6 @@ context(
// 2001-STKE-002, 2001-STKE-032
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.validatorsSelfDelegate();
ethereumWalletConnect();
// this is a workaround for #2422 which can be removed once issue is resolved
cy.associateTokensToVegaWallet('4');

View File

@ -31,9 +31,6 @@ const totalPenaltyToolTip = '[data-testid="total-penalty-tooltip"]';
const epochCountDown = '[data-testid="epoch-countdown"]';
const stakeNumberRegex = /^\d{1,3}(,\d{3})*(\.\d+)?$/;
// If running locally, validators need to have self-stake to be displayed
// Run cy.validatorsSelfDelegate() in before hook
context('Validators Page - verify elements on page', function () {
before('navigate to validators page', function () {
cy.visit('/validators');

View File

@ -33,4 +33,6 @@ before(() => {
aliasGQLQuery(req, 'ChainId', chainIdQuery());
aliasGQLQuery(req, 'Statistics', statisticsQuery());
});
// Self stake validators so they are displayed
cy.validatorsSelfDelegate();
});

View File

@ -1,4 +1,6 @@
import { gql } from 'graphql-request';
import { selfDelegate } from '../capsule/self-delegate';
import { requestGQL, setGraphQLEndpoint } from '../capsule/request';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
@ -19,7 +21,10 @@ export const addValidatorsSelfDelegate = () => {
vegaUrl: Cypress.env('VEGA_URL'),
faucetUrl: Cypress.env('FAUCET_URL'),
};
setGraphQLEndpoint(config.vegaUrl);
cy.wrap(getStakedByOperator()).as('selfStakeAmount');
cy.get('@selfStakeAmount').then((selfStakeAmount) => {
if (String(selfStakeAmount) == '0') {
// Get node wallet recovery phrases
cy.exec('vegacapsule nodes ls --home-path ~/.vegacapsule/testnet/')
.its('stdout')
@ -126,5 +131,33 @@ export const addValidatorsSelfDelegate = () => {
});
});
});
}
});
});
};
async function getStakedByOperator() {
const query = gql`
query ExplorerNodes {
nodesConnection {
edges {
node {
stakedByOperator
}
}
}
}
`;
const res = await requestGQL<{
nodesConnection: {
edges: Array<{
node: {
stakedByOperator: string;
};
}>;
};
}>(query);
return res.nodesConnection.edges[0].node.stakedByOperator;
}