Skip to content
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

Exclude webapp from spotless styling #16455

Merged
merged 5 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions airbyte-webapp-e2e-tests/.prettierrc.js
16 changes: 9 additions & 7 deletions airbyte-webapp-e2e-tests/cypress/commands/common.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
export const submitButtonClick = () => {
cy.get("button[type=submit]").click();
}
};

export const updateField = (field: string, value: string) => {
cy.get("input[name='" + field + "']").clear().type(value);
}
cy.get("input[name='" + field + "']")
.clear()
.type(value);
};

export const openSettingForm = (name: string) => {
cy.get("div").contains(name).click();
cy.get("div[data-id='settings-step']").click();
}
};

export const deleteEntity = () => {
cy.get("button[data-id='open-delete-modal']").click();
cy.get("button[data-id='delete']").click();
}
};

export const clearApp = () => {
indexedDB.deleteDatabase("firebaseLocalStorageDb");
cy.clearLocalStorage();
cy.clearCookies();
}
};

export const fillEmail = (email: string) => {
cy.get("input[name=email]").type(email);
}
};
10 changes: 5 additions & 5 deletions airbyte-webapp-e2e-tests/cypress/commands/connection.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { submitButtonClick } from "./common";
import { createLocalJsonDestination } from "./destination";
import { createPokeApiSource, createPostgresSource } from "./source";
import { openAddSource } from "pages/destinationPage"
import { selectSchedule, setupDestinationNamespaceSourceFormat, enterConnectionName } from "pages/replicationPage"
import { openAddSource } from "pages/destinationPage";
import { selectSchedule, setupDestinationNamespaceSourceFormat, enterConnectionName } from "pages/replicationPage";

