Skip to content

Commit

Permalink
#12629 Repro: Human-readable number formatting not working properly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjaglumac committed Jun 1, 2021
1 parent c0679f8 commit 76c2bc2
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions frontend/test/metabase/scenarios/visualizations/scalar.cy.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { restore } from "__support__/e2e/cypress";
import { SAMPLE_DATASET } from "__support__/e2e/cypress_sample_dataset";

const { ORDERS, ORDERS_ID } = SAMPLE_DATASET;

describe("scenarios > visualizations > scalar", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
});

const SCREEN_SIZES = {
mobile: [600, 400],
tablet: [900, 600],
desktop: [1200, 800],
hd: [1920, 1280],
};

Object.entries(SCREEN_SIZES).forEach(([size, viewport]) => {
it(`should render human readable numbers on ${size} screen size (metabase#12629)`, () => {
const [width, height] = viewport;

// Remove this when issue gets fixed for these screen sizes
cy.skipOn(size === "mobile" || size === "hd");

cy.viewport(width, height);
cy.createQuestion({
name: "12629",
query: {
"source-table": ORDERS_ID,
aggregation: [["sum", ["field", ORDERS.TOTAL, null]]],
},
display: "scalar",
}).then(({ body: { id: questionId } }) => {
cy.createDashboard("12629").then(({ body: { id: dashboardId } }) => {
// Add previously created question to the dashboard
cy.request("POST", `/api/dashboard/${dashboardId}/cards`, {
cardId: questionId,
}).then(({ body: { id: dashCardId } }) => {
cy.request("PUT", `/api/dashboard/${dashboardId}/cards`, {
cards: [
{
id: dashCardId,
card_id: questionId,
row: 0,
col: 0,
sizeX: 4,
sizeY: 4,
parameter_mappings: [],
},
],
});
});
cy.visit(`/dashboard/${dashboardId}`);
cy.findByText("1.5M");
});
});
});
});
});

0 comments on commit 76c2bc2

Please sign in to comment.