fix: failing test due to cypress bug (#1017)
* fix: failing test due to cypress bug * fix: lint * chore: remove assert
This commit is contained in:
parent
c664fdd067
commit
9e89b98bd0
@ -2,10 +2,9 @@ const nodeErrorType = 'node-error-type';
|
|||||||
const nodeErrorMsg = 'node-error-message';
|
const nodeErrorMsg = 'node-error-message';
|
||||||
const nodeId = 'node-url-0';
|
const nodeId = 'node-url-0';
|
||||||
const customNodeBtn = 'custom-node';
|
const customNodeBtn = 'custom-node';
|
||||||
const closeDialogBtn = 'dialog-close';
|
|
||||||
|
|
||||||
context('Node switcher', function () {
|
context('Node switcher', function () {
|
||||||
before('visit home page', function () {
|
beforeEach('visit home page', function () {
|
||||||
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
|
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
|
||||||
hosts: ['http://localhost:3028/query'],
|
hosts: ['http://localhost:3028/query'],
|
||||||
}).as('nodeData');
|
}).as('nodeData');
|
||||||
@ -20,7 +19,7 @@ context('Node switcher', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('node data is displayed', function () {
|
it('node data is displayed', function () {
|
||||||
cy.getByTestId('node-row').should('have.length.at.least', 1);
|
cy.getByTestId('node-row').should('have.length.at.least', 2);
|
||||||
|
|
||||||
cy.getByTestId('node-row')
|
cy.getByTestId('node-row')
|
||||||
.eq(0)
|
.eq(0)
|
||||||
@ -29,21 +28,12 @@ context('Node switcher', function () {
|
|||||||
.should('exist')
|
.should('exist')
|
||||||
.and('have.attr', 'aria-checked', 'true');
|
.and('have.attr', 'aria-checked', 'true');
|
||||||
cy.get('label').should('have.text', Cypress.env('networkQueryUrl'));
|
cy.get('label').should('have.text', Cypress.env('networkQueryUrl'));
|
||||||
cy.getByTestId('response-time-cell')
|
cy.getByTestId('response-time-cell').should('contain.text', 'ms');
|
||||||
.should('not.be.empty')
|
|
||||||
.and('contain.text', 'ms');
|
|
||||||
cy.getByTestId('block-cell').should('not.be.empty');
|
cy.getByTestId('block-cell').should('not.be.empty');
|
||||||
cy.getByTestId('ssl-cell').should('have.text', 'Yes');
|
cy.getByTestId('ssl-cell').should('have.text', 'Yes');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Incorrect network displayed', function () {
|
|
||||||
const errorTypeTxt = 'Error: incorrect network';
|
|
||||||
const nodeErrorTxt = 'This node is not on the CUSTOM network.';
|
|
||||||
|
|
||||||
validateNodeError(errorTypeTxt, nodeErrorTxt);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('cannot connect to network using invalid url', function () {
|
it('cannot connect to network using invalid url', function () {
|
||||||
const errorTypeTxt = 'Error: invalid url';
|
const errorTypeTxt = 'Error: invalid url';
|
||||||
const nodeErrorTxt = 'fakeUrl is not a valid url.';
|
const nodeErrorTxt = 'fakeUrl is not a valid url.';
|
||||||
@ -70,10 +60,6 @@ context('Node switcher', function () {
|
|||||||
validateNodeError(errorTypeTxt, nodeErrorTxt);
|
validateNodeError(errorTypeTxt, nodeErrorTxt);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach('Close node switcher', function () {
|
|
||||||
cy.getByTestId(closeDialogBtn).should('be.enabled').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
function validateNodeError(errortype, errorMsg) {
|
function validateNodeError(errortype, errorMsg) {
|
||||||
cy.getByTestId(nodeErrorType, { timeout: 10000 }).should(
|
cy.getByTestId(nodeErrorType, { timeout: 10000 }).should(
|
||||||
'have.text',
|
'have.text',
|
||||||
|
Loading…
Reference in New Issue
Block a user