From 1e0f62c7bd6c2a17ac8ad3376df294b4d0a6f2b3 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Wed, 24 Sep 2025 12:37:34 +0200 Subject: [PATCH] test: move ParticipantNameService tests to integration tests --- .../participants}/participant-name.service.test.ts | 11 ++++------- frontend/webcomponent/tests/e2e/core/room.test.ts | 1 - .../webcomponent/tests/helpers/function-helpers.ts | 6 ++++-- 3 files changed, 8 insertions(+), 10 deletions(-) rename backend/tests/{unit/services => integration/api/participants}/participant-name.service.test.ts (96%) diff --git a/backend/tests/unit/services/participant-name.service.test.ts b/backend/tests/integration/api/participants/participant-name.service.test.ts similarity index 96% rename from backend/tests/unit/services/participant-name.service.test.ts rename to backend/tests/integration/api/participants/participant-name.service.test.ts index db08159..25f3ef6 100644 --- a/backend/tests/unit/services/participant-name.service.test.ts +++ b/backend/tests/integration/api/participants/participant-name.service.test.ts @@ -1,8 +1,8 @@ -import { describe, expect, it, beforeEach, afterEach, beforeAll } from '@jest/globals'; -import { container, registerDependencies } from '../../../src/config/index.js'; -import { ParticipantNameService } from '../../../src/services/participant-name.service.js'; -import { RedisService } from '../../../src/services/redis.service.js'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; import ms from 'ms'; +import { container, registerDependencies } from '../../../../src/config/index.js'; +import { ParticipantNameService } from '../../../../src/services/participant-name.service.js'; +import { RedisService } from '../../../../src/services/redis.service.js'; describe('ParticipantNameService', () => { let participantNameService: ParticipantNameService; @@ -13,10 +13,7 @@ describe('ParticipantNameService', () => { registerDependencies(); participantNameService = container.get(ParticipantNameService); redisService = container.get(RedisService); - }); - beforeEach(async () => { - // Clean up any existing test data await cleanupTestData(); }); diff --git a/frontend/webcomponent/tests/e2e/core/room.test.ts b/frontend/webcomponent/tests/e2e/core/room.test.ts index 08b44e3..03031de 100644 --- a/frontend/webcomponent/tests/e2e/core/room.test.ts +++ b/frontend/webcomponent/tests/e2e/core/room.test.ts @@ -276,7 +276,6 @@ test.describe('Room Functionality Tests', () => { fs.unlinkSync('after.png'); fs.unlinkSync('diff.png'); - await page.waitForTimeout(3000); await leaveRoom(page); }); }); diff --git a/frontend/webcomponent/tests/helpers/function-helpers.ts b/frontend/webcomponent/tests/helpers/function-helpers.ts index d85c781..ca44419 100644 --- a/frontend/webcomponent/tests/helpers/function-helpers.ts +++ b/frontend/webcomponent/tests/helpers/function-helpers.ts @@ -256,11 +256,13 @@ export const viewRecordingsAs = async (role: 'moderator' | 'speaker', page: Page }; export const leaveRoom = async (page: Page, role: 'moderator' | 'speaker' = 'speaker') => { - await interactWithElementInIframe(page, '#leave-btn', { action: 'click' }); + const button = await waitForElementInIframe(page, '#leave-btn'); + await button.click(); if (role === 'moderator') { await page.waitForTimeout(500); // Wait for leave animation - await interactWithElementInIframe(page, '#leave-option', { action: 'click' }); + const option = await waitForElementInIframe(page, '#leave-option'); + await option.click(); } await page.waitForSelector('.event-left');