vega-frontend-monorepo/libs/cypress/src/lib/commands/restart-vegacapsule-network.ts
AndyWhiteVega edb31e0f46
Test/expand explorer tests to include parties page (#1530)
* test: parties test suite

* test: lint

* test: improve error handling

* test: lint

* test: extra error handling and deletion of redundant curl params

* test: lint

* test: lint

* test: update

* test: skip test

* test: tweaks

* test: lint

* test: lint
2022-10-03 09:50:36 +01:00

45 lines
1.6 KiB
TypeScript

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
restart_vegacapsule_network(): void;
}
}
}
export function addRestartVegacapsuleNetwork() {
Cypress.Commands.add('restart_vegacapsule_network', () => {
Cypress.on('uncaught:exception', () => {
// stopping the network causes errors with pending transactions
// This stops those errors from preventing the teardown
return false;
});
// We stop the network twice - since it does not always shutdown correctly on first attempt
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
.its('stderr')
.should('contain', 'network cleaning up success');
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }
)
.its('stderr')
.then((response) => {
if (!response.includes('starting network success')) {
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }
)
.its('stderr')
.then((response) => {
return response;
});
}
})
.should('contain', 'starting network success');
});
}