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

🪟 🚦 E2E tests: clean up matchers #20887

Merged
merged 48 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b9e2af3
improve serviceTypeDropdownOption selector
dizel852 Dec 26, 2022
1d465f0
add test ids to PathPopout component(s)
dizel852 Dec 27, 2022
56cb9ec
add unique id's to table dropdowns
dizel852 Dec 27, 2022
18e5af6
extend submitButtonClick to support optional click options
dizel852 Dec 27, 2022
7d211d3
update dropdown(pathPopout) matchers
dizel852 Dec 27, 2022
22a92fd
add test-id to Overlay component
dizel852 Dec 27, 2022
9ed2cd6
remove redundant function brackets
dizel852 Dec 27, 2022
5d32f6e
revert changes onSubmit button click
dizel852 Dec 27, 2022
5b8af84
fix dropDown overlay issue
dizel852 Dec 27, 2022
0152c38
move all duplicated intercepters to beforeEach
dizel852 Dec 29, 2022
bab5eb8
add test id's to Connections, Sources and Destinations tables
dizel852 Dec 29, 2022
cbf8af4
add table helper functions
dizel852 Dec 29, 2022
430bd20
update source page actions
dizel852 Dec 29, 2022
5ab5841
intercepter fixes
dizel852 Dec 29, 2022
8e47c78
update createTestConnection function with optional replication settings
dizel852 Dec 29, 2022
dfb19c7
remove extra Connection name check
dizel852 Dec 29, 2022
1093301
replace "cypress-postgres" with "pg-promise" npm package
dizel852 Dec 29, 2022
607d8f3
update cypress config
dizel852 Dec 29, 2022
9f2c49f
Merge branch 'master' into vlad/e2e-fix-duplicated-database-object-wa…
dizel852 Dec 29, 2022
69e81db
Merge branch 'vlad/e2e-fix-duplicated-database-object-warning' into v…
dizel852 Dec 29, 2022
d6909bf
Revert "update createTestConnection function with optional replicatio…
dizel852 Dec 30, 2022
feb4b37
Revert "remove extra Connection name check"
dizel852 Dec 30, 2022
5e38832
replace openSourceDestinationFromGrid with specific selector
dizel852 Dec 30, 2022
8be62d9
replace openSourceDestinationFromGrid with specific selector
dizel852 Dec 30, 2022
0bbdb0a
Merge remote-tracking branch 'origin/vlad/20722-e2e-clean-up-matchers…
dizel852 Dec 30, 2022
1e3792b
turn on test
dizel852 Dec 30, 2022
7555c11
add test-id's
dizel852 Dec 30, 2022
f136b3e
fix selectors
dizel852 Dec 30, 2022
b146e69
update test
dizel852 Dec 30, 2022
971965d
update test snapshots
dizel852 Dec 31, 2022
65d6252
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 10, 2023
bf900bd
fix lost data-testid after resolve merge conflicts
dizel852 Jan 10, 2023
79ba126
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 11, 2023
7ee9b87
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 12, 2023
91d2b6e
remove extra check
dizel852 Jan 13, 2023
786f59c
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 13, 2023
b5d0d7e
move clickOnCellInTable helper to common.ts file
dizel852 Jan 17, 2023
ef3d283
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 17, 2023
fc16d17
remove empty line and comments
dizel852 Jan 17, 2023
440a461
fix dropdownType
dizel852 Jan 17, 2023
2d6655c
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 18, 2023
0088fa7
replace partial string check with exact
dizel852 Jan 18, 2023
f91c54b
extract interceptors and waiters to separate file
dizel852 Jan 18, 2023
6505964
fix selector for predefined PK
dizel852 Jan 18, 2023
8eedbfd
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 18, 2023
59e0cb2
fix selector
dizel852 Jan 18, 2023
86cc98e
add comment regarding dropdown
dizel852 Jan 19, 2023
b5b4cae
Merge branch 'master' into vlad/20722-e2e-clean-up-matchers-and-naming
dizel852 Jan 19, 2023
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
137 changes: 65 additions & 72 deletions airbyte-webapp-e2e-tests/cypress/integration/connection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,27 @@ import {
selectPrimaryKeyField,
checkPreFilledPrimaryKeyField,
checkStreamFields,
expandStreamDetails,
expandStreamDetailsByName,
} from "pages/replicationPage";
import { openSourceDestinationFromGrid, goToSourcePage } from "pages/sourcePage";
import { goToSettingsPage } from "pages/settingsConnectionPage";
import { cleanDBSource, makeChangesInDBSource, populateDBSource } from "../commands/db";
import { goToSourcePage, openSourceOverview } from "pages/sourcePage";
import { goToSettingsPage, openConnectionOverviewByDestinationName } from "pages/settingsConnectionPage";
import { cleanDBSource, makeChangesInDBSource, populateDBSource } from "commands/db";
import {
catalogDiffModal,
newFieldsTable,
newStreamsTable,
removedFieldsTable,
removedStreamsTable,
toggleStreamWithChangesAccordion,
} from "../pages/modals/catalogDiffModal";
import { updateSchemaModalConfirmBtnClick } from "../pages/modals/updateSchemaModal";
} from "pages/modals/catalogDiffModal";
import { updateSchemaModalConfirmBtnClick } from "pages/modals/updateSchemaModal";

