Additional search tests added (#124)
This commit is contained in:
parent
6ad2a7676e
commit
56b6933ea3
@ -1,4 +1,23 @@
|
||||
Feature: Home page
|
||||
|
||||
Scenario: Visit Home page
|
||||
Scenario Outline: Succesfful search for specific id by <IdType>
|
||||
Given I am on the homepage
|
||||
When I search for '<Id>'
|
||||
Then I am redirected to page containing id '<Id>'
|
||||
|
||||
Examples:
|
||||
| IdType | Id |
|
||||
| Block Id | 973624 |
|
||||
| Tx Hash | 9ED3718AA8308E7E08EC588EE7AADAF49711D2138860D8914B4D81A2054D9FB8 |
|
||||
| Tx Id | 0x61DCCEBB955087F50D0B85382DAE138EDA9631BF1A4F92E563D528904AA38898 |
|
||||
|
||||
Scenario Outline: Error message displayed when invalid search by <invalidType>
|
||||
Given I am on the homepage
|
||||
When I search for '<Id>'
|
||||
Then search error message "<errorMessage>" is displayed
|
||||
|
||||
Examples:
|
||||
| invalidType | Id | errorMessage |
|
||||
| wrong string length | 9ED3718AA8308E7E08EC588EE7AADAF497D2138860D8914B4D81A2054D9FB8 | Something doesn't look right |
|
||||
| invalid hash | 9ED3718AA8308E7E08ECht8EE753DAF49711D2138860D8914B4D81A2054D9FB8 | Transaction is not hexadecimal |
|
||||
| empty search | | Search required |
|
||||
|
@ -9,7 +9,9 @@ export default class BasePage {
|
||||
networkParametersUrl = '/network-parameters';
|
||||
validatorsUrl = '/validators';
|
||||
blockExplorerHeader = 'explorer-header';
|
||||
searchField = 'search-input';
|
||||
searchField = 'search';
|
||||
searchButton = 'search-button';
|
||||
searchError = 'search-error';
|
||||
|
||||
navigateToTxs() {
|
||||
cy.get(`a[href='${this.transactionsUrl}']`).click();
|
||||
@ -48,7 +50,17 @@ export default class BasePage {
|
||||
}
|
||||
|
||||
search(searchText) {
|
||||
cy.getByTestId(this.searchField).type(searchText);
|
||||
if (searchText) {
|
||||
cy.getByTestId(this.searchField).type(searchText);
|
||||
}
|
||||
}
|
||||
|
||||
clickSearch() {
|
||||
cy.getByTestId(this.searchButton).click();
|
||||
}
|
||||
|
||||
validateUrl(expectedUrl) {
|
||||
cy.url().should('include', expectedUrl);
|
||||
}
|
||||
|
||||
validateSearchDisplayed() {
|
||||
@ -59,6 +71,10 @@ export default class BasePage {
|
||||
cy.getByTestId(this.searchField).should('be.visible');
|
||||
}
|
||||
|
||||
validateSearchErrorDisplayed(errorMessage) {
|
||||
cy.getByTestId(this.searchError).should('have.text', errorMessage);
|
||||
}
|
||||
|
||||
validateBlockDataDisplayed(headerTestId) {
|
||||
cy.getByTestId(headerTestId).then(($assetHeaders) => {
|
||||
const headersAmount = parseInt($assetHeaders.length);
|
||||
|
@ -1,5 +1,20 @@
|
||||
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
|
||||
import BasePage from '../pages/base-page';
|
||||
const basePage = new BasePage();
|
||||
|
||||
Given('I am on the homepage', () => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
When('I search for {string}', (searchText) => {
|
||||
basePage.search(searchText);
|
||||
basePage.clickSearch();
|
||||
});
|
||||
|
||||
Then('I am redirected to page containing id {string}', (expectedUrl) => {
|
||||
basePage.validateUrl(expectedUrl);
|
||||
});
|
||||
|
||||
Then('search error message {string} is displayed', (expectedErrorMsg) => {
|
||||
basePage.validateSearchErrorDisplayed(expectedErrorMsg);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user