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

[E2E] Fix segment flake (#34329)

* Fix the flakes for metrics as well
parent 8224e5b6
No related branches found
No related tags found
No related merge requests found
......@@ -323,17 +323,6 @@ describe("scenarios > admin > datamodel > metrics", () => {
});
});
// Ugly hack to prevent failures that started after https://github.com/metabase/metabase/pull/24682 has been merged.
// For unknon reasons, popover doesn't open with expanded list of all Sample Database tables. Rather. it shows
// Sample Database (collapsed) only. We need to click on it to expand it.
// This conditional mechanism prevents failures even if that popover opens expanded in the future.
function selectTable(tableName) {
cy.findByText("Select a table").click();
cy.get(".List-section").then($list => {
if ($list.length !== 5) {
cy.findByText("Sample Database").click();
}
cy.findByText(tableName).click();
});
popover().findByText(tableName).click();
}
......@@ -20,41 +20,25 @@ describe("scenarios > admin > datamodel > segments", () => {
});
describe("with no segments", () => {
it("should show no segments in UI", () => {
it("should have 'Custom expression' in a filter list (metabase#13069)", () => {
cy.visit("/admin/datamodel/segments");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Segments").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(
cy.log("should initially show no segments in UI");
cy.get("main").findByText(
"Create segments to add them to the Filter dropdown in the query builder",
);
});
it("should have 'Custom expression' in a filter list (metabase#13069)", () => {
cy.visit("/admin/datamodel/segments");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("New segment").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Select a table").click();
cy.button("New segment").click();
// Ugly hack to prevent failures that started after https://github.com/metabase/metabase/pull/24682 has been merged.
// For unknon reasons, popover doesn't open with expanded list of all Sample Database tables. Rather. it shows
// Sample Database (collapsed) only. We need to click on it to expand it.
// This conditional mechanism prevents failures even if that popover opens expanded in the future.
cy.get(".List-section").then($list => {
if ($list.length !== 5) {
cy.findByText("Sample Database").click();
}
cy.findByText("Orders").click();
});
cy.get(".GuiBuilder").findByText("Select a table").click();
popover().findByText("Orders").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Add filters to narrow your answer").click();
cy.get(".GuiBuilder")
.findByText("Add filters to narrow your answer")
.click();
cy.log("Fails in v0.36.0 and v0.36.3. It exists in v0.35.4");
popover().within(() => {
cy.findByText("Custom Expression");
});
popover().findByText("Custom Expression");
});
it("should show no segments", () => {
......
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