diff --git a/src/components/settings/AddressBook.vue b/src/components/settings/AddressBook.vue index e55585b8..7919fcb2 100644 --- a/src/components/settings/AddressBook.vue +++ b/src/components/settings/AddressBook.vue @@ -68,7 +68,7 @@ const validVerifier = (value: string) => { const getErrorMessage = () => { const selectedType = newContactState.transferType?.value || ""; if (!selectedType) return ""; - return ALLOWED_VERIFIERS_ERRORS[selectedType]; + return t(ALLOWED_VERIFIERS_ERRORS[selectedType]); }; const validNewContact = (value: string): boolean => { diff --git a/tests/e2e/settings/settings.test.ts b/tests/e2e/settings/settings.test.ts index 22417ffd..d0468ad0 100644 --- a/tests/e2e/settings/settings.test.ts +++ b/tests/e2e/settings/settings.test.ts @@ -71,6 +71,25 @@ test.describe("Settings Page", async () => { await page.click("button >> text=Close"); }); + test("Empty contact name should show required error message", async () => { + // // see navigation works correctly + await switchTab(page, "settings"); + + // if contact is empty, show Required error message + await page.click("text=Add Contact"); + await expect(page.locator("div >> text=Required")).toHaveCount(1); + }); + + test("Invalid public key should show invalid error message", async () => { + // // see navigation works correctly + await switchTab(page, "settings"); + + // if public key is invalid, show Invalid SOL Address error message + await page.fill("input[placeholder='Enter SOL Public Key']", `invalid-${IMPORT_ACC_ADDRESS}`); + await page.click("text=Add Contact"); + await expect(page.locator("div >> text=Invalid SOL Address")).toHaveCount(1); + }); + test("Contact should be added and then deleted", async () => { // // see navigation works correctly await switchTab(page, "settings");