diff --git a/apps/meteor/client/components/message/variants/RoomMessage.tsx b/apps/meteor/client/components/message/variants/RoomMessage.tsx index f3071b9195c..38c84f6ec71 100644 --- a/apps/meteor/client/components/message/variants/RoomMessage.tsx +++ b/apps/meteor/client/components/message/variants/RoomMessage.tsx @@ -59,6 +59,7 @@ const RoomMessage = ({ message, sequential, all, mention, unread, context, ignor data-sequential={sequential} data-own={message.u._id === uid} data-qa-type='message' + aria-busy={message.temp} > {!sequential && message.u.username && !selecting && ( diff --git a/apps/meteor/tests/e2e/permissions.spec.ts b/apps/meteor/tests/e2e/permissions.spec.ts index cbe02732de9..c076ab04ec3 100644 --- a/apps/meteor/tests/e2e/permissions.spec.ts +++ b/apps/meteor/tests/e2e/permissions.spec.ts @@ -22,21 +22,25 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowEditing', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); - test('expect option(edit) not be visible', async () => { + test('expect option(edit) not be visible', async ({ page }) => { await poHomeChannel.sidenav.openChat(targetChannel); - await poHomeChannel.content.sendMessage('any_message'); - await poHomeChannel.content.openLastMessageMenu(); + await poHomeChannel.content.sendMessage('expect option(edit) not be visible'); + await expect(page.locator('.rcx-message', { hasText: 'expect option(edit) not be visible' })).not.toHaveAttribute( + 'aria-busy', + 'true', + ); + await poHomeChannel.content.openLastMessageMenu(); await expect(poHomeChannel.content.btnOptionEditMessage).toBeHidden(); }); test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowEditing', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -44,12 +48,18 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowDeleting', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); - test('expect option(delete) not be visible', async () => { + test('expect option(delete) not be visible', async ({ page }) => { await poHomeChannel.sidenav.openChat(targetChannel); - await poHomeChannel.content.sendMessage('any_message'); + await poHomeChannel.content.sendMessage('expect option(delete) not be visible'); + + await expect(page.locator('.rcx-message', { hasText: 'expect option(delete) not be visible' })).not.toHaveAttribute( + 'aria-busy', + 'true', + ); + await poHomeChannel.content.openLastMessageMenu(); await expect(poHomeChannel.content.btnOptionDeleteMessage).toBeHidden(); @@ -58,7 +68,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowDeleting', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -68,12 +78,14 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowPinning', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); - test('expect option(pin) not be visible', async () => { + test('expect option(pin) not be visible', async ({ page }) => { await poHomeChannel.sidenav.openChat(targetChannel); - await poHomeChannel.content.sendMessage('any_message'); + await poHomeChannel.content.sendMessage('expect option(pin) not be visible'); + + await expect(page.locator('.rcx-message', { hasText: 'expect option(pin) not be visible' })).not.toHaveAttribute('aria-busy', 'true'); await poHomeChannel.content.openLastMessageMenu(); await expect(poHomeChannel.content.btnOptionPinMessage).toBeHidden(); @@ -82,7 +94,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowPinning', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -92,12 +104,17 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowStarring', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); - test('expect option(star) not be visible', async () => { + test('expect option(star) not be visible', async ({ page }) => { await poHomeChannel.sidenav.openChat(targetChannel); - await poHomeChannel.content.sendMessage('any_message'); + await poHomeChannel.content.sendMessage('expect option(star) not be visible'); + + await expect(page.locator('.rcx-message', { hasText: 'expect option(star) not be visible' })).not.toHaveAttribute( + 'aria-busy', + 'true', + ); await poHomeChannel.content.openLastMessageMenu(); await expect(poHomeChannel.content.btnOptionStarMessage).toBeHidden(); @@ -106,7 +123,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowStarring', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -114,7 +131,7 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/FileUpload_Enabled', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); test('expect option (upload file) not be visible', async () => { @@ -125,7 +142,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/FileUpload_Enabled', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -133,7 +150,7 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AudioRecorderEnabled', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); test('expect option (upload audio) not be visible', async () => { @@ -144,7 +161,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AudioRecorderEnabled', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -152,7 +169,7 @@ test.describe.serial('permissions', () => { test.beforeAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_VideoRecorderEnabled', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); test('expect option (upload video) not be visible', async () => { @@ -163,7 +180,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_VideoRecorderEnabled', { value: true })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); @@ -172,8 +189,8 @@ test.describe.serial('permissions', () => { const statusCode1 = (await api.post('/settings/Message_AllowBadWordsFilter', { value: true })).status(); const statusCode2 = (await api.post('/settings/Message_BadWordsFilterList', { value: 'badword' })).status(); - expect(statusCode1).toBe(200); - expect(statusCode2).toBe(200); + await expect(statusCode1).toBe(200); + await expect(statusCode2).toBe(200); }); test('expect badword be censored', async () => { @@ -186,7 +203,7 @@ test.describe.serial('permissions', () => { test.afterAll(async ({ api }) => { const statusCode = (await api.post('/settings/Message_AllowBadWordsFilter', { value: false })).status(); - expect(statusCode).toBe(200); + await expect(statusCode).toBe(200); }); }); });