diff --git a/extension/e2e-tests/sendPayment.test.ts b/extension/e2e-tests/sendPayment.test.ts index 71c961d974..4a6a7bcea7 100644 --- a/extension/e2e-tests/sendPayment.test.ts +++ b/extension/e2e-tests/sendPayment.test.ts @@ -1,3 +1,4 @@ +import { TransactionBuilder } from "stellar-sdk"; import { test, expect } from "./test-fixtures"; import { login, loginAndFund, loginToTestAccount } from "./helpers/login"; import { TEST_M_ADDRESS, TEST_TOKEN_ADDRESS } from "./helpers/test-token"; @@ -10,7 +11,7 @@ import { } from "./helpers/stubs"; const MUXED_ACCOUNT_ADDRESS = - "MCCRNOIMODZT7HVQA3NM46YMLOBAXMSMHK3XXIN62CTWIPPP3J2E4AAAAAAAAAAAAEIAM"; + "MCQ7EGW7VXHI4AKJAFADOIHCSK2OCVA42KUETUK5LQ3LVSEQEEKP6AAAAAAAAAAAAFLVY"; test("Swap doesn't throw error when account is unfunded", async ({ page, @@ -241,6 +242,71 @@ test("Send can review formatted inputs", async ({ page, extensionId }) => { }); }); +test("Send persists inputs and submits to network", async ({ + page, + extensionId, +}) => { + test.slow(); + await loginAndFund({ page, extensionId }); + await page.getByTestId("nav-link-send").click({ force: true }); + + await expect(page.getByText("Send")).toBeVisible(); + await page + .getByTestId("send-to-input") + .fill("GBTYAFHGNZSTE4VBWZYAGB3SRGJEPTI5I4Y22KZ4JTVAN56LESB6JZOF"); + await page.getByText("Continue").click(); + + await expect(page.getByTestId("AppHeaderPageTitle")).toContainText("Send"); + await page.getByTestId(`SendRow-native`).click({ force: true }); + await page.getByTestId("send-amount-amount-input").fill("1"); + await page.getByTestId("send-amount-btn-memo").click(); + await page.getByTestId("edit-memo-input").fill("test memo"); + await page.getByText("Save").click(); + await page.getByTestId("send-amount-btn-fee").click(); + await page.getByTestId("edit-tx-settings-fee-input").fill("0.00009"); + await page.getByText("Save").click(); + await page.getByText("Review Send").click({ force: true }); + await expect(page.getByText("You are sending")).toBeVisible({ + timeout: 200000, + }); + await expect(page.getByTestId("review-tx-send-amount")).toHaveText("1 XLM"); + await expect(page.getByTestId("review-tx-memo")).toHaveText("test memo"); + await expect(page.getByTestId("review-tx-fee")).toHaveText("0.00009 XLM"); + + let submitTxResponse = ""; + page.on("response", async (response) => { + if (response.url().includes("/submit-tx")) { + submitTxResponse = await response.text(); + } + }); + + await page.getByTestId(`SubmitAction`).click(); + + await expect(page.getByText("Sent!")).toBeVisible({ + timeout: 60000, + }); + const submitTxResponseJson = JSON.parse(submitTxResponse); + + expect(submitTxResponseJson.memo).toBe("test memo"); + expect(submitTxResponseJson.max_fee).toBe("900"); + + const tx = TransactionBuilder.fromXDR( + submitTxResponseJson.envelope_xdr, + "Test SDF Network ; September 2015", + ); + + const txOp = tx.operations[0] as any; + + expect(txOp.type).toBe("payment"); + expect(txOp.amount).toBe("1.0000000"); + expect(txOp.destination).toBe( + "GBTYAFHGNZSTE4VBWZYAGB3SRGJEPTI5I4Y22KZ4JTVAN56LESB6JZOF", + ); + expect(txOp.asset.code).toBe("XLM"); + + await page.getByText("Done").click(); +}); + test("Send XLM payments to recent federated addresses", async ({ page, extensionId, diff --git a/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx b/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx index 8fa9ad0f0b..66eedbe791 100644 --- a/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx +++ b/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx @@ -38,6 +38,7 @@ export const EditMemo = ({ memo, onClose, onSubmit }: EditMemoProps) => { {({ field }: FieldProps) => ( {({ field }: FieldProps) => ( -
+
{sendAmount} {asset.code} @@ -151,7 +154,10 @@ export const ReviewTx = ({
-
+
{dstAsset && dest ? ( <> Memo
-
+
{memo || "None"}
@@ -210,7 +219,10 @@ export const ReviewTx = ({ Fee
-
+
{fee} XLM
diff --git a/extension/src/popup/components/sendPayment/SendAmount/index.tsx b/extension/src/popup/components/sendPayment/SendAmount/index.tsx index b0ddbffe84..06c75bd194 100644 --- a/extension/src/popup/components/sendPayment/SendAmount/index.tsx +++ b/extension/src/popup/components/sendPayment/SendAmount/index.tsx @@ -301,6 +301,7 @@ export const SendAmount = ({