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/team.spec.ts
daproclaima b69ce001c8 (frontend) allow group members filtering
- add title above the list of members
- allow members filtering  with an input
- updates translations and related tests
- add global useDebounce hook to prevent
spamming API with useless requests on
inputs sending requests on value change
- add component and e2e tests
2024-09-26 18:09:31 +02:00

76 lines
2.3 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { createTeam, keyCloakSignIn, randomName } from './common';
test.beforeEach(async ({ page, browserName }) => {
await page.goto('/');
await keyCloakSignIn(page, browserName);
});
test.describe('Team', () => {
test('checks all the top box elements are visible', async ({
page,
browserName,
}) => {
const teamName = (
await createTeam(page, 'team-top-box', browserName, 1)
).shift();
await expect(page.getByText('Group members')).toBeVisible();
await expect(page.getByLabel('Filter member list')).toBeVisible();
await expect(
page.getByRole('heading', {
name: teamName,
level: 3,
}),
).toBeVisible();
await expect(page.getByText(`Group details`)).toBeVisible();
await expect(page.getByText(`1 member`)).toBeVisible();
const today = new Date(Date.now());
const todayFormated = today.toLocaleDateString('en', {
month: '2-digit',
day: '2-digit',
year: 'numeric',
});
await expect(page.getByText(`Created at ${todayFormated}`)).toBeVisible();
await expect(
page.getByText(`Last update at ${todayFormated}`),
).toBeVisible();
});
test('it updates the team name', async ({ page, browserName }) => {
await createTeam(page, 'team-update-name', browserName, 1);
await page.getByLabel(`Open the team options`).click();
await page.getByRole('button', { name: `Update the team` }).click();
const teamName = randomName('new-team-update-name', browserName, 1)[0];
await page.getByText('New name...', { exact: true }).fill(teamName);
await page
.getByRole('button', { name: 'Validate the modification' })
.click();
await expect(page.getByText('The team has been updated.')).toBeVisible();
await expect(page.getByText(`Group details`)).toBeVisible();
});
test('sorts group members by search term', async ({
page,
browserName,
request,
}) => {
await createTeam(page, 'team-to-sort', browserName, 1);
await page.getByLabel(`Open the team options`).click();
await page.getByLabel('Filter member list').fill('term-to-search');
const response = await request.get('teams/?page=1&q=term-to-search');
expect(response.ok()).toBeTruthy();
});
});