This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
people/src/frontend/apps/e2e/__tests__/app-desk/config.spec.ts
Sabrina Demagny 017f52a0dc (api) add RELEASE version on config endpoint
Add release version deployed to config endpoint
in order to display release info in La Régie footer.
2024-10-14 14:57:28 +02:00

65 lines
1.6 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { keyCloakSignIn } from './common';
test.describe('Config', () => {
test.beforeEach(async ({ page, browserName }) => {
await page.goto('/');
await keyCloakSignIn(page, browserName);
});
test('it checks the config api is called', async ({ page }) => {
const responsePromise = page.waitForResponse(
(response) =>
response.url().includes('/config/') && response.status() === 200,
);
const response = await responsePromise;
expect(response.ok()).toBeTruthy();
expect(await response.json()).toStrictEqual({
LANGUAGES: [
['en-us', 'English'],
['fr-fr', 'French'],
],
FEATURES: { TEAMS: true },
RELEASE: 'NA',
});
});
test('it checks that the config can deactivate the feature "teams"', async ({
page,
}) => {
await page.route('**/api/v1.0/config/', async (route) => {
const request = route.request();
if (request.method().includes('GET')) {
await route.fulfill({
json: {
LANGUAGES: [
['en-us', 'English'],
['fr-fr', 'French'],
],
FEATURES: { TEAMS: false },
},
});
} else {
await route.continue();
}
});
await expect(page.locator('menu')).toBeHidden();
await expect(
page.getByRole('button', {
name: 'Create a new team',
}),
).toBeHidden();
await expect(
page.getByRole('button', {
name: 'Add a mail domain',
}),
).toBeVisible();
});
});