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

Connector builder: E2e tests #21122

Merged
merged 14 commits into from
Jan 10, 2023
Merged

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Jan 6, 2023

Fixes #20713

Adds e2e tests for the connector builder. To be able to find the right buttons and inputs, some data-testid attributes got added.

This includes a local dummy api to test against.

Covers basic read, authentication and pagination.

@octavia-squidington-iv octavia-squidington-iv added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Jan 6, 2023
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:50 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:50 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:59 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:59 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 18:02 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 18:02 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 08:51 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 08:51 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 09:49 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 09:50 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 10:44 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 10:45 — with GitHub Actions Inactive
@flash1293 flash1293 marked this pull request as ready for review January 9, 2023 12:15
@flash1293 flash1293 requested a review from a team as a code owner January 9, 2023 12:15
Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

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

Had a few small comments but otherwise this LGTM.

Ran through the e2e test steps locally and it worked as expected!

airbyte-webapp-e2e-tests/README.md Outdated Show resolved Hide resolved
// Add more dummy logic in here
res.setHeader("Content-Type", "application/json");
res.writeHead(200);
res.end(JSON.stringify({ items: [...items].splice(req.headers["offset"] ? Number(req.headers["offset"]) : 0, 2) }));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused by this line. From the splice documentation, when it is supplied two arguments, the first one is the starting index, and the second one is the number of elements that should be deleted.

So why is it that when no offset is passed here, it is deleting the last two elements instead of the first two?

Tried this out myself and I don't understand why the results of these two are different:

const items = [{ name: "abc" }, { name: "def" }, { name: "xxx" }, { name: "yyy" }];
items.splice(0, 2);
console.log(items)

^ prints out [{ "name": "xxx" }, { "name": "yyy" }], which is expected

const items = [{ name: "abc" }, { name: "def" }, { name: "xxx" }, { name: "yyy" }];
console.log([...items].splice(0, 2))

^ prints out [{ "name": "abc" }, { "name": "def" }], but I expected it to be the same as the above

Copy link
Contributor Author

@flash1293 flash1293 Jan 10, 2023

Choose a reason for hiding this comment

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

Splice mutates the original array and returns the deleted elements. This code first creates a shallow copy of the items array, then deletes two items at the specified offset and then returns them - this return value is what's passed to the JSON.stringify call; the shallow copy of items, which the items to be sent got returned from, is simply discarded.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦 I didn't realize that splice was returning the deleted elements. This all makes sense now, thanks for explaining

@@ -25,6 +25,7 @@ interface ViewSelectButtonProps {
selected: boolean;
showErrorIndicator: boolean;
onClick: () => void;
testId: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: make this prop name consistent with the other prop names added in this PR. I don't have a strong preference between testId and data-testid, but they should ideally all be consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's named differently because it gets a prefix automatically while the others are "raw" data-testid. However this is probably unexpected and too much magic, so I flattened out the prefix in the places where ViewSelectButton is actually used. A bit more redundancy but it's probably for the better.

@flash1293 flash1293 enabled auto-merge (squash) January 10, 2023 11:51
@octavia-squidington-iv octavia-squidington-iv removed the area/platform issues related to the platform label Jan 10, 2023
@flash1293 flash1293 temporarily deployed to more-secrets January 10, 2023 12:09 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 10, 2023 12:09 — with GitHub Actions Inactive
@flash1293 flash1293 merged commit f61a790 into master Jan 10, 2023
@flash1293 flash1293 deleted the flash1293/connector-builder-e2e-tests branch January 10, 2023 12:44
jbfbell pushed a commit that referenced this pull request Jan 13, 2023
* wip

* wip

* e2e tests for connector builder server

* rename function

* clean up

* clean up a bit more

* fix path

* fix and add documentation

* more documentation

* stabilze

* review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connector builder: E2E Test
3 participants