-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve E2E testing around the Connection Form #17577
Changes from all commits
3bb7ab6
e0a7985
3f12599
4534871
6f061dd
ec97fbb
ebb8cab
637505e
79c4881
6d1d7e1
aba3a5c
94b6fd4
02af750
36ac367
5afb1eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { | |
} from "pages/replicationPage"; | ||
import { openSourceDestinationFromGrid, goToSourcePage } from "pages/sourcePage"; | ||
import { goToSettingsPage } from "pages/settingsConnectionPage"; | ||
import { update } from "cypress/types/lodash"; | ||
|
||
describe("Connection main actions", () => { | ||
beforeEach(() => { | ||
|
@@ -22,7 +23,7 @@ describe("Connection main actions", () => { | |
|
||
it("Create new connection", () => { | ||
const sourceName = appendRandomString("Test connection source cypress"); | ||
const destName = appendRandomString("Test connection destination cypress") | ||
const destName = appendRandomString("Test connection destination cypress"); | ||
|
||
createTestConnection(sourceName, destName); | ||
|
||
|
@@ -66,12 +67,9 @@ describe("Connection main actions", () => { | |
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection"); | ||
|
||
const sourceName = appendRandomString("Test update connection PokeAPI source cypress"); | ||
const destName = appendRandomString("Test update connection Local JSON destination cypress") | ||
const destName = appendRandomString("Test update connection Local JSON destination cypress"); | ||
|
||
createTestConnection( | ||
sourceName, | ||
destName | ||
); | ||
createTestConnection(sourceName, destName); | ||
|
||
goToSourcePage(); | ||
openSourceDestinationFromGrid(sourceName); | ||
|
@@ -84,19 +82,27 @@ describe("Connection main actions", () => { | |
setupDestinationNamespaceCustomFormat("_test"); | ||
selectFullAppendSyncMode(); | ||
|
||
const prefix = "auto_test"; | ||
fillOutDestinationPrefix(prefix); | ||
|
||
// Ensures the prefix is applied to the streams | ||
assert(cy.get(`[title*="${prefix}"]`)); | ||
|
||
submitButtonClick(); | ||
confirmStreamConfigurationChangedPopup(); | ||
|
||
cy.wait("@updateConnection").then((interception) => { | ||
assert.isNotNull(interception.response?.statusCode, "200"); | ||
expect(interception.request.method).to.eq("POST"); | ||
expect(interception.request).property("body").to.contain({ | ||
name: sourceName + " <> " + destName + "Connection name", | ||
prefix: "auto_test", | ||
namespaceDefinition: "customformat", | ||
namespaceFormat: "${SOURCE_NAMESPACE}_test", | ||
status: "active", | ||
}); | ||
expect(interception.request) | ||
.property("body") | ||
.to.contain({ | ||
name: sourceName + " <> " + destName + "Connection name", | ||
prefix: "auto_test", | ||
namespaceDefinition: "customformat", | ||
namespaceFormat: "${SOURCE_NAMESPACE}_test", | ||
status: "active", | ||
}); | ||
expect(interception.request.body.scheduleData.basicSchedule).to.contain({ | ||
units: 1, | ||
timeUnit: "hours", | ||
|
@@ -121,6 +127,80 @@ describe("Connection main actions", () => { | |
deleteDestination(destName); | ||
}); | ||
|
||
it("creates a connection, then edits the schedule type", () => { | ||
const sourceName = appendRandomString("Test connection source cypress PokeAPI"); | ||
const destName = appendRandomString("Test connection destination cypress"); | ||
|
||
createTestConnection(sourceName, destName); | ||
|
||
cy.get("div").contains(sourceName).should("exist"); | ||
cy.get("div").contains(destName).should("exist"); | ||
|
||
openSourceDestinationFromGrid(sourceName); | ||
|
||
goToReplicationTab(); | ||
|
||
selectSchedule("Cron"); | ||
submitButtonClick(); | ||
checkSuccessResult(); | ||
|
||
selectSchedule("Manual"); | ||
submitButtonClick(); | ||
checkSuccessResult(); | ||
|
||
selectSchedule("Every hour"); | ||
submitButtonClick(); | ||
checkSuccessResult(); | ||
|
||
deleteSource(sourceName); | ||
deleteDestination(destName); | ||
}); | ||
|
||
it("Saving a connection's schedule type only changes expected values", () => { | ||
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection"); | ||
cy.intercept("/api/v1/web_backend/connections/get").as("getConnection"); | ||
|
||
const sourceName = appendRandomString("Test update connection PokeAPI source cypress"); | ||
const destName = appendRandomString("Test update connection Local JSON destination cypress"); | ||
|
||
createTestConnection(sourceName, destName); | ||
|
||
goToSourcePage(); | ||
openSourceDestinationFromGrid(sourceName); | ||
openSourceDestinationFromGrid(`${sourceName} <> ${destName}`); | ||
|
||
let loadedConnection: any = null; // Should be a WebBackendConnectionRead | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, do we have any plans to pull in types from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what it would entail to do so. It might be trivial but no, I don't think we have a plan to do so. I wouldn't mind though. |
||
cy.wait("@getConnection").then((interception) => { | ||
const { scheduleType: readScheduleType, scheduleData: readScheduleData, ...connectionRead } = interception.response?.body; | ||
loadedConnection = connectionRead; | ||
|
||
expect(loadedConnection).not.to.eq(null); | ||
expect(readScheduleType).to.eq("manual"); | ||
expect(readScheduleData).to.eq(undefined); | ||
}); | ||
|
||
goToReplicationTab(); | ||
|
||
selectSchedule("Every hour"); | ||
submitButtonClick(); | ||
|
||
cy.wait("@updateConnection").then((interception) => { | ||
// Schedule is pulled out here, but we don't do anything with is as it's legacy | ||
const { scheduleType, scheduleData, schedule, ...connectionUpdate } = interception.response?.body; | ||
expect(scheduleType).to.eq("basic"); | ||
expect(scheduleData.basicSchedule).to.deep.eq({ | ||
timeUnit: "hours", | ||
units: 1, | ||
}); | ||
|
||
expect(loadedConnection).to.deep.eq(connectionUpdate); | ||
}); | ||
checkSuccessResult(); | ||
|
||
deleteSource(sourceName); | ||
deleteDestination(destName); | ||
}); | ||
|
||
it("Delete connection", () => { | ||
const sourceName = "Test delete connection source cypress"; | ||
const destName = "Test delete connection destination cypress"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was added in response to a specific OC bug 👍