Skip to content

Commit 7f45068

Browse files
✅(frontend) enhance tests
- Removed 'feature/doc-dnd' branch from the Docker Hub workflow to streamline deployment processes. - Updated document creation tests to replace 'New page' button references with 'New doc' for consistency. - Enhanced test cases to improve clarity and ensure accurate verification of document functionalities. - Added new utility function for creating root subpages, improving test maintainability.
1 parent 8285121 commit 7f45068

File tree

12 files changed

+200
-284
lines changed

12 files changed

+200
-284
lines changed

.github/workflows/docker-hub.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
push:
77
branches:
88
- 'main'
9-
- 'feature/doc-dnd'
109
tags:
1110
- 'v*'
1211
pull_request:

env.d/development/common.e2e.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
BURST_THROTTLE_RATES="200/minute"
33
COLLABORATION_API_URL=http://y-provider:4444/collaboration/api/
44
SUSTAINED_THROTTLE_RATES="200/hour"
5-
Y_PROVIDER_API_BASE_URL=http://y-provider:4444/api/
5+
Y_PROVIDER_API_BASE_URL=http://y-provider:4444/api/
6+
THEME_CUSTOMIZATION_FILE_PATH="" #force theme_customization to be empty
7+
#COLLABORATION_API_URL=http://y-provider:4444/collaboration/api/
8+
#Y_PROVIDER_API_BASE_URL=http://y-provider:4444/api/
9+

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

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const createDoc = async (
9090

9191
await page
9292
.getByRole('button', {
93-
name: isChild ? 'New page' : 'New doc',
93+
name: 'New doc',
9494
})
9595
.click();
9696

@@ -220,6 +220,7 @@ export const updateDocTitle = async (page: Page, title: string) => {
220220
await input.click();
221221
await input.fill(title);
222222
await input.click();
223+
await input.blur();
223224
await verifyDocName(page, title);
224225
};
225226

@@ -302,48 +303,64 @@ export const mockedListDocs = async (page: Page, data: object[] = []) => {
302303
};
303304

304305
export const mockedInvitations = async (page: Page, json?: object) => {
306+
let result = [
307+
{
308+
id: '120ec765-43af-4602-83eb-7f4e1224548a',
309+
abilities: {
310+
destroy: true,
311+
update: true,
312+
partial_update: true,
313+
retrieve: true,
314+
},
315+
created_at: '2024-10-03T12:19:26.107687Z',
316+
317+
document: '4888c328-8406-4412-9b0b-c0ba5b9e5fb6',
318+
role: 'editor',
319+
issuer: '7380f42f-02eb-4ad5-b8f0-037a0e66066d',
320+
is_expired: false,
321+
...json,
322+
},
323+
];
305324
await page.route('**/invitations/**/', async (route) => {
306325
const request = route.request();
307326
if (
308327
request.method().includes('GET') &&
309328
request.url().includes('invitations') &&
310329
request.url().includes('page=')
311330
) {
331+
console.log('GET');
312332
await route.fulfill({
313333
json: {
314334
count: 1,
315335
next: null,
316336
previous: null,
317-
results: [
318-
{
319-
id: '120ec765-43af-4602-83eb-7f4e1224548a',
320-
abilities: {
321-
destroy: true,
322-
update: true,
323-
partial_update: true,
324-
retrieve: true,
325-
},
326-
created_at: '2024-10-03T12:19:26.107687Z',
327-
328-
document: '4888c328-8406-4412-9b0b-c0ba5b9e5fb6',
329-
role: 'editor',
330-
issuer: '7380f42f-02eb-4ad5-b8f0-037a0e66066d',
331-
is_expired: false,
332-
...json,
333-
},
334-
],
337+
results: result,
335338
},
336339
});
337340
} else {
338341
await route.continue();
339342
}
340343
});
344+
345+
await page.route(
346+
'**/invitations/120ec765-43af-4602-83eb-7f4e1224548a/**/',
347+
async (route) => {
348+
const request = route.request();
349+
if (request.method().includes('DELETE')) {
350+
result = [];
351+
352+
await route.fulfill({
353+
json: {},
354+
});
355+
}
356+
},
357+
);
341358
};
342359

343360
export const mockedAccesses = async (page: Page, json?: object) => {
344361
await page.route('**/accesses/**/', async (route) => {
345362
const request = route.request();
346-
console.log('oui');
363+
347364
if (
348365
request.method().includes('GET') &&
349366
request.url().includes('accesses')

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ test.describe('Doc Export', () => {
7272
await page
7373
.getByRole('button', {
7474
name: 'download',
75+
exact: true,
7576
})
7677
.click();
7778

@@ -82,6 +83,7 @@ test.describe('Doc Export', () => {
8283
void page
8384
.getByRole('button', {
8485
name: 'Download',
86+
exact: true,
8587
})
8688
.click();
8789

@@ -120,6 +122,7 @@ test.describe('Doc Export', () => {
120122
await page
121123
.getByRole('button', {
122124
name: 'download',
125+
exact: true,
123126
})
124127
.click();
125128

@@ -129,6 +132,7 @@ test.describe('Doc Export', () => {
129132
await expect(
130133
page.getByRole('button', {
131134
name: 'Download',
135+
exact: true,
132136
}),
133137
).toBeVisible();
134138

@@ -139,6 +143,7 @@ test.describe('Doc Export', () => {
139143
void page
140144
.getByRole('button', {
141145
name: 'Download',
146+
exact: true,
142147
})
143148
.click();
144149

@@ -312,12 +317,14 @@ test.describe('Doc Export', () => {
312317
await page
313318
.getByRole('button', {
314319
name: 'download',
320+
exact: true,
315321
})
316322
.click();
317323

318324
await expect(
319325
page.getByRole('button', {
320326
name: 'Download',
327+
exact: true,
321328
}),
322329
).toBeVisible();
323330

@@ -328,6 +335,7 @@ test.describe('Doc Export', () => {
328335
void page
329336
.getByRole('button', {
330337
name: 'Download',
338+
exact: true,
331339
})
332340
.click();
333341

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ test.describe('Documents filters', () => {
226226

227227
await allDocs.click();
228228

229+
await page.waitForURL('**/?target=all_docs');
230+
229231
let url = new URL(page.url());
230232
let target = url.searchParams.get('target');
231233
expect(target).toBe('all_docs');

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test.describe('Doc Header', () => {
9898

9999
await expect(
100100
page.getByText(
101-
`Are you sure you want to delete the document "${randomDoc}"?`,
101+
`This document will be permanently deleted. This action is irreversible.`,
102102
),
103103
).toBeVisible();
104104

@@ -161,32 +161,31 @@ test.describe('Doc Header', () => {
161161
await expect(shareModal).toBeVisible();
162162
await expect(page.getByText('Share the document')).toBeVisible();
163163

164-
// await expect(page.getByPlaceholder('Type a name or email')).toBeVisible();
165-
166164
const invitationCard = shareModal.getByLabel('List invitation card');
167165
await expect(invitationCard).toBeVisible();
168166
await expect(
169167
invitationCard.getByText('[email protected]').first(),
170168
).toBeVisible();
171-
await expect(invitationCard.getByLabel('doc-role-dropdown')).toBeVisible();
169+
const invitationRole = invitationCard.getByLabel('doc-role-dropdown');
170+
await expect(invitationRole).toBeVisible();
172171

173-
await invitationCard.getByRole('button', { name: 'more_horiz' }).click();
172+
await invitationRole.click();
174173

175-
await expect(page.getByLabel('Delete')).toBeEnabled();
176-
await invitationCard.click();
174+
await page.getByRole('menuitem', { name: 'Remove access' }).click();
175+
await expect(invitationCard).toBeHidden();
177176

178177
const memberCard = shareModal.getByLabel('List members card');
178+
const roles = memberCard.getByLabel('doc-role-dropdown');
179179
await expect(memberCard).toBeVisible();
180180
await expect(
181181
memberCard.getByText('[email protected]').first(),
182182
).toBeVisible();
183-
await expect(memberCard.getByLabel('doc-role-dropdown')).toBeVisible();
184-
await expect(
185-
memberCard.getByRole('button', { name: 'more_horiz' }),
186-
).toBeVisible();
187-
await memberCard.getByRole('button', { name: 'more_horiz' }).click();
183+
await expect(roles).toBeVisible();
188184

189-
await expect(page.getByLabel('Delete')).toBeEnabled();
185+
await roles.click();
186+
await expect(
187+
page.getByRole('menuitem', { name: 'Remove access' }),
188+
).toBeEnabled();
190189
});
191190

192191
test('it checks the options available if editor', async ({ page }) => {

0 commit comments

Comments
 (0)