♻️(frontend) delete infinite scroll

In order to be in agreement with the back, we must modify the front
so as to no longer have infinite scroll in the team part.
It is also necessary to modify the tests accordingly
This commit is contained in:
Nathan Panchout
2024-10-30 20:35:10 +01:00
parent 7d695ab81c
commit 20a19d36b5
7 changed files with 61 additions and 158 deletions

View File

@@ -26,9 +26,9 @@ const payloadGetTeams = {
};
const mockApiRequests = (page: Page) => {
void page.route('**/teams/?page=1&ordering=-created_at', (route) => {
void page.route('**/teams/?ordering=-created_at', (route) => {
void route.fulfill({
json: payloadGetTeams,
json: payloadGetTeams.results,
});
});
};

View File

@@ -1,7 +1,5 @@
import { expect, test } from '@playwright/test';
import { waitForElementCount } from '../helpers';
import { createTeam, keyCloakSignIn } from './common';
test.beforeEach(async ({ page, browserName }) => {
@@ -31,13 +29,13 @@ test.describe('Teams Panel', () => {
test('checks the sort button', async ({ page }) => {
const responsePromiseSortDesc = page.waitForResponse(
(response) =>
response.url().includes('/teams/?page=1&ordering=-created_at') &&
response.url().includes('/teams/?ordering=-created_at') &&
response.status() === 200,
);
const responsePromiseSortAsc = page.waitForResponse(
(response) =>
response.url().includes('/teams/?page=1&ordering=created_at') &&
response.url().includes('/teams/?ordering=created_at') &&
response.status() === 200,
);
@@ -62,24 +60,6 @@ test.describe('Teams Panel', () => {
expect(responseSortDesc.ok()).toBeTruthy();
});
test('checks the infinite scroll', async ({ page, browserName }) => {
test.setTimeout(90000);
const panel = page.getByLabel('Teams panel').first();
const randomTeams = await createTeam(
page,
'team-infinite',
browserName,
40,
);
await expect(panel.locator('li')).toHaveCount(20);
await panel.getByText(randomTeams[24]).click();
await waitForElementCount(panel.locator('li'), 21, 10000);
expect(await panel.locator('li').count()).toBeGreaterThan(20);
});
test('checks the hover and selected state', async ({ page, browserName }) => {
const panel = page.getByLabel('Teams panel').first();
await createTeam(page, 'team-hover', browserName, 2);