diff --git a/.changeset/curly-snails-walk.md b/.changeset/curly-snails-walk.md new file mode 100644 index 0000000000000..5033814ac6342 --- /dev/null +++ b/.changeset/curly-snails-walk.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixes issue that caused the livechat appearance form not be able to submit on CE servers diff --git a/apps/meteor/client/views/omnichannel/appearance/AppearancePage.tsx b/apps/meteor/client/views/omnichannel/appearance/AppearancePage.tsx index 7e590d190b5b3..1da01cc4eb75f 100644 --- a/apps/meteor/client/views/omnichannel/appearance/AppearancePage.tsx +++ b/apps/meteor/client/views/omnichannel/appearance/AppearancePage.tsx @@ -57,7 +57,9 @@ const AppearancePage = ({ settings }: { settings: Serialized[] }) => { const currentData = watch(); const handleSave = useMutableCallback(async (data) => { - const mappedAppearance = Object.entries(data).map(([_id, value]) => ({ _id, value })) as { + const mappedAppearance = Object.entries(data) + .map(([_id, value]) => ({ _id, value })) + .filter((item) => item.value !== undefined) as { _id: string; value: string | boolean | number; }[]; diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-appearance.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-appearance.spec.ts index a67e45b01ce6c..e0d9f92df2ea6 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-appearance.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-appearance.spec.ts @@ -5,10 +5,9 @@ import { test, expect } from '../utils/test'; test.use({ storageState: Users.admin.state }); -test.skip(!IS_EE, 'Enterprise Only'); - -test.describe.serial('OC - Livechat Appearance', () => { +test.describe.serial('OC - Livechat Appearance - EE', () => { let poLivechatAppearance: OmnichannelLivechatAppearance; + test.skip(!IS_EE, 'Enterprise Only'); test.beforeEach(async ({ page }) => { poLivechatAppearance = new OmnichannelLivechatAppearance(page); @@ -73,3 +72,38 @@ test.describe.serial('OC - Livechat Appearance', () => { }); }); }); + +test.describe('OC - Livechat Appearance - CE', () => { + let poLivechatAppearance: OmnichannelLivechatAppearance; + + test.beforeEach(async ({ page }) => { + poLivechatAppearance = new OmnichannelLivechatAppearance(page); + + await page.goto('/omnichannel'); + await poLivechatAppearance.sidenav.linkLivechatAppearance.click(); + }); + + test.afterAll(async ({ api }) => { + const res = await api.post('/settings/Livechat_title', { value: 'Rocket.Chat' }); + + if (res.status() !== 200) { + throw new Error('Failed to reset settings'); + } + }); + + test('OC - Livechat Appearance - Change Livechat Title', async ({ page }) => { + await test.step('expect to have default value', async () => { + await expect(poLivechatAppearance.inputLivechatTitle).toHaveValue('Rocket.Chat'); + }); + + await test.step('expect to change value', async () => { + await poLivechatAppearance.inputLivechatTitle.fill('Test Title'); + await poLivechatAppearance.btnSave.click(); + }); + + await test.step('expect to have saved changes', async () => { + await page.reload(); + await expect(poLivechatAppearance.inputLivechatTitle).toHaveValue('Test Title'); + }); + }); +}); diff --git a/apps/meteor/tests/e2e/page-objects/omnichannel-livechat-appearance.ts b/apps/meteor/tests/e2e/page-objects/omnichannel-livechat-appearance.ts index d596dde683b4b..d20c5ca10a650 100644 --- a/apps/meteor/tests/e2e/page-objects/omnichannel-livechat-appearance.ts +++ b/apps/meteor/tests/e2e/page-objects/omnichannel-livechat-appearance.ts @@ -11,6 +11,10 @@ export class OmnichannelLivechatAppearance extends OmnichannelAdministration { return this.page.locator('[name="Livechat_background"]'); } + get inputLivechatTitle(): Locator { + return this.page.locator('[name="Livechat_title"]'); + } + findHideSystemMessageOption(option: string): Locator { return this.page.locator(`[role="option"][value="${option}"]`); }