✨(app-desk) modal update team
Integrate the modal and the logic to update a team.
This commit is contained in:
@@ -18,6 +18,15 @@ export const keyCloakSignIn = async (page: Page, browserName: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const randomTeamsName = (
|
||||
teamName: string,
|
||||
browserName: string,
|
||||
length: number,
|
||||
) =>
|
||||
Array.from({ length }, (_el, index) => {
|
||||
return `${teamName}-${browserName}-${Math.floor(Math.random() * 10000)}-${index}`;
|
||||
});
|
||||
|
||||
export const createTeam = async (
|
||||
page: Page,
|
||||
teamName: string,
|
||||
@@ -27,9 +36,7 @@ export const createTeam = async (
|
||||
const panel = page.getByLabel('Teams panel').first();
|
||||
const buttonCreate = page.getByRole('button', { name: 'Create the team' });
|
||||
|
||||
const randomTeams = Array.from({ length }, (_el, index) => {
|
||||
return `${teamName}-${browserName}-${Math.floor(Math.random() * 10000)}-${index}`;
|
||||
});
|
||||
const randomTeams = randomTeamsName(teamName, browserName, length);
|
||||
|
||||
for (let i = 0; i < randomTeams.length; i++) {
|
||||
await panel.getByRole('button', { name: 'Add a team' }).click();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
import { createTeam, keyCloakSignIn } from './common';
|
||||
import { createTeam, keyCloakSignIn, randomTeamsName } from './common';
|
||||
|
||||
test.beforeEach(async ({ page, browserName }) => {
|
||||
await page.goto('/');
|
||||
@@ -40,4 +40,22 @@ test.describe('Team', () => {
|
||||
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 modal`).click();
|
||||
|
||||
const teamName = randomTeamsName('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(`Add people to the “${teamName}“ group.`),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user