diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx index 3b43deea91..efc2853fde 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx @@ -39,7 +39,7 @@ const AddNewsletterModal: React.FC = () => { const newErrors: Record = {}; if (!formState.name) { - newErrors.name = 'Name is required'; + newErrors.name = 'A name is required for your newsletter'; } return newErrors; diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx index 831c1bc43e..fdade36410 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx @@ -546,17 +546,17 @@ const NewsletterDetailModalContent: React.FC<{newsletter: Newsletter; onlyOne: b const newErrors: Record = {}; if (!formState.name) { - newErrors.name = 'Name is required'; + newErrors.name = 'A name is required for your newsletter'; } if (formState.sender_email && !validator.isEmail(formState.sender_email)) { - newErrors.sender_email = 'Invalid email'; + newErrors.sender_email = 'Enter a valid email address'; } else if (formState.sender_email && hasSendingDomain(config) && formState.sender_email.split('@')[1] !== sendingDomain(config)) { - newErrors.sender_email = `Email must end with @${sendingDomain(config)}`; + newErrors.sender_email = `Email address must end with @${sendingDomain(config)}`; } if (formState.sender_reply_to && !validator.isEmail(formState.sender_reply_to) && !['newsletter', 'support'].includes(formState.sender_reply_to)) { - newErrors.sender_reply_to = 'Invalid email'; + newErrors.sender_reply_to = 'Enter a valid email address'; } return newErrors; diff --git a/apps/admin-x-settings/test/acceptance/email/newsletters.test.ts b/apps/admin-x-settings/test/acceptance/email/newsletters.test.ts index f2d0224603..57868eaeee 100644 --- a/apps/admin-x-settings/test/acceptance/email/newsletters.test.ts +++ b/apps/admin-x-settings/test/acceptance/email/newsletters.test.ts @@ -27,7 +27,7 @@ test.describe('Newsletter settings', async () => { const modal = page.getByTestId('add-newsletter-modal'); await modal.getByRole('button', {name: 'Create'}).click(); - await expect(modal).toHaveText(/Name is required/); + await expect(modal).toHaveText(/A name is required for your newsletter/); // Shouldn't be necessary, but without these Playwright doesn't click Create the second time for some reason await modal.getByRole('button', {name: 'Cancel'}).click(); @@ -69,7 +69,7 @@ test.describe('Newsletter settings', async () => { await modal.getByPlaceholder('Weekly Roundup').fill(''); await modal.getByRole('button', {name: 'Save'}).click(); - await expect(modal).toHaveText(/Name is required/); + await expect(modal).toHaveText(/A name is required for your newsletter/); await modal.getByPlaceholder('Weekly Roundup').fill('Updated newsletter'); @@ -114,7 +114,7 @@ test.describe('Newsletter settings', async () => { await modal.getByLabel('Sender email').fill('not-an-email'); await modal.getByRole('button', {name: 'Save'}).click(); - await expect(modal).toHaveText(/Invalid email/); + await expect(modal).toHaveText(/Enter a valid email address/); await modal.getByLabel('Sender email').fill('test@test.com'); await modal.getByRole('button', {name: 'Save'}).click(); @@ -191,7 +191,7 @@ test.describe('Newsletter settings', async () => { await replyToEmail.fill('not-an-email'); await modal.getByRole('button', {name: 'Save'}).click(); - await expect(modal).toHaveText(/Invalid email/); + await expect(modal).toHaveText(/Enter a valid email address/); await replyToEmail.fill('test@test.com'); await modal.getByRole('button', {name: 'Save'}).click(); @@ -237,12 +237,12 @@ test.describe('Newsletter settings', async () => { // Error case #1: add invalid email address await senderEmail.fill('Harry Potter'); await modal.getByRole('button', {name: 'Save'}).click(); - await expect(modal).toHaveText(/Invalid email/); + await expect(modal).toHaveText(/Enter a valid email address/); // Error case #2: the sender email address doesn't match the custom sending domain await senderEmail.fill('harry@potter.com'); await modal.getByRole('button', {name: 'Save'}).click(); - await expect(modal).toHaveText(/Email must end with @customdomain.com/); + await expect(modal).toHaveText(/Email address must end with @customdomain.com/); // But can have any address on the same domain, without verification await senderEmail.fill('harry@customdomain.com');