(e2e) reduce flakinees

- Because of parallel test execution, some tests
were flaky when using goToGridDoc, the title
changed between the time we got the document list
and the time we clicked on the document.
- Improve addChild function.
This commit is contained in:
Anthony LC
2025-10-17 22:44:35 +02:00
parent 2777488d24
commit 18feab10cb
3 changed files with 20 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';
import { createDoc, goToGridDoc, verifyDocName } from './utils-common';
import { createDoc, verifyDocName } from './utils-common';
import { addNewMember } from './utils-share';
test.beforeEach(async ({ page }) => {
@@ -8,8 +8,14 @@ test.beforeEach(async ({ page }) => {
});
test.describe('Document list members', () => {
test('it checks a big list of members', async ({ page }) => {
const docTitle = await goToGridDoc(page);
test('it checks a big list of members', async ({ page, browserName }) => {
const [docTitle] = await createDoc(
page,
'members-big-members-list',
browserName,
1,
);
await verifyDocName(page, docTitle);
// Get the current URL and extract the last part
@@ -73,7 +79,7 @@ test.describe('Document list members', () => {
await expect(loadMore).toBeHidden();
});
test('it checks a big list of invitations', async ({ page }) => {
test('it checks a big list of invitations', async ({ page, browserName }) => {
await page.route(
/.*\/documents\/.*\/invitations\/\?page=.*/,
async (route) => {
@@ -108,7 +114,12 @@ test.describe('Document list members', () => {
},
);
const docTitle = await goToGridDoc(page);
const [docTitle] = await createDoc(
page,
'members-big-invitation-list',
browserName,
1,
);
await verifyDocName(page, docTitle);
await page.getByRole('button', { name: 'Share' }).click();

View File

@@ -102,6 +102,7 @@ test.describe('Doc Trashbin', () => {
page,
browserName,
docParent: subDocName,
docName: 'my-trash-editor-subsubdoc',
});
await verifyDocName(page, subsubDocName);

View File

@@ -72,10 +72,12 @@ export const addChild = async ({
page,
browserName,
docParent,
docName,
}: {
page: Page;
browserName: BrowserName;
docParent: string;
docName: string;
}) => {
let item = page.getByTestId('doc-tree-root-item');
@@ -99,7 +101,7 @@ export const addChild = async ({
await item.hover();
await item.getByTestId('doc-tree-item-actions-add-child').click();
const [name] = randomName(docParent, browserName, 1);
const [name] = randomName(docName, browserName, 1);
await updateDocTitle(page, name);
return name;