Skip to content

Commit c10ae98

Browse files
✨(frontend) update test descriptions for clarity and consistency
- update tests description - Corrected minor typos in test descriptions to enhance readability. - Ensured that all test cases clearly convey their purpose and expected outcomes.
1 parent 5698a04 commit c10ae98

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
lines changed

src/frontend/apps/e2e/__tests__/app-impress/common.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ export const mockedDocument = async (page: Page, data: object) => {
217217
!request.url().includes('accesses') &&
218218
!request.url().includes('invitations')
219219
) {
220+
const { abilities, ...rest } = data as unknown as {
221+
abilities?: Record<string, unknown>;
222+
};
220223
await route.fulfill({
221224
json: {
222225
id: 'mocked-document-id',
@@ -238,6 +241,7 @@ export const mockedDocument = async (page: Page, data: object) => {
238241
authenticated: ['reader', 'editor'],
239242
restricted: null,
240243
},
244+
...abilities,
241245
},
242246
link_reach: 'restricted',
243247
computed_link_reach: 'restricted',
@@ -247,7 +251,7 @@ export const mockedDocument = async (page: Page, data: object) => {
247251
created_at: '2021-09-01T09:00:00Z',
248252
user_role: 'owner',
249253
user_roles: ['owner'],
250-
...data,
254+
...rest,
251255
},
252256
});
253257
} else {
@@ -314,10 +318,10 @@ export const mockedInvitations = async (page: Page, json?: object) => {
314318
export const mockedAccesses = async (page: Page, json?: object) => {
315319
await page.route('**/accesses/**/', async (route) => {
316320
const request = route.request();
321+
console.log('oui');
317322
if (
318323
request.method().includes('GET') &&
319-
request.url().includes('accesses') &&
320-
request.url().includes('page=')
324+
request.url().includes('accesses')
321325
) {
322326
await route.fulfill({
323327
json: [
@@ -341,6 +345,11 @@ export const mockedAccesses = async (page: Page, json?: object) => {
341345
update: true,
342346
partial_update: true,
343347
retrieve: true,
348+
link_select_options: {
349+
public: ['reader', 'editor'],
350+
authenticated: ['reader', 'editor'],
351+
restricted: null,
352+
},
344353
set_role_to: ['administrator', 'editor'],
345354
},
346355
...json,

src/frontend/apps/e2e/__tests__/app-impress/doc-grid-dnd.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.describe('Doc grid dnd', () => {
5050
await page.mouse.move(
5151
dropZoneBoundingBox.x + dropZoneBoundingBox.width / 2,
5252
dropZoneBoundingBox.y + dropZoneBoundingBox.height / 2,
53-
{ steps: 10 }, // Rendre le mouvement plus fluide
53+
{ steps: 10 }, // Make the movement smoother
5454
);
5555

5656
const dragOverlay = page.getByTestId('drag-doc-overlay');
@@ -62,7 +62,7 @@ test.describe('Doc grid dnd', () => {
6262
await expect(dragOverlay).toBeHidden();
6363
});
6464

65-
test('it checks cant drop when we have not the minimum role', async ({
65+
test("it checks can't drop when we have not the minimum role", async ({
6666
page,
6767
}) => {
6868
await mockedListDocs(page, data);
@@ -113,7 +113,7 @@ test.describe('Doc grid dnd', () => {
113113
await page.mouse.up();
114114
});
115115

116-
test('it checks cant drag when we have not the minimum role', async ({
116+
test("it checks can't drag when we have not the minimum role", async ({
117117
page,
118118
}) => {
119119
await mockedListDocs(page, data);

src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ test.describe('Doc Header', () => {
136136
versions_list: true,
137137
versions_retrieve: true,
138138
update: true,
139-
link_select_options: {
140-
public: ['reader', 'editor'],
141-
authenticated: ['reader', 'editor'],
142-
restricted: null,
143-
},
144139
partial_update: true,
145140
retrieve: true,
146141
},

src/frontend/apps/e2e/__tests__/app-impress/doc-inherited-share.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { createRootSubPage, createSubPageFromParent } from './sub-pages-utils';
1515

1616
test.describe('Inherited share accesses', () => {
17-
test('Vérifie l’héritage des accès', async ({ page, browserName }) => {
17+
test('it checks inherited accesses', async ({ page, browserName }) => {
1818
await page.goto('/');
1919
const [titleParent] = await createDoc(page, 'root-doc', browserName, 1);
2020
const docTree = page.getByTestId('doc-tree');
@@ -53,7 +53,7 @@ test.describe('Inherited share accesses', () => {
5353
await expect(user.getByText('Owner')).toBeVisible();
5454
});
5555

56-
test('Vérifie le message si il y a un accès hérité', async ({
56+
test('it checks that the highest role is displayed', async ({
5757
page,
5858
browserName,
5959
}) => {
@@ -107,7 +107,7 @@ test.describe('Inherited share accesses', () => {
107107
});
108108

109109
test.describe('Inherited share link', () => {
110-
test('Vérifie si le lien est bien hérité', async ({ page, browserName }) => {
110+
test('it checks if the link is inherited', async ({ page, browserName }) => {
111111
await page.goto('/');
112112
// Create root doc
113113
await createDoc(page, 'root-doc', browserName, 1);
@@ -126,7 +126,7 @@ test.describe('Inherited share link', () => {
126126
// await verifyShareLink(page, 'Connected', 'Reading');
127127
});
128128

129-
test('Vérification du message de warning lorsque les règles de partage diffèrent', async ({
129+
test('it checks warning message when sharing rules differ', async ({
130130
page,
131131
browserName,
132132
}) => {
@@ -155,7 +155,7 @@ test.describe('Inherited share link', () => {
155155
await expect(page.getByText('Sharing rules differ from the')).toBeHidden();
156156
});
157157

158-
test('Vérification des possibilités de liens hérités', async ({
158+
test('it checks inherited link possibilities', async ({
159159
page,
160160
browserName,
161161
}) => {

src/frontend/apps/e2e/__tests__/app-impress/doc-search.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ test.describe('Document search', () => {
113113
});
114114

115115
test.describe('Sub page search', () => {
116-
test('it check the precense of filters in search modal', async ({
116+
test('it check the presence of filters in search modal', async ({
117117
page,
118118
browserName,
119119
}) => {

src/frontend/apps/e2e/__tests__/app-impress/doc-tree.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ test.describe('Doc Tree', () => {
160160
);
161161
});
162162

163-
test('it detachs a document', async ({ page, browserName }) => {
163+
test('it detaches a document', async ({ page, browserName }) => {
164164
await page.goto('/');
165165
const [docParent] = await createDoc(
166166
page,

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocTree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const DocTree = ({ initialTargetId }: DocTreeProps) => {
122122

123123
treeContext?.treeData.setSelectedNode(currentDoc);
124124

125-
// we don't need to run this effect on every change of treeContext.data bacause it cause an infinite loop
125+
// we don't need to run this effect on every change of treeContext.data because it cause an infinite loop
126126
// eslint-disable-next-line react-hooks/exhaustive-deps
127127
}, [currentDoc, rootNode?.id]);
128128

0 commit comments

Comments
 (0)