describe("Connection - main actions", () => {
beforeEach(() => {
initialSetupCompleted();

cy.intercept("/api/v1/web_backend/connections/get").as("getConnection");
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
});

it("Create new connection", () => {
Expand All @@ -57,16 +60,14 @@ describe("Connection - main actions", () => {
});

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

const sourceName = appendRandomString("Test update connection source cypress");
const destName = appendRandomString("Test update connection destination cypress");

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

Expand All @@ -86,16 +87,14 @@ describe("Connection - main actions", () => {
});

it("Update connection (pokeAPI)", () => {
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");

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

Expand Down Expand Up @@ -155,6 +154,9 @@ describe("Connection - main actions", () => {

createTestConnection(sourceName, destName);

cy.get("div").contains(sourceName).should("exist");
cy.get("div").contains(destName).should("exist");

goToReplicationTab();

selectSchedule("Cron");
Expand All @@ -174,17 +176,14 @@ describe("Connection - main actions", () => {
});

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}`);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

let loadedConnection: any = null; // Should be a WebBackendConnectionRead
cy.wait("@getConnection").then((interception) => {
Expand Down Expand Up @@ -228,8 +227,8 @@ describe("Connection - main actions", () => {
createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToSettingsPage();

Expand All @@ -240,16 +239,14 @@ describe("Connection - main actions", () => {
});

it("Saving a connection's destination namespace with 'Custom format' option", () => {
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");

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

Expand Down Expand Up @@ -286,16 +283,14 @@ describe("Connection - main actions", () => {
});

it("Saving a connection's destination namespace with 'Mirror source structure' option", () => {
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");

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

Expand All @@ -309,16 +304,14 @@ describe("Connection - main actions", () => {
});

it("Saving a connection's destination namespace with 'Destination default' option", () => {
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");

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

Expand Down Expand Up @@ -369,20 +362,21 @@ describe("Connection - stream view", () => {
it("Stream view", () => {
const sourceName = appendRandomString("Test connection Postgres source cypress");
const destName = appendRandomString("Test connection Postgres destination cypress");
const streamName = "users";

const collectionNames = ["Field name", "col1", "id"];
const collectionTypes = ["Data type", "String", "Integer"];
const collectionNames = ["col1", "id"];
const collectionTypes = ["String", "Integer"];
dizel852 marked this conversation as resolved.
Show resolved Hide resolved

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("users");
expandStreamDetails();
searchStream(streamName);
expandStreamDetailsByName(streamName);
checkStreamFields(collectionNames, collectionTypes);

deleteSource(sourceName);
Expand All @@ -394,6 +388,8 @@ describe("Connection sync modes", () => {
beforeEach(() => {
initialSetupCompleted();
populateDBSource();

cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
});

afterEach(() => {
Expand All @@ -403,20 +399,19 @@ describe("Connection sync modes", () => {
it("Connection sync mode Incremental Append", () => {
const sourceName = appendRandomString("Test connection Postgres source cypress");
const destName = appendRandomString("Test connection Postgres destination cypress");

cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
const streamName = "users";

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("users");
searchStream(streamName);
selectSyncMode("Incremental", "Append");
selectCursorField("col1");
selectCursorField(streamName, "col1");

submitButtonClick();
confirmStreamConfigurationChangedPopup();
Expand All @@ -428,13 +423,13 @@ describe("Connection sync modes", () => {
checkSuccessResult();

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("users");
checkCursorField("col1");
checkCursorField(streamName, "col1");

deleteSource(sourceName);
deleteDestination(destName);
Expand All @@ -443,20 +438,19 @@ describe("Connection sync modes", () => {
it("Connection sync mode Incremental Deduped History - PK is defined", () => {
const sourceName = appendRandomString("Test connection Postgres source cypress");
const destName = appendRandomString("Test connection Postgres destination cypress");

cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
const streamName = "users";

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("users");
searchStream(streamName);
selectSyncMode("Incremental", "Deduped + history");
selectCursorField("col1");
selectCursorField(streamName, "col1");
checkPreFilledPrimaryKeyField("id");

submitButtonClick();
Expand All @@ -469,14 +463,14 @@ describe("Connection sync modes", () => {
checkSuccessResult();

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("users");
searchStream(streamName);

checkCursorField("col1");
checkCursorField(streamName, "col1");
checkPreFilledPrimaryKeyField("id");

deleteSource(sourceName);
Expand All @@ -486,22 +480,21 @@ describe("Connection sync modes", () => {
it("Connection sync mode Incremental Deduped History - PK is not defined", () => {
const sourceName = appendRandomString("Test connection Postgres source cypress");
const destName = appendRandomString("Test connection Postgres destination cypress");

cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
const streamName = "cities";

createTestConnection(sourceName, destName);

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("cities");
searchStream(streamName);
selectSyncMode("Incremental", "Deduped + history");
selectCursorField("city");
selectCursorField(streamName, "city");
isPrimaryKeyNonExist();
selectPrimaryKeyField("city_code");
selectPrimaryKeyField(streamName, ["city_code"]);

submitButtonClick();
confirmStreamConfigurationChangedPopup();
Expand All @@ -513,15 +506,15 @@ describe("Connection sync modes", () => {
checkSuccessResult();

goToSourcePage();
openSourceDestinationFromGrid(sourceName);
openSourceDestinationFromGrid(destName);
openSourceOverview(sourceName);
openConnectionOverviewByDestinationName(destName);

goToReplicationTab();

searchStream("cities");
searchStream(streamName);

checkCursorField("city");
checkPrimaryKey("city_code");
checkCursorField(streamName, "city");
checkPrimaryKey(streamName, ["city", "city_code"]);
dizel852 marked this conversation as resolved.
Show resolved Hide resolved

deleteSource(sourceName);
deleteDestination(destName);
Expand All @@ -532,15 +525,15 @@ describe("Connection - detect changes in source", () => {
beforeEach(() => {
initialSetupCompleted();
populateDBSource();

cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");
dizel852 marked this conversation as resolved.
Show resolved Hide resolved
});

afterEach(() => {
cleanDBSource();
});

it("Create a connection, update data in source, show diff modal, reset streams", () => {
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection");

const sourceName = appendRandomString(
"Test refresh source schema with changed data - connection Postgres source cypress"
);
Expand Down
10 changes: 6 additions & 4 deletions airbyte-webapp-e2e-tests/cypress/pages/createConnectorPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const selectTypeDropdown = "div[data-testid='serviceType']";
const getServiceTypeDropdownOption = (serviceName: string) => `div[data-testid='${serviceName}']`;
const nameInput = "input[name=name]";
const hostInput = "input[name='connectionConfiguration.host']";
const portInput = "input[name='connectionConfiguration.port']";
Expand All @@ -9,10 +10,11 @@ const pokemonNameInput = "input[name='connectionConfiguration.pokemon_name']";
const schemaInput = "[data-testid='tag-input'] input";
const destinationPathInput = "input[name='connectionConfiguration.destination_path']";

export const selectServiceType = (type: string) => {
cy.get(selectTypeDropdown).click();
cy.get("div").contains(type).click();
};
export const selectServiceType = (type: string) =>
cy
.get(selectTypeDropdown)
.click()
.within(() => cy.get(getServiceTypeDropdownOption(type)).click());

export const enterName = (name: string) => {
cy.get(nameInput).clear().type(name);
Expand Down
Loading