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

#18729 Repro: XLSX export of "X of Y" (eg. Month of Year) is formatted as date column (#18792)

parent 8947f42a
No related merge requests found
import {
restore,
downloadAndAssert,
visitQuestionAdhoc,
} from "__support__/e2e/cypress";
import { SAMPLE_DATASET } from "__support__/e2e/cypress_sample_dataset";
const { ORDERS, ORDERS_ID, PRODUCTS } = SAMPLE_DATASET;
const questionDetails = {
dataset_query: {
database: 1,
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
breakout: [
["field", ORDERS.CREATED_AT, { "temporal-unit": "month-of-year" }],
["field", PRODUCTS.CATEGORY, { "source-field": ORDERS.PRODUCT_ID }],
],
limit: 2,
},
type: "query",
},
display: "line",
};
describe("issue 18729", () => {
beforeEach(() => {
cy.intercept("POST", "/api/dataset").as("dataset");
restore();
cy.signInAsAdmin();
});
["csv", "xlsx"].forEach(fileType => {
it(`should properly format the 'X of Y'dates in ${fileType} exports (metabase#18729)`, () => {
// TODO: Remove this line once the issue gets resolved
cy.skipOn(fileType === "xlsx");
visitQuestionAdhoc(questionDetails);
cy.wait("@dataset");
downloadAndAssert({ fileType }, assertion);
});
});
});
function assertion(sheet) {
// It currently says only "Created At", but that is already covered in an issue #18219.
// TODO: When 18219 gets fixed, uncomment the following assertion and delete the `contain` one.
// expect(sheet["A1"].v).to.eq("Created At: Month of year");
expect(sheet["A1"].v).to.contain("Created At");
// Based on how this issue gets resolved, the following assertions might need to change!
expect(sheet["A2"].v).to.eq(1);
expect(sheet["A2"].t).to.eq("n");
// Parsed values are always in the form of a string
expect(sheet["A2"].w).to.eq("1");
}
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