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 1s
72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
import type { CalendarEventImportProps } from '@rocket.chat/rest-typings';
|
|
|
|
import { Users } from './fixtures/userStates';
|
|
import { HomeChannel } from './page-objects';
|
|
import { test, expect, type BaseTest } from './utils/test';
|
|
import { links } from '../../client/lib/links';
|
|
|
|
test.use({ storageState: Users.admin.state });
|
|
|
|
// TODO: Make this test run on CI - it's slow and requires an open browser, run manually for now.
|
|
test.describe.skip('Calendar', () => {
|
|
test.beforeAll(async ({ api }) => {
|
|
expect((await api.post('/settings/Calendar_BusyStatus_Enabled', { value: true })).status()).toBe(200);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
expect((await api.post('/settings/Calendar_BusyStatus_Enabled', { value: false })).status()).toBe(200);
|
|
});
|
|
|
|
test.describe('Status changes', () => {
|
|
test.beforeEach(async ({ page, api }) => {
|
|
expect((await api.post('/users.setStatus', { status: 'away', message: '' })).status()).toBe(200);
|
|
await new HomeChannel(page).goto();
|
|
});
|
|
|
|
test('Should change user status back to away when there are overlapping imported events', async ({ page, api }) => {
|
|
await expect(page.getByRole('button', { name: 'User menu' }).getByRole('status')).toHaveAccessibleName('away');
|
|
|
|
const event1 = await importCalendarEvent(api, { start: 1, end: 2 });
|
|
await importCalendarEvent(api, { start: 1.5, end: 2.5 });
|
|
const event3 = await importCalendarEvent(api, { start: 2.5, end: 3 });
|
|
|
|
await test.step('Should change status to busy', async () => {
|
|
await expect(page.getByRole('button', { name: 'User menu' }).getByRole('status')).toHaveAccessibleName('busy', {
|
|
timeout: event1.endTime.getTime() - Date.now(),
|
|
});
|
|
});
|
|
|
|
await test.step('Should change status to away again', async () => {
|
|
await expect(page.getByRole('button', { name: 'User menu' }).getByRole('status')).toHaveAccessibleName('away', {
|
|
timeout: event3.endTime.getTime() - Date.now() + 1000,
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
async function importCalendarEvent(api: BaseTest['api'], { now = Date.now(), start = 2, end = 4 } = {}) {
|
|
const startTime = new Date(now + 1000 * 60 * start);
|
|
const endTime = new Date(now + 1000 * 60 * end);
|
|
|
|
const apiResponse = await api.post('/calendar-events.import', {
|
|
startTime: startTime.toISOString(),
|
|
endTime: endTime.toISOString(),
|
|
subject: 'Test appointment',
|
|
description: 'Test appointment description',
|
|
meetingUrl: links.rocketChat,
|
|
busy: true,
|
|
externalId: `test-${start}-${end}-${now}`,
|
|
} satisfies CalendarEventImportProps);
|
|
|
|
expect(apiResponse.status()).toBe(200);
|
|
|
|
const { id } = await apiResponse.json();
|
|
|
|
if (typeof id !== 'string') {
|
|
throw new Error(`Expected id to be a string, but got ${typeof id}`);
|
|
}
|
|
|
|
return { startTime, endTime, now, id };
|
|
}
|