Skip to content
Snippets Groups Projects
Unverified Commit b64e2b2a authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

#14294 Repro: Native questions don't respect Start of the week [ci skip] (#14330)

* Run each test in isolation

* Add repro for #14294
parent 6c52efb9
Branches
Tags
No related merge requests found
......@@ -4,8 +4,8 @@ import { SAMPLE_DATASET } from "__support__/cypress_sample_dataset";
const { ORDERS, ORDERS_ID } = SAMPLE_DATASET;
describe("scenarios > admin > permissions", () => {
before(restore);
beforeEach(() => {
restore();
signInAsAdmin();
setFirstWeekDayTo("monday");
});
......@@ -81,6 +81,53 @@ describe("scenarios > admin > permissions", () => {
cy.get(".axis.x").contains(/monday/i);
cy.get(".axis.x").contains(/tuesday/i);
});
// HANDLE WITH CARE!
// This test is extremely tricky and fragile because it needs to test for the "past X weeks" to check if week starts on Sunday or Monday.
// As the time goes by we're risking that past X weeks don't yield any result when applied to the sample dataset.
// For that reason I've chosen the past 220 weeks (mid-October 2016). This should give us 3+ years to run this test without updates.
// TODO:
// - Keep an eye on this test in CI and update the week range as needed.
it.skip("should respect start of the week in SQL questions with filters (metabase#14294)", () => {
cy.request("POST", "/api/card", {
name: "14294",
dataset_query: {
database: 1,
native: {
"template-tags": {
date_range: {
id: "93961154-c3d5-7c93-7b59-f4e494fda499",
name: "date_range",
"display-name": "Date range",
type: "dimension",
dimension: ["field-id", ORDERS.CREATED_AT],
"widget-type": "date/all-options",
default: "past220weeks",
required: true,
},
},
query:
"select ID, CREATED_AT, dayname(CREATED_AT) as CREATED_AT_DAY\nfrom ORDERS \n[[where {{date_range}}]]\norder by CREATED_AT",
},
type: "native",
},
display: "table",
visualization_settings: {},
}).then(({ body: { id: QUESTION_ID } }) => {
cy.visit(`/question/${QUESTION_ID}`);
cy.get(".TableInteractive-header")
.next()
.as("resultTable");
cy.get("@resultTable").within(() => {
// The third cell in the first row (CREATED_AT_DAY)
cy.get(".cellData")
.eq(2)
.should("not.contain", "Sunday");
});
});
});
});
function setFirstWeekDayTo(day) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment