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

fix e2e tests #3508

Merged
merged 1 commit into from
May 21, 2021
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
3 changes: 2 additions & 1 deletion airbyte-e2e-testing/cypress/integration/source.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ describe("Source main actions", () => {
cy.url().should("include", `${Cypress.config().baseUrl}/source/`);
});

it("Update source", () => {
//TODO: add update source on some other connector or create 1 more user for pg
it.skip("Update source", () => {
cy.createTestSource("Test source cypress for update");
cy.updateSource("Test source cypress for update", "connectionConfiguration.start_date", "2020-11-11");

Expand Down
13 changes: 0 additions & 13 deletions airbyte-e2e-testing/cypress/support/commands/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ Cypress.Commands.add("fillEmail", (email) => {
cy.get("input[name=email]").type(email);
})

Cypress.Commands.add("fillTestExchangeForm", (name) => {
cy.intercept("/source_definition_specifications/get").as("getSourceSpecifications");

cy.get("input[name=name]").type(name);
cy.get("div[role=combobox]").click();
cy.get("div").contains("Exchange Rates Api").click();

cy.wait("@getSourceSpecifications");

cy.get("input[name='connectionConfiguration.base']").type("USD");
cy.get("input[name='connectionConfiguration.start_date']").type("2020-12-12");
})

Cypress.Commands.add("fillTestLocalJsonForm", (name) => {
cy.intercept("/destination_definition_specifications/get").as("getDestinationSpecifications");

Expand Down
36 changes: 30 additions & 6 deletions airbyte-e2e-testing/cypress/support/commands/source.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
Cypress.Commands.add("fillPgSourceForm", (name) => {
cy.intercept("/source_definition_specifications/get").as(
"getSourceSpecifications"
);

cy.get("input[name=name]").type(name);
cy.get("div[role=combobox]").click();
cy.get("div").contains("Postgres").click();

cy.wait("@getSourceSpecifications");

cy.get("input[name='connectionConfiguration.host']").type("localhost");
cy.get("input[name='connectionConfiguration.port']").type("{selectAll}{del}5433");
cy.get("input[name='connectionConfiguration.database']").type("airbyte_ci");
cy.get("input[name='connectionConfiguration.username']").type("postgres");
cy.get("input[name='connectionConfiguration.password']").type(
"secret_password"
);
});

Cypress.Commands.add("createTestSource", (name) => {
cy.intercept("/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/scheduler/sources/check_connection").as(
"checkSourceUpdateConnection"
);
cy.intercept("/sources/create").as("createSource");

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

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

Cypress.Commands.add("updateSource", (name, field, value) => {
cy.intercept("/sources/check_connection_for_update").as("checkSourceConnection");
cy.intercept("/sources/check_connection_for_update").as(
"checkSourceConnection"
);
cy.intercept("/sources/update").as("updateSource");

cy.openSourcePage();
Expand All @@ -21,10 +45,10 @@ Cypress.Commands.add("updateSource", (name, field, value) => {

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

Cypress.Commands.add("deleteSource", (name) => {
cy.openSourcePage();
cy.openSettingForm(name);
cy.deleteEntity();
})
});
4 changes: 3 additions & 1 deletion tools/bin/e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ mkdir -p /tmp/airbyte_local

# Detach so we can run subsequent commands
VERSION=dev TRACKING_STRATEGY=logging docker-compose up -d
trap "echo 'docker-compose logs:' && docker-compose logs -t --tail 150 && docker-compose down" EXIT
trap 'echo "docker-compose logs:" && docker-compose logs -t --tail 150 && docker-compose down && docker rm -f $(docker ps -q --filter name=airbyte_ci_pg)' EXIT

docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=secret_password -e POSTGRES_DB=airbyte_ci --name airbyte_ci_pg postgres
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure what is a preferred approach for such cases. On the one hand, we could extend docker-compose config ( add separate docker-compose config for ci ) and start pg as part of this container, but on the other hand, the connector is not part of docker-compose config and it may be better to leave config as is - with services that are required to run airbyte only.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this approach is okay for now. we should maybe just replace this with a test source / destination. doing this set up here seems like it's just a liability and distracts from what you want to test.

don't you need to stop this container when you're done those?

Copy link
Contributor Author

@jamakase jamakase May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we stop it on line 19 above.

Yeah, I also thought that it could be useful to have test source and destination for such cases, but I was not sure it is a better way to build one, that won't be accessible by default for other users.

echo "Waiting for services to begin"
sleep 30 # TODO need a better way to wait

echo "Running e2e tests via gradle"
./gradlew --no-daemon :airbyte-e2e-testing:e2etest