Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix flaky test in unreferenced entries (#71134)

Romeo Van Snick9db030e42ce9
diff --git a/e2e/test/scenarios/dependencies/dependency-unreferenced-list.cy.spec.ts b/e2e/test/scenarios/dependencies/dependency-unreferenced-list.cy.spec.ts
index 8850a6c2b21..10db442122b 100644
--- a/e2e/test/scenarios/dependencies/dependency-unreferenced-list.cy.spec.ts
+++ b/e2e/test/scenarios/dependencies/dependency-unreferenced-list.cy.spec.ts
@@ -314,6 +314,12 @@ describe("scenarios > dependencies > unreferenced list", () => {
describe("selecting entities", () => {
it("should show the sidebar for supported entities and trigger snowplow event", () => {
setupEntities();
+ H.waitForUnreferencedEntities((entities) =>
+ entities.some(
+ (e) =>
+ e.type === "table" && e.data.display_name === TABLE_DISPLAY_NAME,
+ ),
+ );
H.DependencyDiagnostics.visitUnreferencedEntities();
H.DependencyDiagnostics.list().findByText(TABLE_DISPLAY_NAME).click();
@@ -399,19 +405,30 @@ describe("scenarios > dependencies > unreferenced list", () => {
function setupEntities({
withReferences = false,
}: { withReferences?: boolean } = {}) {
- setupTableContent();
+ setupTableContent({ withReferences });
setupModelContent({ withReferences });
setupSegmentContent({ withReferences });
setupMetricContent({ withReferences });
setupSnippetContent({ withReferences });
}
-function setupTableContent() {
+function setupTableContent({
+ withReferences = false,
+}: {
+ withReferences?: boolean;
+}) {
H.getTableId({ name: TABLE_NAME }).then((tableId) => {
cy.request("PUT", `/api/table/${tableId}`, {
display_name: TABLE_DISPLAY_NAME,
description: TABLE_DESCRIPTION,
owner_user_id: ADMIN_USER_ID,
+ }).then(() => {
+ if (withReferences) {
+ createQuestionWithTableDataSource({
+ name: `${TABLE_DISPLAY_NAME} -> Question`,
+ tableId,
+ });
+ }
});
});
}
@@ -674,6 +691,22 @@ function createQuestionWithModelDataSource({
});
}
+function createQuestionWithTableDataSource({
+ name,
+ tableId,
+}: {
+ name: string;
+ tableId: TableId;
+}) {
+ return H.createQuestion({
+ name,
+ type: "question",
+ query: {
+ "source-table": tableId,
+ },
+ });
+}
+
function createQuestionWithSegmentClause({
name,
tableId,