test: update test for network parameters table (#300) (#408)

* test: update test for network parameters table (#300)

* fix: lint
This commit is contained in:
Joe Tsang 2022-05-23 10:32:05 +01:00 committed by GitHub
parent aa28f2cac1
commit aec94f0354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 22 deletions

View File

@ -9,15 +9,3 @@ Feature: Network parameters Page
Given I am on mobile and open the toggle menu Given I am on mobile and open the toggle menu
When I navigate to network parameters page When I navigate to network parameters page
Then network parameters page is correctly displayed Then network parameters page is correctly displayed
Scenario: Navigate to network parameters page and check each value is non-empty
Given I am on the homepage
When I navigate to network parameters page
Then network parameters page is correctly displayed
And each value is non-empty
Scenario: Navigate to network parameters page and check each value using mobile
Given I am on mobile and open the toggle menu
When I navigate to network parameters page
Then network parameters page is correctly displayed
And each value is non-empty

View File

@ -3,20 +3,37 @@ import BasePage from './base-page';
export default class NetworkParametersPage extends BasePage { export default class NetworkParametersPage extends BasePage {
networkParametersHeader = 'network-param-header'; networkParametersHeader = 'network-param-header';
parameters = 'parameters'; parameters = 'parameters';
jsonParamNameClassName = '.hljs-attr';
jsonParamValueStringClassName = '.hljs-string';
jsonParamValueNumberClassName = '.hljs-number';
parameterKeyValueRow = 'key-value-table-row';
verifyNetworkParametersDisplayed() { verifyNetworkParametersDisplayed() {
cy.getByTestId(this.networkParametersHeader).should( cy.getByTestId(this.networkParametersHeader).should(
'have.text', 'have.text',
'Network Parameters' 'Network Parameters'
); );
cy.getByTestId(this.parameters).should('not.be.empty');
}
eachValueIsNonEmpty() { cy.get(this.jsonParamNameClassName)
cy.getByTestId(this.parameters).then(($parameters) => { .should('have.length.at.least', 21)
$parameters.each((_index, element) => { .each(($paramName) => {
cy.wrap(element).should('not.be.empty'); cy.wrap($paramName).should('not.be.empty');
}); });
cy.get(this.jsonParamValueStringClassName)
.should('have.length.at.least', 7)
.each(($paramValue) => {
cy.wrap($paramValue).should('not.be.empty');
});
cy.get(this.jsonParamValueNumberClassName)
.should('have.length.at.least', 9)
.each(($paramValue) => {
cy.wrap($paramValue).should('not.be.empty');
});
cy.getByTestId(this.parameterKeyValueRow).each(($row) => {
cy.wrap($row).find('dt').should('not.be.empty');
cy.wrap($row).find('dd').should('not.be.empty');
}); });
} }
} }

View File

@ -9,7 +9,3 @@ When('I navigate to network parameters page', () => {
Then('network parameters page is correctly displayed', () => { Then('network parameters page is correctly displayed', () => {
networkPage.verifyNetworkParametersDisplayed(); networkPage.verifyNetworkParametersDisplayed();
}); });
Then('each value is non-empty', () => {
networkPage.eachValueIsNonEmpty();
});