-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
c0679f8
commit 76c2bc2
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
frontend/test/metabase/scenarios/visualizations/scalar.cy.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |