Skip to content
Snippets Groups Projects
Unverified Commit ed67882c authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Update dates in the sample database (#32047)

parent 9ab1c0b6
No related branches found
No related tags found
No related merge requests found
Showing
with 97 additions and 110 deletions
......@@ -19,16 +19,16 @@ describe("scenarios > admin > localization", () => {
it("should correctly apply start of the week to a bar chart (metabase#13516)", () => {
// programatically create and save a question based on Orders table
// filter: created before June 1st, 2016
// filter: created before June 1st, 2022
// summarize: Count by CreatedAt: Week
cy.createQuestion({
name: "Orders created before June 1st 2016",
name: "Orders created before June 1st 2022",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "week" }]],
filter: ["<", ["field", ORDERS.CREATED_AT, null], "2016-06-01"],
filter: ["<", ["field", ORDERS.CREATED_AT, null], "2022-06-01"],
},
display: "line",
});
......@@ -36,12 +36,12 @@ describe("scenarios > admin > localization", () => {
// find and open that question
cy.visit("/collection/root");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Orders created before June 1st 2016").click();
cy.findByText("Orders created before June 1st 2022").click();
cy.log("Assert the dates on the X axis");
// it's hard and tricky to invoke hover in Cypress, especially in our graphs
// that's why we have to assert on the x-axis, instead of a popover that shows on a dot hover
cy.get(".axis.x").contains("April 25, 2016");
cy.get(".axis.x").contains("April 25, 2022");
});
it("should display days on X-axis correctly when grouped by 'Day of the Week' (metabase#13604)", () => {
......@@ -56,8 +56,8 @@ describe("scenarios > admin > localization", () => {
filter: [
"between",
["field", ORDERS.CREATED_AT, null],
"2020-03-02", // Monday
"2020-03-03", // Tuesday
"2026-03-02", // Monday
"2026-03-03", // Tuesday
],
},
display: "bar",
......@@ -83,7 +83,7 @@ describe("scenarios > admin > localization", () => {
// 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 database.
// 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.
// For that reason I've chosen the past 220 weeks (mid-October 2022). 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.
......@@ -210,7 +210,7 @@ describe("scenarios > admin > localization", () => {
const dateString = `${date.getFullYear()}/${
date.getMonth() + 1
}/${date.getDate()}`;
cy.findByDisplayValue(dateString).clear().type("2018/5/15").blur();
cy.findByDisplayValue(dateString).clear().type("2024/5/15").blur();
// add a time to the date
const TIME_SELECTOR_DEFAULT_HOUR = 12;
......@@ -228,7 +228,7 @@ describe("scenarios > admin > localization", () => {
// verify that the correct row is displayed
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("2018/5/15, 19:56");
cy.findByText("2024/5/15, 19:56");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("127.52");
});
......
......@@ -167,7 +167,7 @@ describe("scenarios > admin > settings", () => {
cy.findByTextEnsureVisible("Created At");
cy.get(".cellData")
.should("contain", "Created At")
.and("contain", "2019/2/11, 21:40");
.and("contain", "2025/2/11, 21:40");
// Go back to the settings and reset the time formatting
cy.visit("/admin/settings/localization");
......@@ -180,7 +180,7 @@ describe("scenarios > admin > settings", () => {
openOrdersTable({ limit: 2 });
cy.findByTextEnsureVisible("Created At");
cy.get(".cellData").and("contain", "2019/2/11, 9:40 PM");
cy.get(".cellData").and("contain", "2025/2/11, 9:40 PM");
});
it("should search for and select a new timezone", () => {
......
......@@ -86,7 +86,7 @@ describe("binning related reproductions", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Count by Created At: Year");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("2018");
cy.findByText("2024");
});
it("should not remove order-by (sort) when changing the breakout field on an SQL saved question (metabase#17975)", () => {
......@@ -262,7 +262,7 @@ describe("binning related reproductions", () => {
// ALl of these are implicit assertions and will fail if there's more than one string
cy.findByText("Count");
cy.findByText("Created At: Month");
cy.findByText("June, 2016");
cy.findByText("June, 2022");
});
});
......
export const TIME_OPTIONS = {
Minute: {
selected: "by minute",
representativeValues: ["April 30, 2016, 6:56 PM", "May 10, 2016, 9:38 AM"],
representativeValues: ["April 30, 2022, 6:56 PM", "May 10, 2022, 9:38 AM"],
},
Hour: {
selected: "by hour",
representativeValues: ["April 30, 2016, 6:00 PM", "May 10, 2016, 9:00 AM"],
representativeValues: ["April 30, 2022, 6:00 PM", "May 10, 2022, 9:00 AM"],
},
Day: {
selected: "by day",
representativeValues: ["April 30, 2016", "May 10, 2016"],
representativeValues: ["April 30, 2022", "May 10, 2022"],
},
Week: {
selected: "by week",
representativeValues: [
"April 24, 2016 – April 30, 2016",
"May 8, 2016 – May 14, 2016",
"April 24, 2022 – April 30, 2022",
"May 8, 2022 – May 14, 2022",
],
},
Month: {
selected: "by month",
representativeValues: ["April, 2016", "May, 2016"],
representativeValues: ["April, 2022", "May, 2022"],
},
Quarter: {
selected: "by quarter",
representativeValues: ["Q2 - 2016", "Q1 - 2017", "Q1 - 2018", "Q1 - 2019"],
representativeValues: ["Q2 - 2022", "Q1 - 2023", "Q1 - 2024", "Q1 - 2025"],
},
Year: {
selected: "by year",
representativeValues: ["2016", "2017", "2018", "2019", "2020"],
representativeValues: ["2022", "2023", "2024", "2025", "2026"],
},
"Minute of hour": {
selected: "by minute of hour",
......
......@@ -43,7 +43,7 @@ describe("scenarios > binning > binning options", () => {
cy.get("circle");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Q1 - 2017");
cy.findByText("Q1 - 2023");
});
it("should work for longitude/latitude", () => {
......@@ -92,7 +92,7 @@ describe("scenarios > binning > binning options", () => {
cy.get("circle");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Q1 - 2017");
cy.findByText("Q1 - 2023");
});
it("should work for longitude/latitude", () => {
......@@ -138,7 +138,7 @@ describe("scenarios > binning > binning options", () => {
cy.get("circle");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("January, 2017");
cy.findByText("January, 2023");
});
it("should work for longitude/latitude", () => {
......
......@@ -189,7 +189,7 @@ describe("scenarios > binning > from a saved sql question", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Count by CREATED_AT: Quarter");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Q1 - 2017");
cy.findByText("Q1 - 2023");
});
it("should work for number", () => {
......
......@@ -31,10 +31,10 @@ describe(`smoke test the migration to the version ${version}`, () => {
cy.get(".x-axis-label").invoke("text").should("eq", "Created At");
cy.get(".y-axis-label").invoke("text").should("eq", "Revenue");
cy.get(".x.axis .tick")
.should("contain", "Q1 - 2017")
.and("contain", "Q1 - 2018")
.and("contain", "Q1 - 2019")
.and("contain", "Q1 - 2020");
.should("contain", "Q1 - 2023")
.and("contain", "Q1 - 2024")
.and("contain", "Q1 - 2025")
.and("contain", "Q1 - 2026");
cy.get(".y.axis .tick")
.should("contain", "20,000")
......
......@@ -230,7 +230,7 @@ describe("scenarios > question > custom column", () => {
visualize();
cy.log(
"**Fails in 0.35.0, 0.35.1, 0.35.2, 0.35.4 and the latest master (2020-10-21)**",
"**Fails in 0.35.0, 0.35.1, 0.35.2, 0.35.4 and the latest master (2026-10-21)**",
);
cy.log("Works in 0.35.3");
// ID should be "1" but it is picking the product ID and is showing "14"
......@@ -494,7 +494,7 @@ describe("scenarios > question > custom column", () => {
name: "15316",
query: {
"source-table": ORDERS_ID,
expressions: { "MyCC [2021]": ["+", 1, 1] },
expressions: { "MyCC [2027]": ["+", 1, 1] },
},
}).then(({ body: { id: QUESTION_ID } }) => {
cy.visit(`/question/${QUESTION_ID}/notebook`);
......@@ -502,15 +502,15 @@ describe("scenarios > question > custom column", () => {
summarize({ mode: "notebook" });
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Sum of ...").click();
popover().findByText("MyCC [2021]").click();
popover().findByText("MyCC [2027]").click();
cy.findAllByTestId("notebook-cell-item")
.contains("Sum of MyCC [2021]")
.contains("Sum of MyCC [2027]")
.click();
popover().within(() => {
cy.icon("chevronleft").click();
cy.findByText("Custom Expression").click();
});
cy.get(".ace_line").contains("Sum([MyCC \\[2021\\]]");
cy.get(".ace_line").contains("Sum([MyCC \\[2027\\]]");
});
it.skip("should work with `isNull` function (metabase#15922)", () => {
......@@ -552,8 +552,8 @@ describe("scenarios > question > custom column", () => {
popover().within(() => {
cy.findByText("Filter by this column").click();
cy.findByText("Specific dates...").click();
enterDateFilter("12/10/2018", 0);
enterDateFilter("01/05/2019", 1);
enterDateFilter("12/10/2024", 0);
enterDateFilter("01/05/2025", 1);
cy.button("Add filter").click();
});
......@@ -576,17 +576,13 @@ describe("scenarios > question > custom column", () => {
filter({ mode: "notebook" });
popover().contains("MiscDate").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Relative dates...").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Past").click();
// The popover shows up with the default value selected - previous 30 days.
// Since we don't have any orders in the Sample Database for that period, we have to change it to the previous 30 years.
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("days").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("years").click();
cy.button("Add filter").click();
popover().findByText("Relative dates...").click();
popover().findByText("Past").click();
popover().findByText("days").click();
popover().last().findByText("years").click();
popover().icon("ellipsis").click();
popover().last().findByText("Include this year").click();
popover().button("Add filter").click();
visualize(({ body }) => {
expect(body.error).to.not.exist;
......
......@@ -40,6 +40,6 @@ describe("issue 18814", () => {
visualize();
cy.get(".Visualization").should("contain", "2016");
cy.get(".Visualization").should("contain", "2022");
});
});
......@@ -64,7 +64,7 @@ describe("scenarios > dashboard > filters > date", () => {
DateFilter.setMonthAndYear({
month: "November",
year: "2016",
year: "2022",
});
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
......@@ -80,7 +80,7 @@ describe("scenarios > dashboard > filters > date", () => {
// Make sure we can override the default value
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("November, 2016").click();
cy.findByText("November, 2022").click();
popover().contains("June").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("33.9");
......
......@@ -67,7 +67,7 @@ describe("scenarios > dashboard > filters > SQL > date", () => {
cy.findByText("Default value").next().click();
DateFilter.setMonthAndYear({
month: "October",
year: "2017",
year: "2022",
});
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
......@@ -77,15 +77,15 @@ describe("scenarios > dashboard > filters > SQL > date", () => {
// The default value should immediately be applied
cy.get(".Card").within(() => {
cy.contains("Hudson Borer");
cy.contains("Dagmar Fay");
});
// Make sure we can override the default value
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("October, 2017").click();
cy.findByText("October, 2022").click();
popover().contains("August").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Oda Brakus");
cy.findByText("Macy Olson");
});
});
......
......@@ -8,9 +8,9 @@ import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
const { ORDERS } = SAMPLE_DATABASE;
// After January 1st, 2020
// After January 1st, 2026
const dashboardFilter = {
default: "2020-01-01~",
default: "2026-01-01~",
id: "d3b78b27",
name: "Date Filter",
slug: "date_filter",
......@@ -99,5 +99,5 @@ function clickThrough(title) {
cy.get(".DashCard").contains(title).click();
cy.location("search").should("contain", dashboardFilter.default);
filterWidget().contains("After January 1, 2020");
filterWidget().contains("After January 1, 2026");
}
......@@ -70,11 +70,11 @@ describe.skip("issue 17775", () => {
it("should be able to apply dashboard filter to a custom column (metabase#17775)", () => {
filterWidget().click();
setQuarterAndYear({ quarter: "Q1", year: "2019" });
setQuarterAndYear({ quarter: "Q1", year: "2025" });
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("37.65");
cy.findAllByText("February 11, 2019, 9:40 PM").should("have.length", 2);
cy.findAllByText("February 11, 2025, 9:40 PM").should("have.length", 2);
});
});
......@@ -2,36 +2,32 @@ export const DASHBOARD_DATE_FILTERS = {
"Month and Year": {
value: {
month: "November",
year: "2016",
year: "2022",
},
representativeResult: "85.88",
},
"Quarter and Year": {
value: {
quarter: "Q2",
year: "2016",
year: "2022",
},
representativeResult: "44.43",
},
"Single Date": {
value: "15",
representativeResult: "No results!",
value: "05/23/2022",
representativeResult: "49.54",
},
"Date Range": {
value: {
startDate: "13",
endDate: "15",
startDate: "05/25/2022",
endDate: "06/01/2022",
},
representativeResult: "No results!",
},
"Relative Date": {
value: "Past 7 days",
representativeResult: "No results!",
representativeResult: "75.41",
},
"All Options": {
value: {
timeBucket: "years",
},
representativeResult: "37.65",
representativeResult: "78.17",
},
};
......@@ -6,43 +6,38 @@ export const DASHBOARD_SQL_DATE_FILTERS = {
"Month and Year": {
sqlFilter: "date/month-year",
value: {
month: "October",
year: "2017",
month: "September",
year: "2022",
},
representativeResult: "Hudson Borer",
representativeResult: "Rene Muller",
},
"Quarter and Year": {
sqlFilter: "date/quarter-year",
value: {
quarter: "Q1",
year: "2018",
quarter: "Q2",
year: "2022",
},
representativeResult: "Lolita Schaefer",
representativeResult: "Khalid Pouros",
},
"Single Date": {
sqlFilter: "date/single",
value: "15",
representativeResult: "No results!",
value: "05/24/2022",
representativeResult: "Delphia Price",
},
"Date Range": {
sqlFilter: "date/range",
value: {
startDate: "13",
endDate: "15",
startDate: "05/25/2022",
endDate: "06/01/2022",
},
representativeResult: "No results!",
},
"Relative Date": {
sqlFilter: "date/relative",
value: "Past 7 days",
representativeResult: "No results!",
representativeResult: "Trisha Hoeger",
},
"All Options": {
sqlFilter: "date/all-options",
value: {
timeBucket: "years",
},
representativeResult: "Hudson Borer",
representativeResult: "Araceli Stiedemann",
},
};
......
......@@ -627,11 +627,11 @@ describe("scenarios > dashboard > dashboard drill", () => {
).as("cardQuery");
cy.get(".bar")
.eq(14) // August 2017 (Total of 12 reviews, 9 unique days)
.eq(14) // August 2023 (Total of 12 reviews, 9 unique days)
.click({ force: true });
cy.wait("@cardQuery");
cy.url().should("include", "2017-08");
cy.url().should("include", "2023-08");
cy.get(".bar").should("have.length", 1);
// Since hover doesn't work in Cypress we can't assert on the popover that's shown when one hovers the bar
// But when this issue gets fixed, Y-axis should definitely show "12" (total count of reviews)
......@@ -789,7 +789,7 @@ describe("scenarios > dashboard > dashboard drill", () => {
cy.get(".Table-ID")
.first()
// Mid-point check that this cell actually contains ID = 1
.contains("1")
.contains("3")
.click();
cy.wait("@dataset").then(xhr => {
......
......@@ -173,7 +173,7 @@ describe("scenarios > dashboard > parameters in text cards", () => {
cy.findByText("Single Date").click();
popover().within(() => {
cy.findByRole("textbox").click().clear().type("07/19/2017").blur();
cy.findByRole("textbox").click().clear().type("07/19/2023").blur();
cy.button("Update filter").click();
});
......@@ -182,10 +182,10 @@ describe("scenarios > dashboard > parameters in text cards", () => {
cy.findByText("Small Marble Shoes").should("not.exist");
// Parameter value in widget should use user localization (English)
cy.findByText("July 19, 2017").should("exist");
cy.findByText("July 19, 2023").should("exist");
// Parameter value in dashboard should use site localization (French)
cy.findByText("Variable: juillet 19, 2017").should("exist");
cy.findByText("Variable: juillet 19, 2023").should("exist");
});
});
});
......@@ -87,7 +87,7 @@ describe("scenarios > x-rays", () => {
cy.wait("@dataset", { timeout: 30000 });
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(
"A closer look at number of Orders where Created At is in March 2018 and Category is Gadget",
"A closer look at number of Orders where Created At is in March 2024 and Category is Gadget",
);
cy.icon("warning").should("not.exist");
});
......
......@@ -80,10 +80,10 @@ describe("scenarios > embedding > native questions", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains("Twitter").should("not.exist");
// Created At: Q2, 2018
// Created At: Q2, 2023
filterWidget().contains("Created At").click();
cy.findByTestId("select-button").click();
popover().contains("2018").click();
popover().last().contains("2023").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Q2").click();
......@@ -105,7 +105,7 @@ describe("scenarios > embedding > native questions", () => {
// Let's try to remove one filter
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Q2, 2018")
cy.findByText("Q2, 2023")
.closest("fieldset")
.within(() => {
cy.icon("close").click();
......@@ -119,7 +119,7 @@ describe("scenarios > embedding > native questions", () => {
cy.findByTestId("table-row").should("have.length", 1);
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("December 29, 2018, 4:54 AM");
cy.findByText("December 29, 2024, 4:54 AM");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("CO");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
......@@ -186,13 +186,13 @@ describe("scenarios > embedding > native questions", () => {
};
visitEmbeddedPage(payload, {
setFilters: "created_at=Q2-2019&source=Organic&state=OR",
setFilters: "created_at=Q2-2025&source=Organic&state=OR",
});
filterWidget()
.should("have.length", 4)
.and("contain", "OR")
.and("contain", "Q2, 2019");
.and("contain", "Q2, 2025");
// Why do we use input field in one filter widget but a simple `span` in the other one?
cy.findByDisplayValue("Organic");
......@@ -233,7 +233,7 @@ describe("scenarios > embedding > native questions", () => {
id: [92, 96, 102, 104],
product_id: [140],
state: ["AK", "TX"],
created_at: "Q3-2018",
created_at: "Q3-2024",
total: [10],
source: ["Organic"],
},
......
......@@ -70,7 +70,7 @@ describe("scenarios > embedding > questions ", () => {
cy.findByText("€39.72");
// Question settings: Abbreviated date, day enabled, 24H clock with seconds
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Mon, Feb 11, 2019, 21:40:27");
cy.findByText("Tue, Feb 11, 2025, 21:40:27");
// Question settings: Show mini-bar
cy.findAllByTestId("mini-bar");
......@@ -96,7 +96,7 @@ describe("scenarios > embedding > questions ", () => {
cy.get(".x.axis .tick")
.should("have.length", 5)
.and("contain", "Apr, 2016");
.and("contain", "Apr, 2022");
cy.get(".y.axis .tick").should("contain", "60");
......@@ -104,7 +104,7 @@ describe("scenarios > embedding > questions ", () => {
cy.get(".dot").last().realHover();
popover().within(() => {
testPairedTooltipValues("Created At", "Aug, 2016");
testPairedTooltipValues("Created At", "Aug, 2022");
testPairedTooltipValues("Math", "2");
testPairedTooltipValues("Count", "79");
});
......@@ -145,7 +145,7 @@ describe("scenarios > embedding > questions ", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("39.72");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("February 11, 2019, 9:40 PM");
cy.findByText("February 11, 2025, 9:40 PM");
cy.findAllByTestId("mini-bar").should("not.exist");
......@@ -179,7 +179,7 @@ describe("scenarios > embedding > questions ", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("€39.72");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Mon, Feb 11, 2019, 21:40:27");
cy.findByText("Tue, Feb 11, 2025, 21:40:27");
cy.findAllByTestId("mini-bar");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Subtotal").should("not.exist");
......@@ -194,7 +194,7 @@ describe("scenarios > embedding > questions ", () => {
cy.contains("December 12, 1986");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains("October 7, 2017, 1:34 AM");
cy.contains("October 7, 2023, 1:34 AM");
});
it("should display according to `locale` parameter metabase#22561", () => {
......@@ -219,7 +219,7 @@ describe("scenarios > embedding > questions ", () => {
});
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Februar 11, 2019, 9:40 PM");
cy.findByText("Februar 11, 2025, 9:40 PM");
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment