Skip to content

Add e2e test for invalid PSBT upload#462

Open
harrshita123 wants to merge 3 commits intocaravan-bitcoin:mainfrom
harrshita123:test-invalid-psbt-e2e
Open

Add e2e test for invalid PSBT upload#462
harrshita123 wants to merge 3 commits intocaravan-bitcoin:mainfrom
harrshita123:test-invalid-psbt-e2e

Conversation

@harrshita123
Copy link

Test / Quality improvement (E2E test)

Fixes #442

This PR adds an end-to-end test to validate Caravan’s behavior when an invalid PSBT file is uploaded.

The test ensures that:

  • Uploading an invalid PSBT triggers a visible error alert
  • The transaction signing flow is blocked for invalid PSBT inputs

This improves test coverage and prevents regressions related to PSBT validation.

  • I have tested my changes thoroughly.

  • I have added tests to cover my changes.

  • I have run the test suite locally, and all tests pass.

  • I have written tests for all new changes/features.

  • I have followed the project's coding style and conventions.

  • Added E2E test in:
    apps/coordinator/e2e/tests/03-transaction_flow.spec.ts

  • Verified locally using npm run test:e2e

Have you read the contributing guide?
Yes

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
caravan-coordinator Ready Ready Preview, Comment Mar 11, 2026 5:22pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2026

⚠️ No Changeset found

Latest commit: fd1770c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@Legend101Zz Legend101Zz left a comment

Choose a reason for hiding this comment

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

Just a nit , rest looks good to me thanks for the PR , can you also please attach a screen shot showing the playwright running the test , would be really helpful thanks

@@ -0,0 +1,8 @@
---
"caravan-coordinator": none
Copy link
Contributor

Choose a reason for hiding this comment

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

actually we don't need a changeset for this , changeset it for packages and coordinator version , we don't it for e2e test suite ... @bucko13 please correct me if I am wrong here :)

Copy link
Author

@harrshita123 harrshita123 Feb 17, 2026

Choose a reason for hiding this comment

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

actually we don't need a changeset for this , changeset it for packages and coordinator version , we don't it for e2e test suite ... @bucko13 please correct me if I am wrong here :)

Thanks for the review and the helpful suggestion!

You are absolutely right . since this change only adds an end-to-end test and does not modify any package code or affect the coordinator version, a changeset isn’t required. I have removed the changeset file accordingly.

I have also attached a screenshot of the Playwright test suite running locally (npm run test:e2e) showing all tests passing, including the newly added invalid PSBT test.

please let me know if there is anything else I should improve!

Copy link
Author

Choose a reason for hiding this comment

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

actually we don't need a changeset for this , changeset it for packages and coordinator version , we don't it for e2e test suite ... @bucko13 please correct me if I am wrong here :)

@Legend101Zz

Thanks for the review and the helpful suggestion!

You are absolutely right . since this change only adds an end-to-end test and does not modify any package code or affect the coordinator version, a changeset isn’t required. I have removed the changeset file accordingly.

I have also attached a screenshot of the Playwright test suite running locally (npm run test:e2e) showing all tests passing, including the newly added invalid PSBT test.

please let me know if there is anything else I should improve!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @harrshita123 everything looks good to me :)

@harrshita123
Copy link
Author

Screenshot 2026-02-17 at 10 34 41 PM

Copy link
Contributor

@Legend101Zz Legend101Zz left a comment

Choose a reason for hiding this comment

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

LGTM

@bucko13
Copy link
Contributor

bucko13 commented Mar 10, 2026

With #487 we need to update to the new e2e system. will require resolving some merge conflicts.

@Legend101Zz
Copy link
Contributor

Hi @harrshita123 Thanks for your patience. As Buck suggested above due to the E2E changes the testsiote was updated , Could you please pull in the latest changes and review the updated E2E setup we’ve implemented, then adjust your changes accordingly?

@harrshita123
Copy link
Author

Hi @harrshita123 Thanks for your patience. As Buck suggested above due to the E2E changes the testsiote was updated , Could you please pull in the latest changes and review the updated E2E setup we’ve implemented, then adjust your changes accordingly?

I will sync with the latest main, rebase this PR, and update my changes to align with the new E2E setup from #487. I will take care of the merge conflicts and push an update soon.

@harrshita123
Copy link
Author

Implemented the updates based on your guidance for the new E2E setup and resolved the related conflicts. I also re- ran the E2E suite and all tests are passing (15 passed). Sharing the screenshot of the passing run here for reference.

Screenshot 2026-03-11 at 10 44 03 PM

@harrshita123
Copy link
Author

Should i have to add changesets ?

Copy link
Contributor

@Legend101Zz Legend101Zz left a comment

Choose a reason for hiding this comment

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

@harrshita123 thanks for the PR , I had a comment on moving all the assertion logic to pages , you can read more in the contribution.md to understand how the new e2e architecture works :)


await sendTab.importPsbtFile(invalidPsbtPath);

await expect(page.getByRole("alert")).toBeVisible({ timeout: 10000 });
Copy link
Contributor

Choose a reason for hiding this comment

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

The assertions at the end are leaking raw Playwright locators into the test body — this should go through the page object instead. sendTab is right there; something like sendTab.expectImportError() (or whatever makes sense on the POM) would keep the test readable and keep selector details out of spec files.

So can you plaese move the page.getByRole("alert") and sign-button assertions behind a POM method on sendTab.

As if we don't follow the POM model we can again go back to having flaky tests :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

End-to-End Testing Coverage

3 participants