export const createTestConnection = (sourceName: string, destinationName: string) => {
cy.intercept("/api/v1/sources/discover_schema").as("discoverSchema");
cy.intercept("/api/v1/web_backend/connections/create").as("createConnection");

switch (true) {
case sourceName.includes('PokeAPI'):
createPokeApiSource(sourceName, "luxray")
case sourceName.includes("PokeAPI"):
createPokeApiSource(sourceName, "luxray");
break;
case sourceName.includes('Postgres'):
case sourceName.includes("Postgres"):
createPostgresSource(sourceName);
break;
default:
Expand Down
47 changes: 30 additions & 17 deletions airbyte-webapp-e2e-tests/cypress/commands/connector.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import { enterDestinationPath, selectServiceType, enterName, enterHost, enterPort, enterDatabase, enterUsername, enterPassword, enterPokemonName } from "pages/createConnectorPage"
import {
enterDestinationPath,
selectServiceType,
enterName,
enterHost,
enterPort,
enterDatabase,
enterUsername,
enterPassword,
enterPokemonName,
} from "pages/createConnectorPage";

export const fillPostgresForm = (
name: string,
host: string,
port: string,
database: string,
username: string,
password: string
) => {
cy.intercept("/api/v1/source_definition_specifications/get").as("getSourceSpecifications");

export const fillPostgresForm = (name: string, host: string, port: string, database: string, username: string, password: string) => {
cy.intercept("/api/v1/source_definition_specifications/get").as(
"getSourceSpecifications"
);

selectServiceType("Postgres");

cy.wait("@getSourceSpecifications");

enterName(name);
enterHost(host);
enterPort(port);
Expand All @@ -18,14 +33,12 @@ export const fillPostgresForm = (name: string, host: string, port: string, datab
};

export const fillPokeAPIForm = (name: string, pokeName: string) => {
cy.intercept("/api/v1/source_definition_specifications/get").as(
"getSourceSpecifications"
);

cy.intercept("/api/v1/source_definition_specifications/get").as("getSourceSpecifications");

selectServiceType("PokeAPI");

cy.wait("@getSourceSpecifications");

enterName(name);
enterPokemonName(pokeName);
};
Expand All @@ -34,9 +47,9 @@ export const fillLocalJsonForm = (name: string, destinationPath: string) => {
cy.intercept("/api/v1/destination_definition_specifications/get").as("getDestinationSpecifications");

selectServiceType("Local JSON");

cy.wait("@getDestinationSpecifications");

enterName(name);
enterDestinationPath(destinationPath);
}
};
10 changes: 5 additions & 5 deletions airbyte-webapp-e2e-tests/cypress/commands/destination.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deleteEntity, openSettingForm, submitButtonClick, updateField } from "./common";
import { fillLocalJsonForm } from "./connector"
import { goToDestinationPage, openNewDestinationForm } from "pages/destinationPage"
import { fillLocalJsonForm } from "./connector";
import { goToDestinationPage, openNewDestinationForm } from "pages/destinationPage";

export const createLocalJsonDestination = (name: string, destinationPath: string) => {
cy.intercept("/api/v1/scheduler/destinations/check_connection").as("checkDestinationConnection");
Expand All @@ -14,7 +14,7 @@ export const createLocalJsonDestination = (name: string, destinationPath: string
cy.wait(3000);
cy.wait("@checkDestinationConnection");
cy.wait("@createDestination");
}
};

export const updateDestination = (name: string, field: string, value: string) => {
cy.intercept("/api/v1/destinations/check_connection_for_update").as("checkDestinationUpdateConnection");
Expand All @@ -27,12 +27,12 @@ export const updateDestination = (name: string, field: string, value: string) =>

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

export const deleteDestination = (name: string) => {
cy.intercept("/api/v1/destinations/delete").as("deleteDestination");
goToDestinationPage();
openSettingForm(name);
deleteEntity();
cy.wait("@deleteDestination");
}
};
20 changes: 7 additions & 13 deletions airbyte-webapp-e2e-tests/cypress/commands/source.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deleteEntity, openSettingForm, submitButtonClick, updateField } from "./common";
import { goToSourcePage, openNewSourceForm} from "pages/sourcePage";
import { fillPostgresForm, fillPokeAPIForm } from "./connector"
import { goToSourcePage, openNewSourceForm } from "pages/sourcePage";
import { fillPostgresForm, fillPokeAPIForm } from "./connector";

export const createPostgresSource = (
name: string,
Expand All @@ -10,9 +10,7 @@ export const createPostgresSource = (
username: string = "postgres",
password: string = "secret_password"
) => {
cy.intercept("/api/v1/scheduler/sources/check_connection").as(
"checkSourceUpdateConnection"
);
cy.intercept("/api/v1/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/api/v1/sources/create").as("createSource");

goToSourcePage();
Expand All @@ -25,9 +23,7 @@ export const createPostgresSource = (
};

export const createPokeApiSource = (name: string, pokeName: string) => {
cy.intercept("/api/v1/scheduler/sources/check_connection").as(
"checkSourceUpdateConnection"
);
cy.intercept("/api/v1/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/api/v1/sources/create").as("createSource");

goToSourcePage();
Expand All @@ -40,9 +36,7 @@ export const createPokeApiSource = (name: string, pokeName: string) => {
};

export const updateSource = (name: string, field: string, value: string) => {
cy.intercept("/api/v1/sources/check_connection_for_update").as(
"checkSourceConnection"
);
cy.intercept("/api/v1/sources/check_connection_for_update").as("checkSourceConnection");
cy.intercept("/api/v1/sources/update").as("updateSource");

goToSourcePage();
Expand All @@ -52,12 +46,12 @@ export const updateSource = (name: string, field: string, value: string) => {

cy.wait("@checkSourceConnection");
cy.wait("@updateSource");
}
};

export const deleteSource = (name: string) => {
cy.intercept("/api/v1/sources/delete").as("deleteSource");
goToSourcePage();
openSettingForm(name);
deleteEntity();
cy.wait("@deleteSource");
}
};
2 changes: 1 addition & 1 deletion airbyte-webapp-e2e-tests/cypress/commands/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const initialSetupCompleted = (completed = true) => {
// Modify the workspaces/list response to mark every workspace as "initialSetupComplete" to ensure we're not showing
// the setup/preference page for any workspace if this method got called.
cy.intercept("POST", "/api/v1/workspaces/get", (req) => {
req.continue(res => {
req.continue((res) => {
res.body.initialSetupComplete = completed;
res.send(res.body);
});
Expand Down
3 changes: 1 addition & 2 deletions airbyte-webapp-e2e-tests/cypress/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare global {
}
declare global {}
8 changes: 2 additions & 6 deletions airbyte-webapp-e2e-tests/cypress/integration/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ describe("Error handling view", () => {

cy.visit("/");

cy.get("div")
.contains("Version mismatch between 0.0.1-ci and 0.0.2-ci.")
.should("exist");
cy.get("div").contains("Version mismatch between 0.0.1-ci and 0.0.2-ci.").should("exist");
});

it("Shows Server Unavailable page", () => {
Expand All @@ -23,8 +21,6 @@ describe("Error handling view", () => {

cy.visit("/");

cy.get("div")
.contains("Cannot reach server. The server may still be starting up.")
.should("exist");
cy.get("div").contains("Cannot reach server. The server may still be starting up.").should("exist");
});
});
61 changes: 35 additions & 26 deletions airbyte-webapp-e2e-tests/cypress/integration/connection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import { createTestConnection } from "commands/connection";
import { deleteDestination } from "commands/destination";
import { deleteSource } from "commands/source";
import { initialSetupCompleted } from "commands/workspaces";
import { confirmStreamConfigurationChangedPopup, selectSchedule, fillOutDestinationPrefix, goToReplicationTab, setupDestinationNamespaceCustomFormat, selectFullAppendSyncMode, checkSuccessResult} from "pages/replicationPage";
import { openSourceDestinationFromGrid, goToSourcePage} from "pages/sourcePage";
import { goToSettingsPage } from "pages/settingsConnectionPage"
import {
confirmStreamConfigurationChangedPopup,
selectSchedule,
fillOutDestinationPrefix,
goToReplicationTab,
setupDestinationNamespaceCustomFormat,
selectFullAppendSyncMode,
checkSuccessResult,
} from "pages/replicationPage";
import { openSourceDestinationFromGrid, goToSourcePage } from "pages/sourcePage";
import { goToSettingsPage } from "pages/settingsConnectionPage";

describe("Connection main actions", () => {
beforeEach(() => {
Expand Down Expand Up @@ -33,13 +41,13 @@ describe("Connection main actions", () => {

goToReplicationTab();

selectSchedule('Every hour');
fillOutDestinationPrefix('auto_test');
selectSchedule("Every hour");
fillOutDestinationPrefix("auto_test");

submitButtonClick();

cy.wait("@updateConnection").then((interception) => {
assert.isNotNull(interception.response?.statusCode, '200');
assert.isNotNull(interception.response?.statusCode, "200");
});

checkSuccessResult();
Expand All @@ -51,52 +59,53 @@ describe("Connection main actions", () => {
it("Update connection (pokeAPI)", () => {
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");

createTestConnection("Test update connection PokeAPI source cypress", "Test update connection Local JSON destination cypress");
createTestConnection(
"Test update connection PokeAPI source cypress",
"Test update connection Local JSON destination cypress"
);

goToSourcePage();
openSourceDestinationFromGrid("Test update connection PokeAPI source cypress");
openSourceDestinationFromGrid("Test update connection Local JSON destination cypress");

goToReplicationTab();

selectSchedule('Every hour');
fillOutDestinationPrefix('auto_test');
setupDestinationNamespaceCustomFormat('_test');
selectSchedule("Every hour");
fillOutDestinationPrefix("auto_test");
setupDestinationNamespaceCustomFormat("_test");
selectFullAppendSyncMode();

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: 'Test update connection PokeAPI source cypress <> Test update connection Local JSON destination cypressConnection name',
prefix: 'auto_test',
namespaceDefinition: 'customformat',
namespaceFormat: '${SOURCE_NAMESPACE}_test',
status: 'active',
assert.isNotNull(interception.response?.statusCode, "200");
expect(interception.request.method).to.eq("POST");
expect(interception.request).property("body").to.contain({
name: "Test update connection PokeAPI source cypress <> Test update connection Local JSON destination cypressConnection name",
prefix: "auto_test",
namespaceDefinition: "customformat",
namespaceFormat: "${SOURCE_NAMESPACE}_test",
status: "active",
});
expect(interception.request.body.scheduleData.basicSchedule).to.contain({
units: 1,
timeUnit: 'hours'
timeUnit: "hours",
});

const streamToUpdate = interception.request.body.syncCatalog.streams[0];

expect(streamToUpdate.config).to.contain({
aliasName: 'pokemon',
destinationSyncMode: 'append',
aliasName: "pokemon",
destinationSyncMode: "append",
selected: true,
});

expect(streamToUpdate.stream).to.contain({
name: "pokemon",
});
expect(streamToUpdate.stream.supportedSyncModes).to.contain(
'full_refresh'
);
})
expect(streamToUpdate.stream.supportedSyncModes).to.contain("full_refresh");
});
checkSuccessResult();

deleteSource("Test update connection PokeAPI source cypress");
Expand All @@ -117,4 +126,4 @@ describe("Connection main actions", () => {
deleteSource("Test delete connection source cypress");
deleteDestination("Test delete connection destination cypress");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ describe("Destination main actions", () => {

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

cy.get("div[data-id='success-result']").should("exist");
cy.get("input[value='/local/my-json']").should("exist");
Expand All @@ -27,4 +31,4 @@ describe("Destination main actions", () => {
cy.visit("/destination");
cy.get("div").contains("Test destination cypress for delete").should("not.exist");
});
});
});
Loading