Rebase and test for txs page
This commit is contained in:
parent
906337221e
commit
8a91a7d153
@ -0,0 +1,6 @@
|
|||||||
|
Feature: Transactions Page
|
||||||
|
|
||||||
|
Scenario: Navigate to transactions page
|
||||||
|
Given I am on the homepage
|
||||||
|
When I navigate to the transactions page
|
||||||
|
Then transactions page is correctly displayed
|
@ -1,5 +1,5 @@
|
|||||||
export default class BasePage {
|
export default class BasePage {
|
||||||
transactionsUrl = '/tsx';
|
transactionsUrl = '/txs';
|
||||||
blocksUrl = '/blocks';
|
blocksUrl = '/blocks';
|
||||||
partiesUrl = '/parties';
|
partiesUrl = '/parties';
|
||||||
assetsUrl = '/assets';
|
assetsUrl = '/assets';
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
import BasePage from './base-page';
|
import BasePage from './base-page';
|
||||||
|
|
||||||
export default class TransactionsPage extends BasePage {
|
export default class TransactionsPage extends BasePage {
|
||||||
unconfirmedTransactions = 'unconfirmed-txs';
|
blockRow = 'block-row';
|
||||||
|
blockHeight = 'block-height';
|
||||||
|
numberOfTransactions = 'num-txs';
|
||||||
|
validatorLink = 'validator-link';
|
||||||
|
blockTime = 'block-time';
|
||||||
|
refreshBtn = 'refresh';
|
||||||
|
|
||||||
validateUnconfirmedTxsNumDisplayed() {
|
validateTransactionsPagedisplayed() {
|
||||||
cy.getByTestId(this.unconfirmedTransactions)
|
cy.getByTestId(this.blockRow).should('have.length.above', 1);
|
||||||
.should('contain.text', 'Number: ')
|
cy.getByTestId(this.blockHeight).first().should('not.be.empty');
|
||||||
.and('have.length.above', 8);
|
cy.getByTestId(this.numberOfTransactions).first().should('not.be.empty');
|
||||||
|
cy.getByTestId(this.validatorLink).first().should('not.be.empty');
|
||||||
|
cy.getByTestId(this.blockTime).first().should('not.be.empty');
|
||||||
|
}
|
||||||
|
|
||||||
|
validateRefreshBtn() {
|
||||||
|
cy.getByTestId(this.blockHeight)
|
||||||
|
.first()
|
||||||
|
.invoke('text')
|
||||||
|
.then((blockHeightTxt) => {
|
||||||
|
cy.getByTestId(this.refreshBtn).click();
|
||||||
|
|
||||||
|
cy.getByTestId(this.blockHeight)
|
||||||
|
.first()
|
||||||
|
.invoke('text')
|
||||||
|
.should((newBlockHeightText) => {
|
||||||
|
expect(blockHeightTxt).not.to.eq(newBlockHeightText);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
cy.getByTestId(this.blockTime).first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
|
||||||
|
|
||||||
|
import TransactionsPage from '../pages/transactions-page';
|
||||||
|
const transactionsPage = new TransactionsPage();
|
||||||
|
|
||||||
|
When('I navigate to the transactions page', () => {
|
||||||
|
transactionsPage.navigateToTxs();
|
||||||
|
});
|
||||||
|
|
||||||
|
Then('transactions page is correctly displayed', () => {
|
||||||
|
transactionsPage.validateTransactionsPagedisplayed();
|
||||||
|
transactionsPage.validateRefreshBtn();
|
||||||
|
});
|
@ -20,23 +20,23 @@ export const BlocksTable = ({ data, showTransactions }: BlocksProps) => {
|
|||||||
{data.result?.block_metas?.map((block, index) => {
|
{data.result?.block_metas?.map((block, index) => {
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={index}>
|
<React.Fragment key={index}>
|
||||||
<tr>
|
<tr data-testid="block-row">
|
||||||
<td>
|
<td data-testid="block-height">
|
||||||
<Link to={`/blocks/${block.header?.height}`}>
|
<Link to={`/blocks/${block.header?.height}`}>
|
||||||
{block.header?.height}
|
{block.header?.height}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-testid="num-txs">
|
||||||
{block.num_txs === '1'
|
{block.num_txs === '1'
|
||||||
? '1 transaction'
|
? '1 transaction'
|
||||||
: `${block.num_txs} transactions`}
|
: `${block.num_txs} transactions`}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-testid="validator-link">
|
||||||
<Link to={`/validators/${block.header?.proposer_address}`}>
|
<Link to={`/validators/${block.header?.proposer_address}`}>
|
||||||
{block.header.proposer_address}
|
{block.header.proposer_address}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-testid="block-time">
|
||||||
<SecondsAgo date={block.header?.time} />
|
<SecondsAgo date={block.header?.time} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -16,7 +16,9 @@ const Blocks = () => {
|
|||||||
<>
|
<>
|
||||||
<section>
|
<section>
|
||||||
<h1>Blocks</h1>
|
<h1>Blocks</h1>
|
||||||
<button onClick={() => refetch()}>Refresh to see latest blocks</button>
|
<button data-testid="refresh" onClick={() => refetch()}>
|
||||||
|
Refresh to see latest blocks
|
||||||
|
</button>
|
||||||
<BlocksTable data={data} />
|
<BlocksTable data={data} />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ const Txs = () => {
|
|||||||
<>
|
<>
|
||||||
<section>
|
<section>
|
||||||
<h1>Transactions</h1>
|
<h1>Transactions</h1>
|
||||||
<button onClick={() => refetch()}>Refresh to see latest blocks</button>
|
<button data-testid="refresh" onClick={() => refetch()}>
|
||||||
|
Refresh to see latest blocks
|
||||||
|
</button>
|
||||||
<BlocksTable data={data} showTransactions={true} />
|
<BlocksTable data={data} showTransactions={true} />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user