Skip to content

Commit

Permalink
fix: livechat appearance not savable on CE servers (#34013)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler authored and ggazzo committed Dec 5, 2024
1 parent 11a6ab6 commit b0dc3f4
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-snails-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes issue that caused the livechat appearance form not be able to submit on CE servers
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const AppearancePage = ({ settings }: { settings: Serialized<ISetting>[] }) => {
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;
}[];
Expand Down
40 changes: 37 additions & 3 deletions apps/meteor/tests/e2e/omnichannel/omnichannel-appearance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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}"]`);
}
Expand Down

0 comments on commit b0dc3f4

Please sign in to comment.