Skip to content
Open
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
17 changes: 17 additions & 0 deletions apps/coordinator/e2e/pages/SendTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ export class SendTab {
await btn.click();
}

async importPsbtFile(psbtPath: string) {
await this.page.getByText("Import PSBT").scrollIntoViewIfNeeded();
await this.page.getByRole("combobox", { name: /import method/i }).click();
await this.page.getByRole("option", { name: /file upload/i }).click();
await this.page.locator('input[type="file"]').setInputFiles(psbtPath);
await this.page.getByRole("button", { name: /import psbt file/i }).click();
}

async expectImportErrorBlocksSigning() {
await expect(this.page.getByRole("alert")).toBeVisible({
timeout: 10000,
});
await expect(
this.page.getByRole("button", { name: /sign transaction/i }),
).not.toBeVisible();
}

async downloadUnsignedPsbt(savePath: string): Promise<string> {
const btn = this.page.locator(
'button[type=button]:has-text("Download Unsigned PSBT")',
Expand Down
10 changes: 10 additions & 0 deletions apps/coordinator/e2e/tests/mutate/transaction-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ test.describe.serial("Transaction Creation and Signing", () => {
await walletNav.switchToTab("Send");
});

test("invalid PSBT upload: shows error and blocks signing", async ({
sendTab,
}) => {
const invalidPsbtPath = path.join(uploadDir, "invalid.psbt");
fs.writeFileSync(invalidPsbtPath, "this-is-not-a-valid-psbt");

await sendTab.importPsbtFile(invalidPsbtPath);
await sendTab.expectImportErrorBlocksSigning();
});

test("auto coin selection: create, sign, broadcast", async ({
sendTab,
signTab,
Expand Down