|
1 | 1 | import { Users } from './fixtures/userStates'; |
2 | 2 | import { HomeChannel } from './page-objects'; |
3 | | -import { createTargetChannel } from './utils'; |
| 3 | +import { createTargetChannel, sendTargetChannelMessage } from './utils'; |
4 | 4 | import { test, expect } from './utils/test'; |
5 | 5 |
|
6 | 6 | test.use({ storageState: Users.user2.state }); |
@@ -186,6 +186,47 @@ test.describe.serial('permissions', () => { |
186 | 186 | }); |
187 | 187 | }); |
188 | 188 |
|
| 189 | + test.describe.serial('Reply in direct message', () => { |
| 190 | + let replyDMChannel: string; |
| 191 | + |
| 192 | + test.beforeAll(async ({ api }) => { |
| 193 | + replyDMChannel = await createTargetChannel(api, { members: ['user2'] }); |
| 194 | + await sendTargetChannelMessage(api, replyDMChannel, { msg: 'message from admin for reply in DM' }); |
| 195 | + }); |
| 196 | + |
| 197 | + test('expect option (reply in direct message) not be visible without create-d permission and no existing DM', async ({ page, api }) => { |
| 198 | + expect((await api.post('/permissions.update', { permissions: [{ _id: 'create-d', roles: ['admin'] }] })).status()).toBe(200); |
| 199 | + |
| 200 | + await poHomeChannel.navbar.openChat(replyDMChannel); |
| 201 | + |
| 202 | + await expect(page.locator('.rcx-message', { hasText: 'message from admin for reply in DM' })).not.toHaveAttribute( |
| 203 | + 'aria-busy', |
| 204 | + 'true', |
| 205 | + ); |
| 206 | + |
| 207 | + await poHomeChannel.content.openLastMessageMenu(); |
| 208 | + await expect(page.locator('role=menuitem[name="Reply in direct message"]')).toBeHidden(); |
| 209 | + }); |
| 210 | + |
| 211 | + test('expect option (reply in direct message) be visible and redirect to DM', async ({ page, api }) => { |
| 212 | + expect( |
| 213 | + (await api.post('/permissions.update', { permissions: [{ _id: 'create-d', roles: ['admin', 'user', 'bot', 'app'] }] })).status(), |
| 214 | + ).toBe(200); |
| 215 | + |
| 216 | + await poHomeChannel.navbar.openChat(replyDMChannel); |
| 217 | + |
| 218 | + await expect(page.locator('.rcx-message', { hasText: 'message from admin for reply in DM' })).not.toHaveAttribute( |
| 219 | + 'aria-busy', |
| 220 | + 'true', |
| 221 | + ); |
| 222 | + |
| 223 | + await poHomeChannel.content.openLastMessageMenu(); |
| 224 | + await page.locator('role=menuitem[name="Reply in direct message"]').click(); |
| 225 | + |
| 226 | + await expect(page).toHaveURL(/.*reply/); |
| 227 | + }); |
| 228 | + }); |
| 229 | + |
189 | 230 | test.describe.serial('Filter words', () => { |
190 | 231 | test.beforeAll(async ({ api }) => { |
191 | 232 | const statusCode1 = (await api.post('/settings/Message_AllowBadWordsFilter', { value: true })).status(); |
|
0 commit comments