test: additional test for git info (#779)

* test: additional test for git info

* fix: lint

* fix: failing test due to change in total staked coins
This commit is contained in:
Joe Tsang 2022-07-18 11:52:26 +01:00 committed by GitHub
parent 6e1d976d08
commit 8cd394babd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 6 deletions

View File

@ -20,7 +20,9 @@ module.exports = defineConfig({
},
env: {
environment: 'CUSTOM',
networkQueryUrl: 'http://localhost:3028/query',
ethUrl: 'https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
commitHash: 'dev',
tsConfig: 'tsconfig.json',
TAGS: 'not @todo and not @ignore and not @manual',
},
});

View File

@ -53,7 +53,10 @@ context('Home Page', function () {
.should('match', /\d+d \d+h \d+m \d+s/i);
cy.get(statsValue).eq(4).should('have.text', '2');
cy.get(statsValue).eq(5).should('have.text', '0');
cy.get(statsValue).eq(6).should('have.text', '0.00');
cy.get(statsValue)
.eq(6)
.invoke('text')
.should('match', /\d+\.\d\d(?!\d)/i);
cy.get(statsValue).eq(7).should('have.text', '0');
cy.get(statsValue).eq(8).should('have.text', '0');
cy.get(statsValue).eq(9).should('have.text', '0');
@ -90,6 +93,28 @@ context('Home Page', function () {
});
});
describe('Git info', function () {
it('git info is rendered on the footer of the page', function () {
cy.getByTestId('git-info').within(() => {
cy.getByTestId('git-network-data').within(() => {
cy.contains('Reading network data from').should('be.visible');
cy.get('span').should('have.text', Cypress.env('networkQueryUrl'));
cy.getByTestId('link').should('be.visible');
});
cy.getByTestId('git-eth-data').within(() => {
cy.contains('Reading Ethereum data from').should('be.visible');
cy.get('span').should('have.text', Cypress.env('ethUrl'));
});
cy.getByTestId('git-commit-hash').within(() => {
cy.contains('Version/commit hash:').should('be.visible');
cy.getByTestId('link').should('have.text', Cypress.env('commitHash'));
});
});
});
});
describe('Search bar', function () {
it('Successful search for specific id by block id', function () {
const blockId = '973624';

View File

@ -23,15 +23,15 @@ export const NetworkInfo = () => {
const feedbackLinks = getFeedbackLinks(GITHUB_FEEDBACK_URL);
return (
<div>
<p className="mb-16">
<div data-testid="git-info">
<p data-testid="git-network-data" className="mb-16">
{t('Reading network data from')}{' '}
<Lozenge className="text-black dark:text-white bg-white-60 dark:bg-black-60">
{VEGA_URL}
</Lozenge>
. <Link onClick={() => setNodeSwitcherOpen()}>{t('Edit')}</Link>
</p>
<p className="mb-16">
<p data-testid="git-eth-data" className="mb-16">
{t('Reading Ethereum data from')}{' '}
<Lozenge className="text-black dark:text-white bg-white-60 dark:bg-black-60">
{ETHEREUM_PROVIDER_URL}
@ -39,7 +39,7 @@ export const NetworkInfo = () => {
.{' '}
</p>
{GIT_COMMIT_HASH && (
<p className="mb-16">
<p data-testid="git-commit-hash" className="mb-16">
{t('Version/commit hash')}:{' '}
<Link
href={