Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Scan: Add UI test for all pages #2740

Merged
merged 4 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

### Scan

- (impv) [\#2740](https://github.com/bandprotocol/bandchain/pull/2740) Add UI test for all pages
- (impv) [\#2725](https://github.com/bandprotocol/bandchain/pull/2725) Show validator name if voter is validator
- (impv) [\#2719](https://github.com/bandprotocol/bandchain/pull/2719) Implement query Band supply
- (bugs) [\#2716](https://github.com/bandprotocol/bandchain/pull/2716) Fixed no decimal balance bug on account index
Expand Down
152 changes: 152 additions & 0 deletions scan/cypress/integration/all_pages.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/// <reference types="cypress" />

describe("Navigation", () => {
describe("Home", () => {
describe("Should be able to render Home page", () => {
before(() => {
cy.visit("/").wait(1000);
});

it("Validate highlight info", () => {
cy.get('[id="highlight-Band Price"] > span:nth-of-type(1)').should(
"contain",
"Band Price"
);
cy.get('[id="highlight-Market Cap"] > span:nth-of-type(1)').should(
"contain",
"Market Cap"
);
cy.get('[id="highlight-Latest Block"] > span:nth-of-type(1)').should(
"contain",
"Latest Block"
);
cy.get(
'[id="highlight-Active Validators"] > span:nth-of-type(1)'
).should("contain", "Active Validators");
});

it("Validate total request graph", () => {
cy.get('[id="totalRequestsGraphSection"] > h4:nth-of-type(1)').should(
"contain",
"Total Requests"
);
});

it("Validate latest requests", () => {
cy.get(
'[id="latestRequestsSectionHeader"] > div:nth-of-type(1) > span:nth-of-type(1)'
).should("contain", "Latest Requests");
});

it("Validate latest blocks", () => {
cy.get(
'[id="latestBlocksSectionHeader"] > div:nth-of-type(1) > span:nth-of-type(1)'
).should("contain", "Latest Blocks");
});

it("Validate latest transactions", () => {
cy.get(
'[id="latestTransactionsSectionHeader"] > div:nth-of-type(1) > span:nth-of-type(1)'
evilpeach marked this conversation as resolved.
Show resolved Hide resolved
).should("contain", "Latest Transactions");
});
});
});

describe("Validators", () => {
before(() => {
cy.visit("/validators").wait(1000);
});

describe("Should be able to render Validators page", () => {
it("Validate title", () => {
cy.get(
'[id="validatorsSection"] > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Validators");
});
});
});

describe("Blocks", () => {
before(() => {
cy.visit("/blocks").wait(1000);
});

describe("Should be able to render Blocks page", () => {
it("Validate title", () => {
cy.get(
'[id="blocksSection"] > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Blocks");
});
});
});

describe("Transactions", () => {
before(() => {
cy.visit("/txs").wait(1000);
});

describe("Should be able to render Transactions page", () => {
it("Validate title", () => {
cy.get(
'[id="transactionsSection"] > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Transactions");
});
});
});

describe("Proposals", () => {
before(() => {
cy.visit("/proposals").wait(1000);
});

describe("Should be able to render Transactions page", () => {
it("Validate title", () => {
cy.get(
'[id="proposalsSection"] > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Proposals");
});
});
});

describe("Data Sources", () => {
before(() => {
cy.visit("/data-sources").wait(1000);
});

describe("Should be able to render Data Sources page", () => {
it("Validate title", () => {
cy.get(
'[id="datasourcesSection"] > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Data Sources");
});
});
});

describe("Oracle Scripts", () => {
before(() => {
cy.visit("/oracle-scripts").wait(1000);
});

describe("Should be able to render Oracle Scripts page", () => {
it("Validate title", () => {
cy.get(
'[id="oraclescriptsSection"] > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Oracle Scripts");
});
});
});

describe("Requests", () => {
before(() => {
cy.visit("/requests").wait(1000);
});

describe("Should be able to render Requests page", () => {
it("Validate title", () => {
cy.get(
'[id="requestsSection"] > div:nth-of-type(1) > div:nth-of-type(1) > *:nth-child(1)'
).should("contain", "All Requests");
});
});
});
});
1 change: 1 addition & 0 deletions scan/src/components/ChainInfoHighlights.re
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module HighlightCard = {
| _ => React.null
}}
<div
id={"highlight-" ++ label}
className={Css.merge([
Styles.innerCard,
CssHelper.flexBox(~direction=`column, ~justify=`spaceBetween, ~align=`flexStart, ()),
Expand Down
4 changes: 3 additions & 1 deletion scan/src/components/LatestBlocks.re
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ let renderDesktop = (~blocksSub) => {
[@react.component]
let make = (~blocksSub) => {
<>
<div className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}>
<div
className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}
id="latestBlocksSectionHeader">
<div>
<Text
value="Latest Blocks"
Expand Down
4 changes: 3 additions & 1 deletion scan/src/components/LatestRequests.re
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ let make = () => {
let requestsSub = RequestSub.getList(~page=1, ~pageSize=requestCount, ());

<>
<div className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}>
<div
className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}
id="latestRequestsSectionHeader">
<div>
<Text
value="Latest Requests"
Expand Down
4 changes: 3 additions & 1 deletion scan/src/components/LatestTxTable.re
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ let make = () => {
let txsSub = TxSub.getList(~page=1, ~pageSize=txCount, ());

<>
<div className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}>
<div
className={CssHelper.flexBox(~justify=`spaceBetween, ~align=`flexEnd, ())}
id="latestTransactionsSectionHeader">
<div>
<Text
value="Latest Transactions"
Expand Down
1 change: 1 addition & 0 deletions scan/src/components/TotalRequestsGraph.re
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ let make = () => {

<div className=Styles.card>
<div
id="totalRequestsGraphSection"
className={Css.merge([
CssHelper.flexBox(),
Styles.infoHeader,
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/BlockHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ let make = () => {
let isMobile = Media.isMobile();

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="blocksSection">
<div className=CssHelper.mobileSpacing>
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid col=Col.Twelve>
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/DataSourceHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let make = () => {
);

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="datasourcesSection">
<div className=CssHelper.mobileSpacing>
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid col=Col.Twelve>
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/OracleScriptHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ let make = () => {
let allSub = Sub.all2(oracleScriptsSub, oracleScriptsCountSub);

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="oraclescriptsSection">
<div className=CssHelper.mobileSpacing>
<Heading value="All Oracle Scripts" size=Heading.H2 marginBottom=40 marginBottomSm=24 />
<Heading value="Most Requested" size=Heading.H4 marginBottom=16 />
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/ProposalHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let make = () => {
let allSub = Sub.all3(proposalsSub, bondedTokenCountSub, voteStatSub);

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="proposalsSection">
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid col=Col.Twelve> <Heading value="All Proposals" size=Heading.H2 /> </Col.Grid>
</Row.Grid>
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/RequestHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ let make = () => {
let allSub = Sub.all2(requestsSub, totalRequestCountSub);

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="requestsSection">
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid col=Col.Twelve>
<Heading value="All Requests" size=Heading.H2 marginBottom=40 marginBottomSm=24 />
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/TxHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let make = () => {
let isMobile = Media.isMobile();

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="transactionsSection">
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid col=Col.Twelve>
<Heading value="All Transactions" size=Heading.H2 marginBottom=40 marginBottomSm=24 />
Expand Down
2 changes: 1 addition & 1 deletion scan/src/pages/ValidatorHomePage.re
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let make = () => {
let isMobile = Media.isMobile();

<Section>
<div className=CssHelper.container>
<div className=CssHelper.container id="validatorsSection">
<Row.Grid alignItems=Row.Center marginBottom=40 marginBottomSm=24>
<Col.Grid>
<Heading value="All Validators" size=Heading.H2 marginBottom=40 marginBottomSm=24 />
Expand Down