Skip to content

Commit 4924ed9

Browse files
committed
Add test to verify non-breaking prefrence update
1 parent 7b7e096 commit 4924ed9

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

airbyte-webapp-e2e-tests/cypress/integration/autoDetectSchema.spec.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ import { runDbQuery } from "commands/db/db";
1818
import { alterTable, createUsersTableQuery, dropUsersTableQuery } from "commands/db/queries";
1919
import { initialSetupCompleted } from "commands/workspaces";
2020
import { getSyncEnabledSwitch, visitConnectionPage } from "pages/connectionPage";
21-
import {
22-
getManualSyncButton,
23-
getNonBreakingChangeIcon,
24-
getSchemaChangeIcon,
25-
visitConnectionsListPage,
26-
} from "pages/connnectionsListPage";
21+
import { getManualSyncButton, getSchemaChangeIcon, visitConnectionsListPage } from "pages/connnectionsListPage";
2722
import { checkCatalogDiffModal, clickCatalogDiffCloseButton } from "pages/modals/catalogDiffModal";
2823
import {
2924
checkSchemaChangesDetected,
@@ -32,10 +27,11 @@ import {
3227
clickSchemaChangesReviewButton,
3328
searchStream,
3429
selectCursorField,
30+
selectNonBreakingChangesPreference,
3531
selectSyncMode,
3632
} from "pages/replicationPage";
3733

38-
describe("Auto-detect schema changes", () => {
34+
describe("Connection - Auto-detect schema changes", () => {
3935
let source: Source;
4036
let destination: Destination;
4137
let connection: Connection;
@@ -154,4 +150,19 @@ describe("Auto-detect schema changes", () => {
154150
getSyncEnabledSwitch().should("be.enabled");
155151
});
156152
});
153+
154+
describe("non-breaking schema update preference", () => {
155+
it("saves non-breaking schema update preference change", () => {
156+
visitConnectionPage(connection, "replication");
157+
selectNonBreakingChangesPreference("disable");
158+
159+
cy.intercept("/api/v1/web_backend/connections/update").as("updatesNonBreakingPreference");
160+
161+
clickSaveReplication({ confirm: false });
162+
163+
cy.wait("@updatesNonBreakingPreference").then((interception) => {
164+
assert.equal((interception.response?.body as Connection).nonBreakingChangesPreference, "disable");
165+
});
166+
});
167+
});
157168
});
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { Connection } from "commands/api/types";
22
import { getWorkspaceId } from "commands/api/workspace";
33

4+
const statusCell = (connectionId: string) => `[data-testId='statusCell-${connectionId}']`;
5+
const changesStatusIcon = (type: string) => `[data-testId='changesStatusIcon-${type}']`;
6+
const manualSyncButton = "button[data-testId='manual-sync-button']";
7+
48
export const visitConnectionsListPage = () => {
59
cy.intercept("**/web_backend/connections/list").as("listConnections");
610
cy.visit(`/workspaces/${getWorkspaceId()}/connections`);
711
cy.wait("@listConnections");
812
};
913

1014
export const getSchemaChangeIcon = (connection: Connection, type: "breaking" | "non_breaking") =>
11-
cy.get(`[data-testId='statusCell-${connection.connectionId}'] [data-testId='changesStatusIcon-${type}']`);
15+
cy.get(`${statusCell(connection.connectionId)} ${changesStatusIcon(type)}`);
1216

1317
export const getManualSyncButton = (connection: Connection) =>
14-
cy.get(`[data-testId='statusCell-${connection.connectionId}'] button[data-testId='manual-sync-button']`);
18+
cy.get(`${statusCell(connection.connectionId)} ${manualSyncButton}`);

airbyte-webapp-e2e-tests/cypress/pages/replicationPage.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const streamNameInput = "input[data-testid='input']";
2828
const schemaChangesDetectedBanner = "[data-testid='schemaChangesDetected']";
2929
const schemaChangesReviewButton = "[data-testid='schemaChangesReviewButton']";
3030
const schemaChangesBackdrop = "[data-testid='schemaChangesBackdrop']";
31+
const nonBreakingChangesPreference = "[data-testid='nonBreakingChangesPreference']";
32+
const nonBreakingChangesPreferenceValue = (value: string) => `div[data-testid='nonBreakingChangesPreference-${value}']`;
3133

3234
export const goToReplicationTab = () => {
3335
cy.get(replicationTab).click();
@@ -122,12 +124,14 @@ export const searchStream = (value: string) => {
122124
cy.get(streamNameInput).type(value);
123125
};
124126

125-
export const clickSaveReplication = ({ reset = false } = {}) => {
127+
export const clickSaveReplication = ({ reset = false, confirm = true } = {}) => {
126128
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
127129

128130
submitButtonClick();
129131

130-
confirmStreamConfigurationChangedPopup({ reset });
132+
if (confirm) {
133+
confirmStreamConfigurationChangedPopup({ reset });
134+
}
131135

132136
cy.wait("@updateConnection").then((interception) => {
133137
assert.isNotNull(interception.response?.statusCode, "200");
@@ -168,3 +172,8 @@ export const clickSchemaChangesReviewButton = () => {
168172
cy.get(schemaChangesReviewButton).click();
169173
// cy.get(schemaChangesReviewButton).should("be.disabled");
170174
};
175+
176+
export const selectNonBreakingChangesPreference = (preference: "ignore" | "disable") => {
177+
cy.get(nonBreakingChangesPreference).click();
178+
cy.get(nonBreakingChangesPreferenceValue(preference)).click();
179+
};

0 commit comments

Comments
 (0)