diff --git a/cypress/e2e/analytics/block-spotlight.cy.js b/cypress/e2e/analytics/block-spotlight.cy.js new file mode 100644 index 000000000..6bee4b8c9 --- /dev/null +++ b/cypress/e2e/analytics/block-spotlight.cy.js @@ -0,0 +1,13 @@ +import { WHISPERIT_BLOCK_STATE_HASH } from "../constants"; + +suite(["@tier2"], "Block spotlight stats", () => { + it("are rendered", () => { + cy.visit(`/blocks/${WHISPERIT_BLOCK_STATE_HASH}/analytics`); + cy.assertAnalyticsSimplValueEquals("Total User Amounts Transferred", 215.5); + cy.assertAnalyticsSimplValueEquals( + "Total Internal Fees Transferred", + 0.012, + ); + cy.assertAnalyticsSimplValueEquals("Total SNARK Fees", "0.0"); + }); +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 1f716028e..875b2897a 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -25,6 +25,15 @@ import { parseFormattedNumber } from "../e2e/helpers"; +Cypress.Commands.add("assertAnalyticsSimplValueEquals", (label, value) => { + cy.get("span") + .contains(label) + .parent() + .parent() + .siblings() + .should("have.text", value); +}); + Cypress.Commands.add( "assertSortOrder", ( diff --git a/src/blocks/components.rs b/src/blocks/components.rs index 676fa7cd4..74d525a60 100644 --- a/src/blocks/components.rs +++ b/src/blocks/components.rs @@ -222,22 +222,35 @@ pub fn BlockAnalytics(block: BlocksQueryBlocks) -> impl IntoView { diff --git a/src/common/functions.rs b/src/common/functions.rs index b7df33ad0..60e19aab5 100644 --- a/src/common/functions.rs +++ b/src/common/functions.rs @@ -28,7 +28,7 @@ pub fn get_browser_locale() -> String { LANGUAGE.with(String::clone) } -fn format_number_helper(number: &str, max_significant_digits: Option) -> String { +pub fn format_number_helper(number: &str, max_significant_digits: Option) -> String { let locale_array = Array::new(); locale_array.push(&JsValue::from_str(&get_browser_locale()));