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

#15563 Repro: Date foreign key references produce duplicates when remapped (#15592)

* Add repro for #15563

* Fix "post-join filters" flake

* Unskip the test (fixed by #15582)

* Use explicit assertion
parent 9990c81f
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ import {
} from "__support__/cypress";
import { SAMPLE_DATASET } from "__support__/cypress_sample_dataset";
const { ORDERS, ORDERS_ID } = SAMPLE_DATASET;
const { ORDERS, ORDERS_ID, REVIEWS } = SAMPLE_DATASET;
describe("scenarios > admin > datamodel > metadata", () => {
beforeEach(() => {
......@@ -103,4 +103,26 @@ describe("scenarios > admin > datamodel > metadata", () => {
cy.findByText(/^3:00 AM$/);
});
});
it("should not display multiple 'Created At' fields when they are remapped to PK/FK (metabase#15563)", () => {
// Remap fields
cy.request("PUT", `/api/field/${ORDERS.CREATED_AT}`, {
semantic_type: "type/PK",
});
cy.request("PUT", `/api/field/${REVIEWS.CREATED_AT}`, {
semantic_type: "type/FK",
fk_target_field_id: ORDERS.CREATED_AT,
});
openReviewsTable({ mode: "notebook" });
cy.findByText("Summarize").click();
cy.findByText("Count of rows").click();
cy.findByText("Pick a column to group by").click();
cy.get(".List-section-header")
.contains("Created At")
.click();
cy.get(".List-section--expanded .List-item-title")
.contains("Created At")
.should("have.length", 1);
});
});
......@@ -177,9 +177,9 @@ describe("scenarios > question > notebook", () => {
it("should allow post-join filters (metabase#12221)", () => {
cy.log("Start a custom question with Orders");
cy.visit("/question/new");
cy.contains("Custom question").click();
cy.contains("Sample Dataset").click();
cy.contains("Orders").click();
cy.findByText("Custom question").click();
cy.findByText("Sample Dataset").click();
cy.findByText("Orders").click();
cy.log("Join to People table using default settings");
cy.icon("join_left_outer ").click();
......@@ -192,9 +192,19 @@ describe("scenarios > question > notebook", () => {
cy.contains("Filter").click();
cy.contains("Email").click();
cy.contains("People – Email");
cy.get('[placeholder="Search by Email"]').type("wolf.");
cy.contains("wolf.dina@yahoo.com").click();
cy.contains("Add filter").click();
cy.findByPlaceholderText("Search by Email")
.type("wo")
.then($el => {
// This test was flaking due to a race condition with typing.
// We're ensuring that the value entered was correct and are retrying if it wasn't
const value = $el[0].value;
const input = cy.wrap($el);
if (value !== "wo") {
input.clear().type("wo");
}
});
cy.findByText("wolf.dina@yahoo.com").click();
cy.findByRole("button", { name: "Add filter" }).click();
cy.contains("Showing 1 row");
});
......
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