Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: livechat appearance not savable on CE servers #34013

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading