From 2ada7a8b50c34f5dba852c83e8baaffbd8a5db55 Mon Sep 17 00:00:00 2001 From: Piyal Basu Date: Mon, 7 Oct 2024 22:41:25 -0400 Subject: [PATCH 1/2] Added translations --- extension/src/popup/locales/en/translation.json | 4 ++++ extension/src/popup/locales/pt/translation.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/extension/src/popup/locales/en/translation.json b/extension/src/popup/locales/en/translation.json index 9967a05f8..0d434321d 100644 --- a/extension/src/popup/locales/en/translation.json +++ b/extension/src/popup/locales/en/translation.json @@ -14,6 +14,7 @@ "Add": "Add", "Add address": "Add address", "Add an asset": "Add an asset", + "Add anyway": "Add anyway", "Add asset": "Add asset", "Add Asset trustline": "Add Asset trustline", "Add Asset Trustline": "Add Asset Trustline", @@ -374,6 +375,7 @@ "Resource cost": "Resource cost", "Review": "Review", "Review accounts to migrate": "Review accounts to migrate", + "Review anyway": "Review anyway", "Review transaction on device": "Review transaction on device", "Revocable Asset": "Revocable Asset", "Salt": "Salt", @@ -474,6 +476,8 @@ "This site has been scanned and verified": "This site has been scanned and verified", "This site was flagged as malicious": "This site was flagged as malicious", "This transaction could not be completed": "This transaction could not be completed.", + "This transaction is expected to fail": "This transaction is expected to fail", + "This transaction was flagged as malicious": "This transaction was flagged as malicious", "This transaction was flagged by Blockaid for the following reasons": "This transaction was flagged by Blockaid for the following reasons", "To": "To", "To create a new account you need to send at least 1 XLM to it": "To create a new account you need to send at least 1 XLM to it.", diff --git a/extension/src/popup/locales/pt/translation.json b/extension/src/popup/locales/pt/translation.json index 898d7a2dc..5d378e62b 100644 --- a/extension/src/popup/locales/pt/translation.json +++ b/extension/src/popup/locales/pt/translation.json @@ -14,6 +14,7 @@ "Add": "Add", "Add address": "Add address", "Add an asset": "Add an asset", + "Add anyway": "Add anyway", "Add asset": "Add asset", "Add Asset trustline": "Add Asset trustline", "Add Asset Trustline": "Add Asset Trustline", @@ -374,6 +375,7 @@ "Resource cost": "Resource cost", "Review": "Review", "Review accounts to migrate": "Review accounts to migrate", + "Review anyway": "Review anyway", "Review transaction on device": "Review transaction on device", "Revocable Asset": "Revocable Asset", "Salt": "Salt", @@ -474,6 +476,8 @@ "This site has been scanned and verified": "This site has been scanned and verified", "This site was flagged as malicious": "This site was flagged as malicious", "This transaction could not be completed": "This transaction could not be completed.", + "This transaction is expected to fail": "This transaction is expected to fail", + "This transaction was flagged as malicious": "This transaction was flagged as malicious", "This transaction was flagged by Blockaid for the following reasons": "This transaction was flagged by Blockaid for the following reasons", "To": "To", "To create a new account you need to send at least 1 XLM to it": "To create a new account you need to send at least 1 XLM to it.", From 60f14371f062c8b4a65eb5eddca3316ab3569190 Mon Sep 17 00:00:00 2001 From: Piyal Basu Date: Mon, 7 Oct 2024 22:47:57 -0400 Subject: [PATCH 2/2] fix flakey tests --- extension/e2e-tests/addAsset.test.ts | 8 +++----- extension/e2e-tests/sendPayment.test.ts | 18 +++++++++--------- extension/playwright.config.ts | 4 ++++ .../SendSettings/Settings/index.tsx | 9 +++++++-- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/extension/e2e-tests/addAsset.test.ts b/extension/e2e-tests/addAsset.test.ts index 7e8a37d95..13c0a9c29 100644 --- a/extension/e2e-tests/addAsset.test.ts +++ b/extension/e2e-tests/addAsset.test.ts @@ -74,11 +74,9 @@ test("Adding Soroban verified token", async ({ page, extensionId }) => { timeout: 30000, }); - await page.getByText("Manage Assets").click({ force: true }); - await page - .getByTestId("ManageAssetRowButton__ellipsis-USDC") - .click({ force: true }); - await page.getByText("Remove asset").click({ force: true }); + await page.getByText("Manage Assets").click(); + await page.getByTestId("ManageAssetRowButton__ellipsis-USDC").click(); + await page.getByText("Remove asset").click(); await expect(page.getByTestId("account-view")).toBeVisible({ timeout: 30000, diff --git a/extension/e2e-tests/sendPayment.test.ts b/extension/e2e-tests/sendPayment.test.ts index bc59800ed..d1080579e 100644 --- a/extension/e2e-tests/sendPayment.test.ts +++ b/extension/e2e-tests/sendPayment.test.ts @@ -90,13 +90,15 @@ test("Send XLM payment to C address", async ({ page, extensionId }) => { await expect(page.getByTestId("SendSettingsTransactionFee")).toHaveText( /[0-9]/, ); - await page.getByText("Review Send").click({ force: true }); + await page.getByText("Review Send").click(); await expect(page.getByText("Verification")).toBeVisible(); await page.getByPlaceholder("Enter password").fill(PASSWORD); - await page.getByText("Submit").click({ force: true }); + await page.getByText("Submit").click(); - await expect(page.getByText("Confirm Send")).toBeVisible(); + await expect(page.getByText("Confirm Send")).toBeVisible({ + timeout: 200000, + }); await expectPageToHaveScreenshot({ page, screenshot: "send-payment-confirm.png", @@ -138,7 +140,7 @@ test("Send SAC to C address", async ({ page, extensionId }) => { await page.getByText("Add asset").dispatchEvent("click"); await expect(page.getByTestId("account-view")).toBeVisible({ - timeout: 30000, + timeout: 300000, }); // swap to get some USDC @@ -184,7 +186,7 @@ test("Send SAC to C address", async ({ page, extensionId }) => { await expect(page.getByText("Send Settings")).toBeVisible(); await expect(page.getByText("Review Send")).toBeEnabled(); - await page.getByText("Review Send").click({ force: true }); + await page.getByText("Review Send").click(); await expect(page.getByText("Confirm Send")).toBeVisible(); await page.getByTestId("transaction-details-btn-send").click({ force: true }); @@ -203,9 +205,7 @@ test("Send SAC to C address", async ({ page, extensionId }) => { // remove USDC await page.getByText("Manage Assets").click({ force: true }); - await page - .getByTestId("ManageAssetRowButton__ellipsis-USDC") - .click({ force: true }); + await page.getByTestId("ManageAssetRowButton__ellipsis-USDC").click(); await page.getByText("Remove asset").click({ force: true }); await expect(page.getByTestId("account-view")).toBeVisible({ @@ -248,7 +248,7 @@ test("Send token payment to C address", async ({ page, extensionId }) => { await page.getByTestId("transaction-details-btn-send").click({ force: true }); await expect(page.getByText("Successfully sent")).toBeVisible({ - timeout: 60000, + timeout: 600000, }); await page.getByText("Details").click({ force: true }); diff --git a/extension/playwright.config.ts b/extension/playwright.config.ts index 245b52e0f..206b14fb8 100644 --- a/extension/playwright.config.ts +++ b/extension/playwright.config.ts @@ -10,6 +10,10 @@ import { defineConfig, devices } from "@playwright/test"; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ + expect: { + /* Set the default timeout for all tests to 30 seconds */ + timeout: 300000, + }, testDir: "./e2e-tests", /* Run tests in files in parallel */ fullyParallel: true, diff --git a/extension/src/popup/components/sendPayment/SendSettings/Settings/index.tsx b/extension/src/popup/components/sendPayment/SendSettings/Settings/index.tsx index 1954f389e..f113f30ed 100644 --- a/extension/src/popup/components/sendPayment/SendSettings/Settings/index.tsx +++ b/extension/src/popup/components/sendPayment/SendSettings/Settings/index.tsx @@ -102,6 +102,9 @@ export const Settings = ({ useEffect(() => { async function simulateTx() { + if (!recommendedFee) { + return; + } // use default transaction fee if unset const baseFee = new BigNumber( transactionFee || recommendedFee || stroopToXlm(BASE_FEE), @@ -136,6 +139,7 @@ export const Settings = ({ ), ); } + setLoadingSimulation(false); return; } @@ -193,17 +197,18 @@ export const Settings = ({ ), ); } + setLoadingSimulation(false); return; } if (!transactionFee) { dispatch(saveTransactionFee(baseFee.toString())); } + setLoadingSimulation(false); } async function setFee() { setLoadingSimulation(true); await simulateTx(); - setLoadingSimulation(false); } setFee(); }, [ @@ -251,7 +256,7 @@ export const Settings = ({ title={`${isSwap ? t("Swap") : t("Send")} ${t("Settings")}`} customBackAction={() => navigateTo(previous)} /> - {isLoadingSimulation ? ( + {isLoadingSimulation && !recommendedFee ? (