Skip to content

Commit 38c4aea

Browse files
wip
1 parent d22c987 commit 38c4aea

30 files changed

+1180
-189
lines changed

Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ build: cache ?= --no-cache
9393
build: ## build the project containers
9494
@$(MAKE) build-backend cache=$(cache)
9595
@$(MAKE) build-yjs-provider cache=$(cache)
96-
@$(MAKE) build-frontend cache=$(cache)
9796
.PHONY: build
9897

9998
build-backend: cache ?=
@@ -128,7 +127,6 @@ run-backend: ## Start only the backend application and all needed services
128127
run: ## start the wsgi (production) and development server
129128
run:
130129
@$(MAKE) run-backend
131-
@$(COMPOSE) up --force-recreate -d frontend
132130
.PHONY: run
133131

134132
status: ## an alias for "docker compose ps"

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

+57-26
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,26 @@ export const goToGridDoc = async (
188188
return docTitle as string;
189189
};
190190

191-
export const mockedDocument = async (page: Page, json: object) => {
191+
export const updateDocTitle = async (page: Page, title: string) => {
192+
const input = page.getByLabel('doc title input');
193+
await expect(input).toBeVisible();
194+
await expect(input).toHaveText('');
195+
await input.click();
196+
await input.fill(title);
197+
await input.click();
198+
await verifyDocName(page, title);
199+
};
200+
201+
export const getWaitForCreateDoc = (page: Page) => {
202+
return page.waitForResponse(
203+
(response) =>
204+
response.url().includes('/documents/') &&
205+
response.url().includes('/children/') &&
206+
response.request().method() === 'POST',
207+
);
208+
};
209+
210+
export const mockedDocument = async (page: Page, data: object) => {
192211
await page.route('**/documents/**/', async (route) => {
193212
const request = route.request();
194213
if (
@@ -203,7 +222,7 @@ export const mockedDocument = async (page: Page, json: object) => {
203222
id: 'mocked-document-id',
204223
content: '',
205224
title: 'Mocked document',
206-
accesses: [],
225+
path: '000000',
207226
abilities: {
208227
destroy: false, // Means not owner
209228
link_configuration: false,
@@ -214,11 +233,21 @@ export const mockedDocument = async (page: Page, json: object) => {
214233
update: false,
215234
partial_update: false, // Means not editor
216235
retrieve: true,
236+
link_select_options: {
237+
public: ['reader', 'editor'],
238+
authenticated: ['reader', 'editor'],
239+
restricted: null,
240+
},
217241
},
218242
link_reach: 'restricted',
243+
computed_link_reach: 'restricted',
244+
computed_link_role: 'reader',
245+
ancestors_link_reach: null,
246+
ancestors_link_role: null,
219247
created_at: '2021-09-01T09:00:00Z',
248+
user_role: 'owner',
220249
user_roles: ['owner'],
221-
...json,
250+
...data,
222251
},
223252
});
224253
} else {
@@ -291,30 +320,32 @@ export const mockedAccesses = async (page: Page, json?: object) => {
291320
request.url().includes('page=')
292321
) {
293322
await route.fulfill({
294-
json: {
295-
count: 1,
296-
next: null,
297-
previous: null,
298-
results: [
299-
{
300-
id: 'bc8bbbc5-a635-4f65-9817-fd1e9ec8ef87',
301-
user: {
302-
id: 'b4a21bb3-722e-426c-9f78-9d190eda641c',
303-
304-
},
305-
team: '',
306-
role: 'reader',
307-
abilities: {
308-
destroy: true,
309-
update: true,
310-
partial_update: true,
311-
retrieve: true,
312-
set_role_to: ['administrator', 'editor'],
313-
},
314-
...json,
323+
json: [
324+
{
325+
id: 'bc8bbbc5-a635-4f65-9817-fd1e9ec8ef87',
326+
user: {
327+
id: 'b4a21bb3-722e-426c-9f78-9d190eda641c',
328+
315329
},
316-
],
317-
},
330+
team: '',
331+
max_ancestors_role: null,
332+
max_role: 'reader',
333+
role: 'reader',
334+
document: {
335+
id: 'mocked-document-id',
336+
path: '000000',
337+
depth: 1,
338+
},
339+
abilities: {
340+
destroy: true,
341+
update: true,
342+
partial_update: true,
343+
retrieve: true,
344+
set_role_to: ['administrator', 'editor'],
345+
},
346+
...json,
347+
},
348+
],
318349
});
319350
} else {
320351
await route.continue();

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

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ const data = [
212212
title: 'Can drop and drag',
213213
updated_at: '2025-03-14T14:45:27.699542Z',
214214
user_roles: ['owner'],
215+
user_role: 'owner',
215216
},
216217
{
217218
id: 'can-only-drop',
@@ -260,6 +261,7 @@ const data = [
260261

261262
updated_at: '2025-03-14T14:45:27.699542Z',
262263
user_roles: ['editor'],
264+
user_role: 'editor',
263265
},
264266
{
265267
id: 'no-drop-and-no-drag',
@@ -307,5 +309,6 @@ const data = [
307309
title: 'No drop and no drag',
308310
updated_at: '2025-03-14T14:44:16.032774Z',
309311
user_roles: ['reader'],
312+
user_role: 'reader',
310313
},
311314
];

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

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ test.describe('Document grid item options', () => {
170170
link_reach: 'restricted',
171171
created_at: '2021-09-01T09:00:00Z',
172172
user_roles: ['editor'],
173+
user_role: 'editor',
173174
},
174175
],
175176
},

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ test.describe('Doc Header', () => {
5454
retrieve: true,
5555
},
5656
link_reach: 'public',
57+
computed_link_reach: 'public',
5758
created_at: '2021-09-01T09:00:00Z',
5859
});
5960

@@ -135,6 +136,11 @@ test.describe('Doc Header', () => {
135136
versions_list: true,
136137
versions_retrieve: true,
137138
update: true,
139+
link_select_options: {
140+
public: ['reader', 'editor'],
141+
authenticated: ['reader', 'editor'],
142+
restricted: null,
143+
},
138144
partial_update: true,
139145
retrieve: true,
140146
},
@@ -160,7 +166,7 @@ test.describe('Doc Header', () => {
160166
await expect(shareModal).toBeVisible();
161167
await expect(page.getByText('Share the document')).toBeVisible();
162168

163-
await expect(page.getByPlaceholder('Type a name or email')).toBeVisible();
169+
// await expect(page.getByPlaceholder('Type a name or email')).toBeVisible();
164170

165171
const invitationCard = shareModal.getByLabel('List invitation card');
166172
await expect(invitationCard).toBeVisible();

0 commit comments

Comments
 (0)