The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Deflake dependency broken list spec (#78600)
github-automation-metabase3eabd5847fd9
diff --git a/e2e/support/helpers/e2e-dependency-helpers.ts b/e2e/support/helpers/e2e-dependency-helpers.tsindex 8cd21457cb7..ffe8e7beb60 100644--- a/e2e/support/helpers/e2e-dependency-helpers.ts+++ b/e2e/support/helpers/e2e-dependency-helpers.ts@@ -16,8 +16,14 @@ export const DependencyGraph = {};export const DependencyDiagnostics = {- visitBrokenDependencies: () =>- cy.visit("/monitor/dependency-diagnostics/broken"),+ visitBrokenDependencies: () => {+ cy.intercept("GET", "/api/ee/dependencies/graph/breaking*").as(+ "breakingEntities",+ );+ cy.visit("/monitor/dependency-diagnostics/broken");+ cy.wait("@breakingEntities");+ DependencyDiagnostics.list().should("be.visible");+ },visitUnreferencedEntities: () => {cy.intercept("GET", "/api/ee/dependencies/graph/unreferenced*").as("unreferencedEntities",@@ -123,7 +129,7 @@ export function waitForBreakingDependencies(return cy.request<ListBreakingGraphNodesResponse>("GET",- "/api/ee/dependencies/graph/breaking",+ "/api/ee/dependencies/graph/breaking?include-personal-collections=true",).then((response) => {if (filter(response.body.data)) {diff --git a/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts b/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.tsindex a7f568e74df..e0b68edfb66 100644--- a/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts+++ b/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts@@ -1,6 +1,6 @@import { WRITABLE_DB_ID } from "e2e/support/cypress_data";import { ADMIN_PERSONAL_COLLECTION_ID } from "e2e/support/cypress_sample_instance_data";-import type { TransformId } from "metabase-types/api";+import type { DependencyNode, TransformId } from "metabase-types/api";const { H } = cy;@@ -505,11 +505,24 @@ function createModelContent() {}function waitForBreakingDependencies() {- H.waitForBreakingDependencies(- (nodes) => nodes.length >= BROKEN_DEPENDENCIES.length,+ // The instance already has unrelated (Usage Analytics) breaking dependencies,+ // so a bare count check can pass before the test's own entities are analyzed.+ // Wait until every expected entity is present by name instead.+ H.waitForBreakingDependencies((nodes) =>+ BROKEN_DEPENDENCIES.every((name) =>+ nodes.some((node) => getNodeName(node) === name),+ ),);}+function getNodeName(node: DependencyNode): string | undefined {+ const { data } = node;+ if ("display_name" in data && data.display_name) {+ return data.display_name;+ }+ return "name" in data ? data.name : undefined;+}+function checkList({visibleEntities = [],hiddenEntities = [],