Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamakase committed Feb 26, 2021
1 parent 202f78e commit 035c53f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 44 deletions.
48 changes: 14 additions & 34 deletions airbyte-e2e-testing/cypress/integration/connection.spec.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
describe("Connection main actions", () => {
beforeEach(() => {
cy.visit("/");
});

it("Create new connection", () => {
cy.intercept("/api/v1/sources/check_connection").as("checkConnectionSource");
cy.intercept("/api/v1/destinations/check_connection").as("checkConnectionDestination");

cy.intercept("/api/v1/sources/discover_schema").as("discoverSchema");
cy.intercept("/api/v1/connections/create").as("createConnection");

cy.createTestSource("Test source cypress");
cy.createTestDestination("Test destination cypress");
cy.wait(3000);

cy.get("div[role=combobox]").click();
cy.get("div").contains("Test source cypress").click();
cy.wait("@checkConnectionSource");
cy.wait("@checkConnectionDestination");


cy.wait("@discoverSchema");
cy.createTestConnection("Test connection source cypress", "Test destination cypress");

cy.get("div[role=combobox]").last().click();
cy.get("div[data-id='manual']").click();
cy.submit();

cy.wait("@createConnection");

cy.get("div").contains("Test source cypress").should("exist");
cy.get("div").contains("Test connection source cypress").should("exist");
cy.get("div").contains("Test destination cypress").should("exist");
});

it("Update connection", () => {
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");

cy.get("div").contains("Test source cypress").click();
cy.get("div").contains("Test destination cypress").click();
cy.createTestConnection("Test update connection source cypress", "Test update connection destination cypress");

cy.visit("/");
cy.get("div").contains("Test update connection source cypress").click();
cy.get("div").contains("Test update connection destination cypress").click();

cy.get("div[data-id='settings-step']").click();

Expand All @@ -51,14 +28,17 @@ describe("Connection main actions", () => {
});

it("Delete connection", () => {
cy.get("div").contains("Test source cypress").click();
cy.get("div").contains("Test destination cypress").click();
cy.createTestConnection("Test delete connection source cypress", "Test delete connection destination cypress");

cy.visit("/");
cy.get("div").contains("Test delete connection source cypress").click();
cy.get("div").contains("Test delete connection destination cypress").click();

cy.get("div[data-id='settings-step']").click();

cy.deleteEntity();

cy.deleteSource("Test source cypress");
cy.deleteDestination("Test destination cypress");
cy.deleteSource("Test delete connection source cypress");
cy.deleteDestination("Test delete connection destination cypress");
});
});
8 changes: 5 additions & 3 deletions airbyte-e2e-testing/cypress/integration/destination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ describe("Destination main actions", () => {
});

it("Update destination", () => {
cy.updateDestination("Test destination cypress", "connectionConfiguration.destination_path", "/local/my-json");
cy.createTestDestination("Test destination cypress for update");
cy.updateDestination("Test destination cypress for update", "connectionConfiguration.destination_path", "/local/my-json");

cy.get("span[data-id='success-result']").should("exist");
cy.get("input[value='/local/my-json']").should("exist");
});

it("Delete destination", () => {
cy.deleteDestination("Test destination cypress");
cy.createTestDestination("Test destination cypress for delete");
cy.deleteDestination("Test destination cypress for delete");

cy.visit("/destination");
cy.get("div").contains("Test destination cypress").should("not.exist");
cy.get("div").contains("Test destination cypress for delete").should("not.exist");
});
});
8 changes: 5 additions & 3 deletions airbyte-e2e-testing/cypress/integration/source.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ describe("Source main actions", () => {
});

it("Update source", () => {
cy.updateSource("Test source cypress", "connectionConfiguration.start_date", "2020-11-11");
cy.createTestSource("Test source cypress for update");
cy.updateSource("Test source cypress for update", "connectionConfiguration.start_date", "2020-11-11");

cy.get("span[data-id='success-result']").should("exist");
cy.get("input[value='2020-11-11']").should("exist");
});

it("Delete source", () => {
cy.deleteSource("Test source cypress");
cy.createTestSource("Test source cypress for delete");
cy.deleteSource("Test source cypress for delete");

cy.visit("/");
cy.get("div").contains("Test source cypress").should("not.exist");
cy.get("div").contains("Test source cypress for delete").should("not.exist");
});
});
24 changes: 24 additions & 0 deletions airbyte-e2e-testing/cypress/support/commands/connection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Cypress.Commands.add("createTestConnection", (sourceName, destinationName) => {
cy.intercept("/api/v1/sources/check_connection").as("checkConnectionSource");
cy.intercept("/api/v1/destinations/check_connection").as("checkConnectionDestination");

cy.intercept("/api/v1/sources/discover_schema").as("discoverSchema");
cy.intercept("/api/v1/connections/create").as("createConnection");

cy.createTestSource(sourceName);
cy.createTestDestination(destinationName);
cy.wait(3000);

cy.get("div[role=combobox]").click();
cy.get("div").contains(sourceName).click();
cy.wait("@checkConnectionSource");
cy.wait("@checkConnectionDestination");

cy.wait("@discoverSchema");

cy.get("div[role=combobox]").last().click();
cy.get("div[data-id='manual']").click();
cy.submit();

cy.wait("@createConnection");
})
4 changes: 2 additions & 2 deletions airbyte-e2e-testing/cypress/support/commands/destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Cypress.Commands.add("createTestDestination", (name) => {
})

Cypress.Commands.add("updateDestination", (name, field, value) => {
cy.intercept("/destinations/check_connection_for_update").as("checkDestinationConnection");
cy.intercept("/destinations/check_connection_for_update").as("checkDestinationUpdateConnection");
cy.intercept("/destinations/update").as("updateDestination");

cy.openDestinationPage();
cy.openSettingForm(name);
cy.updateField(field, value);
cy.submit();

cy.wait("@checkDestinationConnection");
cy.wait("@checkDestinationUpdateConnection");
cy.wait("@updateDestination");
})

Expand Down
1 change: 1 addition & 0 deletions airbyte-e2e-testing/cypress/support/commands/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./common";
import "./source";
import "./destination";
import "./connection";
4 changes: 2 additions & 2 deletions airbyte-e2e-testing/cypress/support/commands/source.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Cypress.Commands.add("createTestSource", (name) => {
cy.intercept("/scheduler/sources/check_connection").as("checkSourceConnection");
cy.intercept("/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/sources/create").as("createSource");

cy.openNewSourceForm();
cy.fillTestExchangeForm(name);
cy.submit();

cy.wait("@checkSourceConnection");
cy.wait("@checkSourceUpdateConnection");
cy.wait("@createSource");
})

Expand Down

0 comments on commit 035c53f

Please sign in to comment.