Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 2s
99 lines
3.4 KiB
TypeScript
99 lines
3.4 KiB
TypeScript
import { Users } from './fixtures/userStates';
|
|
import { HomeChannel } from './page-objects';
|
|
import { createTargetChannel, createTargetPrivateChannel, createDirectMessage } from './utils';
|
|
import { setSettingValueById } from './utils/setSettingValueById';
|
|
import { test, expect } from './utils/test';
|
|
|
|
test.use({ storageState: Users.admin.state });
|
|
|
|
const testAvatars = (homeChannel: HomeChannel, channel: string, url: string) => {
|
|
test('expect sidebar avatar to have provider prefix', async () => {
|
|
expect(homeChannel.sidebar.getSidebarItemByName(channel).locator('img').getAttribute('src')).toBe(url);
|
|
});
|
|
|
|
test('expect channel header avatar to have provider prefix', async () => {
|
|
await homeChannel.navbar.openChat(channel);
|
|
expect(homeChannel.content.channelHeader.locator('img').getAttribute('src')).toBe(url);
|
|
});
|
|
|
|
test('expect channel info avatar to have provider prefix', async () => {
|
|
await homeChannel.navbar.openChat(channel);
|
|
expect(homeChannel.content.channelHeader.locator('img').getAttribute('src')).toBe(url);
|
|
});
|
|
};
|
|
|
|
test.describe('avatar-settings', () => {
|
|
let poHomeChannel: HomeChannel;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
poHomeChannel = new HomeChannel(page);
|
|
|
|
await poHomeChannel.goto();
|
|
});
|
|
|
|
test.describe('external avatar provider', () => {
|
|
const providerUrlPrefix = 'https://example.com/avatar/';
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
await setSettingValueById(api, 'Accounts_RoomAvatarExternalUrl', `${providerUrlPrefix}{username}`);
|
|
await setSettingValueById(api, 'Accounts_AvatarExternalUrl', `${providerUrlPrefix}{username}`);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await setSettingValueById(api, 'Accounts_RoomAvatarExternalUrl', '');
|
|
await setSettingValueById(api, 'Accounts_AvatarExternalUrl', '');
|
|
});
|
|
|
|
test.describe('public channels', () => {
|
|
let channelName = '';
|
|
let avatarUrl = '';
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
channelName = await createTargetChannel(api);
|
|
avatarUrl = `${providerUrlPrefix}${channelName}`;
|
|
});
|
|
|
|
testAvatars(poHomeChannel, channelName, avatarUrl);
|
|
});
|
|
|
|
test.describe('private channels', () => {
|
|
let channelName = '';
|
|
let avatarUrl = '';
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
channelName = await createTargetPrivateChannel(api);
|
|
avatarUrl = `${providerUrlPrefix}${channelName}`;
|
|
});
|
|
|
|
testAvatars(poHomeChannel, channelName, avatarUrl);
|
|
});
|
|
|
|
test.describe('direct messages', () => {
|
|
const channelName = Users.user2.data.username;
|
|
const avatarUrl = `${providerUrlPrefix}${channelName}`;
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
await createDirectMessage(api);
|
|
|
|
// send a message as user 2
|
|
test.use({ storageState: Users.user2.state });
|
|
await poHomeChannel.navbar.openChat(Users.user1.data.username);
|
|
await poHomeChannel.content.sendMessage('hello world');
|
|
|
|
test.use({ storageState: Users.user1.state });
|
|
});
|
|
|
|
testAvatars(poHomeChannel, channelName, avatarUrl);
|
|
|
|
test('expect message avatar to have provider prefix', async () => {
|
|
await expect(poHomeChannel.content.lastUserMessage.locator('img')).toHaveAttribute('src', avatarUrl);
|
|
});
|
|
|
|
test('expect user card avatar to have provider prefix', async () => {
|
|
await poHomeChannel.content.lastUserMessage.locator('.rcx-message-header__name-container').click();
|
|
await expect(poHomeChannel.userCard.imgUserCard).toHaveAttribute('src', avatarUrl);
|
|
});
|
|
});
|
|
});
|
|
});
|