diff --git a/airbyte-webapp-e2e-tests/cypress/integration/autoDetectSchema.spec.ts b/airbyte-webapp-e2e-tests/cypress/integration/autoDetectSchema.spec.ts index 3492b5204f76..50db383734a0 100644 --- a/airbyte-webapp-e2e-tests/cypress/integration/autoDetectSchema.spec.ts +++ b/airbyte-webapp-e2e-tests/cypress/integration/autoDetectSchema.spec.ts @@ -18,12 +18,7 @@ import { runDbQuery } from "commands/db/db"; import { alterTable, createUsersTableQuery, dropUsersTableQuery } from "commands/db/queries"; import { initialSetupCompleted } from "commands/workspaces"; import { getSyncEnabledSwitch, visitConnectionPage } from "pages/connectionPage"; -import { - getManualSyncButton, - getNonBreakingChangeIcon, - getSchemaChangeIcon, - visitConnectionsListPage, -} from "pages/connnectionsListPage"; +import { getManualSyncButton, getSchemaChangeIcon, visitConnectionsListPage } from "pages/connnectionsListPage"; import { checkCatalogDiffModal, clickCatalogDiffCloseButton } from "pages/modals/catalogDiffModal"; import { checkSchemaChangesDetected, @@ -32,10 +27,11 @@ import { clickSchemaChangesReviewButton, searchStream, selectCursorField, + selectNonBreakingChangesPreference, selectSyncMode, } from "pages/replicationPage"; -describe("Auto-detect schema changes", () => { +describe("Connection - Auto-detect schema changes", () => { let source: Source; let destination: Destination; let connection: Connection; @@ -154,4 +150,19 @@ describe("Auto-detect schema changes", () => { getSyncEnabledSwitch().should("be.enabled"); }); }); + + describe("non-breaking schema update preference", () => { + it("saves non-breaking schema update preference change", () => { + visitConnectionPage(connection, "replication"); + selectNonBreakingChangesPreference("disable"); + + cy.intercept("/api/v1/web_backend/connections/update").as("updatesNonBreakingPreference"); + + clickSaveReplication({ confirm: false }); + + cy.wait("@updatesNonBreakingPreference").then((interception) => { + assert.equal((interception.response?.body as Connection).nonBreakingChangesPreference, "disable"); + }); + }); + }); }); diff --git a/airbyte-webapp-e2e-tests/cypress/pages/connnectionsListPage.ts b/airbyte-webapp-e2e-tests/cypress/pages/connnectionsListPage.ts index 00a940d84665..1afce8345071 100644 --- a/airbyte-webapp-e2e-tests/cypress/pages/connnectionsListPage.ts +++ b/airbyte-webapp-e2e-tests/cypress/pages/connnectionsListPage.ts @@ -1,6 +1,10 @@ import { Connection } from "commands/api/types"; import { getWorkspaceId } from "commands/api/workspace"; +const statusCell = (connectionId: string) => `[data-testId='statusCell-${connectionId}']`; +const changesStatusIcon = (type: string) => `[data-testId='changesStatusIcon-${type}']`; +const manualSyncButton = "button[data-testId='manual-sync-button']"; + export const visitConnectionsListPage = () => { cy.intercept("**/web_backend/connections/list").as("listConnections"); cy.visit(`/workspaces/${getWorkspaceId()}/connections`); @@ -8,7 +12,7 @@ export const visitConnectionsListPage = () => { }; export const getSchemaChangeIcon = (connection: Connection, type: "breaking" | "non_breaking") => - cy.get(`[data-testId='statusCell-${connection.connectionId}'] [data-testId='changesStatusIcon-${type}']`); + cy.get(`${statusCell(connection.connectionId)} ${changesStatusIcon(type)}`); export const getManualSyncButton = (connection: Connection) => - cy.get(`[data-testId='statusCell-${connection.connectionId}'] button[data-testId='manual-sync-button']`); + cy.get(`${statusCell(connection.connectionId)} ${manualSyncButton}`); diff --git a/airbyte-webapp-e2e-tests/cypress/pages/replicationPage.ts b/airbyte-webapp-e2e-tests/cypress/pages/replicationPage.ts index 7ec8eab23e98..282c97198b8b 100644 --- a/airbyte-webapp-e2e-tests/cypress/pages/replicationPage.ts +++ b/airbyte-webapp-e2e-tests/cypress/pages/replicationPage.ts @@ -28,6 +28,8 @@ const streamNameInput = "input[data-testid='input']"; const schemaChangesDetectedBanner = "[data-testid='schemaChangesDetected']"; const schemaChangesReviewButton = "[data-testid='schemaChangesReviewButton']"; const schemaChangesBackdrop = "[data-testid='schemaChangesBackdrop']"; +const nonBreakingChangesPreference = "[data-testid='nonBreakingChangesPreference']"; +const nonBreakingChangesPreferenceValue = (value: string) => `div[data-testid='nonBreakingChangesPreference-${value}']`; export const goToReplicationTab = () => { cy.get(replicationTab).click(); @@ -122,12 +124,14 @@ export const searchStream = (value: string) => { cy.get(streamNameInput).type(value); }; -export const clickSaveReplication = ({ reset = false } = {}) => { +export const clickSaveReplication = ({ reset = false, confirm = true } = {}) => { cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection"); submitButtonClick(); - confirmStreamConfigurationChangedPopup({ reset }); + if (confirm) { + confirmStreamConfigurationChangedPopup({ reset }); + } cy.wait("@updateConnection").then((interception) => { assert.isNotNull(interception.response?.statusCode, "200"); @@ -168,3 +172,8 @@ export const clickSchemaChangesReviewButton = () => { cy.get(schemaChangesReviewButton).click(); // cy.get(schemaChangesReviewButton).should("be.disabled"); }; + +export const selectNonBreakingChangesPreference = (preference: "ignore" | "disable") => { + cy.get(nonBreakingChangesPreference).click(); + cy.get(nonBreakingChangesPreferenceValue(preference)).click(); +};