Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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/grumpy-colts-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where custom status is not updating immediately if the value is empty
2 changes: 1 addition & 1 deletion apps/meteor/server/modules/listeners/listeners.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class ListenersModule {
id: _id,
diff: {
status,
...(statusText && { statusText }),
statusText,
Comment thread
cardoso marked this conversation as resolved.
Outdated
},
unset: {},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import type { Page } from 'playwright-core';
import { Modal } from './modal';

export class EditStatusModal extends Modal {
protected readonly page: Page;

constructor(page: Page) {
super(page.getByRole('dialog', { name: 'Edit Status' }));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Locator, Page } from '@playwright/test';

import { LoginPage } from '../login';
import { EditStatusModal } from './edit-status-modal';
import { ToastMessages } from './toast-messages';
import { expect } from '../../utils/test';

Expand Down Expand Up @@ -251,4 +252,12 @@ export class HomeSidenav {
get homepageHeader(): Locator {
return this.page.locator('main').getByRole('heading', { name: 'Home' });
}

async changeUserCustomStatus(text: string): Promise<void> {
const editStatusModal = new EditStatusModal(this.page);

await this.btnUserProfileMenu.click();
await this.getUserProfileMenuOption('Custom Status').click();
await editStatusModal.changeStatusMessage(text);
}
}
26 changes: 18 additions & 8 deletions apps/meteor/tests/e2e/presence.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { faker } from '@faker-js/faker';

import { DEFAULT_USER_CREDENTIALS, IS_EE } from './config/constants';
import { Users } from './fixtures/userStates';
import { Registration, HomeChannel } from './page-objects';
import { EditStatusModal } from './page-objects/fragments/edit-status-modal';
import { setSettingValueById } from './utils/setSettingValueById';
import { test, expect } from './utils/test';
import { links } from '../../client/lib/links';
Expand Down Expand Up @@ -36,34 +37,43 @@ test.describe.serial('Presence', () => {
});

test.describe('Custom status', () => {
const customStatus = faker.string.alpha(10);
test.use({ storageState: Users.admin.state });

test('should user custom status be reactive', async ({ browser }) => {
await test.step('user1 custom status should be empty', async () => {
await poHomeChannel.sidenav.openChat('user1');

await expect(poHomeChannel.content.channelHeader).not.toContainText('new status');
await expect(poHomeChannel.content.channelHeader).not.toContainText(customStatus);
});

await test.step('update user1 custom status', async () => {
const user1Page = await browser.newPage({ storageState: Users.user1.state });
await user1Page.goto('/home');
const user1Channel = new HomeChannel(user1Page);
const user1Modal = new EditStatusModal(user1Page);

await user1Channel.sidenav.btnUserProfileMenu.click();
await user1Channel.sidenav.getUserProfileMenuOption('Custom Status').click();
await user1Modal.changeStatusMessage('new status');

await user1Channel.sidenav.changeUserCustomStatus(customStatus);
await user1Page.close();
});

await test.step('should user1 custom status be updated', async () => {
await poHomeChannel.sidenav.openChat('user1');

await expect(poHomeChannel.content.channelHeader).toContainText('new status');
await expect(poHomeChannel.content.channelHeader).toContainText(customStatus);
});
});

test('should be able to erase custom status', async ({ page }) => {
await poHomeChannel.sidenav.changeUserCustomStatus(customStatus);
await poHomeChannel.sidenav.btnUserProfileMenu.click();
await expect(poHomeChannel.sidenav.userProfileMenu).toContainText(customStatus);
await page.keyboard.press('Escape');

await poHomeChannel.sidenav.changeUserCustomStatus('');

await poHomeChannel.sidenav.btnUserProfileMenu.click();
await expect(poHomeChannel.sidenav.userProfileMenu).not.toContainText(customStatus);
});
});

test.describe('Login using with "Methods by REST" disabled', () => {
Expand Down
Loading