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 MBQL to SQL transform conversion e2e test (#77699)

github-automation-metabase559301b57ba7
diff --git a/e2e/support/helpers/e2e-transform-helpers.ts b/e2e/support/helpers/e2e-transform-helpers.ts
index 21a27362dae..081d6dbce9e 100644
--- a/e2e/support/helpers/e2e-transform-helpers.ts
+++ b/e2e/support/helpers/e2e-transform-helpers.ts
@@ -76,6 +76,7 @@ export function waitForSucceededTransformRuns() {
export function createMbqlTransform({
sourceTable,
+ sourceSchema,
targetTable,
targetSchema,
tagIds,
@@ -85,6 +86,7 @@ export function createMbqlTransform({
collectionId,
}: {
sourceTable: string;
+ sourceSchema?: string | null;
targetTable: string;
targetSchema: string | null;
tagIds?: TransformTagId[];
@@ -93,7 +95,11 @@ export function createMbqlTransform({
visitTransform?: boolean;
collectionId?: CollectionId | null;
}) {
- return getTableId({ databaseId, name: sourceTable }).then((tableId) => {
+ return getTableId({
+ databaseId,
+ name: sourceTable,
+ schema: sourceSchema ?? undefined,
+ }).then((tableId) => {
return createTransform(
{
name,
diff --git a/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts b/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts
index c8cc4b87c43..62c9b93f793 100644
--- a/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts
+++ b/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts
@@ -379,6 +379,10 @@ LIMIT
H.NativeEditor.value().should("eq", EXPECTED_QUERY);
getQueryEditor().button("Save").click();
+ cy.wait("@updateTransform");
+ // Saving returns to read-only view mode; the "Run" tab only exists there,
+ // so wait for the navigation off /edit before clicking it.
+ cy.url().should("not.include", "/edit");
cy.log("run the transform and make sure its table can be queried");
H.DataStudio.Transforms.runTab().click();
@@ -4055,6 +4059,7 @@ function runJobAndWaitForFailure() {
function createMbqlTransform(
opts: {
sourceTable?: string;
+ sourceSchema?: string | null;
targetTable?: string;
targetSchema?: string | null;
tagIds?: TransformTagId[];
@@ -4066,6 +4071,11 @@ function createMbqlTransform(
) {
return H.createMbqlTransform({
sourceTable: SOURCE_TABLE,
+ // "Animals" exists in every schema of the many_schemas fixture, so pin the
+ // source schema to keep the resolved source table (and its compiled SQL)
+ // deterministic. Only for the default table: custom source tables (e.g.
+ // composite_pk_table, mysql ORDERS) don't live in "Schema A".
+ sourceSchema: opts.sourceTable == null ? TARGET_SCHEMA : undefined,
targetTable: TARGET_TABLE,
targetSchema: TARGET_SCHEMA,
name: "MBQL transform",