Skip to content

Commit 97dc7f0

Browse files
✨(frontend) added subpage management and document tree features
New components were created to manage subpages in the document tree, including the ability to add, reorder, and view subpages. Tests were added to verify the functionality of these features. Additionally, API changes were made to manage the creation and retrieval of document children.
1 parent 25ebc98 commit 97dc7f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1707
-127
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ and this project adheres to
8585

8686
## Added
8787

88+
- ✨(frontend) multi-pages #701
8889
- ✨(backend) include ancestors accesses on document accesses list view #846
8990
- ✨(backend) add ancestors links reach and role to document API #846
9091
- 🚸(backend) make document search on title accent-insensitive #874

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,19 @@ export const createDoc = async (
7878
docName: string,
7979
browserName: string,
8080
length: number = 1,
81+
isChild: boolean = false,
8182
) => {
8283
const randomDocs = randomName(docName, browserName, length);
8384

8485
for (let i = 0; i < randomDocs.length; i++) {
85-
const header = page.locator('header').first();
86-
await header.locator('h2').getByText('Docs').click();
86+
if (!isChild) {
87+
const header = page.locator('header').first();
88+
await header.locator('h2').getByText('Docs').click();
89+
}
8790

8891
await page
8992
.getByRole('button', {
90-
name: 'New doc',
93+
name: isChild ? 'New page' : 'New doc',
9194
})
9295
.click();
9396

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ test.beforeEach(async ({ page }) => {
1414

1515
test.describe('Doc Create', () => {
1616
test('it creates a doc', async ({ page, browserName }) => {
17-
const [docTitle] = await createDoc(page, 'My new doc', browserName, 1);
17+
const [docTitle] = await createDoc(page, 'my-new-doc', browserName, 1);
1818

1919
await page.waitForFunction(
20-
() => document.title.match(/My new doc - Docs/),
20+
() => document.title.match(/my-new-doc - Docs/),
2121
{ timeout: 5000 },
2222
);
2323

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ test.describe('Doc Editor', () => {
173173
await expect(editor.getByText('Hello World Doc 2')).toBeHidden();
174174
await expect(editor.getByText('Hello World Doc 1')).toBeVisible();
175175

176+
await page.goto('/');
176177
await page
177178
.getByRole('button', {
178179
name: 'New doc',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test.describe('Doc Routing', () => {
6060
});
6161

6262
test('checks 401 on docs/[id] page', async ({ page, browserName }) => {
63-
const [docTitle] = await createDoc(page, 'My new doc', browserName, 1);
63+
const [docTitle] = await createDoc(page, '401-doc', browserName, 1);
6464
await verifyDocName(page, docTitle);
6565

6666
const responsePromise = page.route(

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

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from '@playwright/test';
22

3-
import { createDoc, verifyDocName } from './common';
3+
import { createDoc, randomName, verifyDocName } from './common';
44

55
test.beforeEach(async ({ page }) => {
66
await page.goto('/');
@@ -94,4 +94,85 @@ test.describe('Document search', () => {
9494
page.getByLabel('Search modal').getByText('search'),
9595
).toBeHidden();
9696
});
97+
98+
test("it checks we don't see filters in search modal", async ({ page }) => {
99+
const searchButton = page
100+
.getByTestId('left-panel-desktop')
101+
.getByRole('button', { name: 'search' });
102+
103+
await expect(searchButton).toBeVisible();
104+
await page.getByRole('button', { name: 'search', exact: true }).click();
105+
await expect(
106+
page.getByRole('combobox', { name: 'Quick search input' }),
107+
).toBeVisible();
108+
await expect(page.getByTestId('doc-search-filters')).toBeHidden();
109+
});
110+
});
111+
112+
test.describe('Sub page search', () => {
113+
test('it check the precense of filters in search modal', async ({
114+
page,
115+
browserName,
116+
}) => {
117+
await page.goto('/');
118+
const [doc1Title] = await createDoc(
119+
page,
120+
'My sub page search',
121+
browserName,
122+
1,
123+
);
124+
await verifyDocName(page, doc1Title);
125+
const searchButton = page
126+
.getByTestId('left-panel-desktop')
127+
.getByRole('button', { name: 'search' });
128+
await searchButton.click();
129+
const filters = page.getByTestId('doc-search-filters');
130+
await expect(filters).toBeVisible();
131+
await filters.click();
132+
await filters.getByRole('button', { name: 'Current doc' }).click();
133+
await expect(
134+
page.getByRole('menuitem', { name: 'All docs' }),
135+
).toBeVisible();
136+
await expect(
137+
page.getByRole('menuitem', { name: 'Current doc' }),
138+
).toBeVisible();
139+
await page.getByRole('menuitem', { name: 'Current doc' }).click();
140+
141+
await expect(page.getByRole('button', { name: 'Reset' })).toBeVisible();
142+
});
143+
144+
test('it searches sub pages', async ({ page, browserName }) => {
145+
await page.goto('/');
146+
147+
const [doc1Title] = await createDoc(
148+
page,
149+
'My sub page search',
150+
browserName,
151+
1,
152+
);
153+
await verifyDocName(page, doc1Title);
154+
await page.getByRole('button', { name: 'New page' }).click();
155+
await verifyDocName(page, '');
156+
await page.getByRole('textbox', { name: 'doc title input' }).click();
157+
await page
158+
.getByRole('textbox', { name: 'doc title input' })
159+
.press('ControlOrMeta+a');
160+
const [randomDocName] = randomName('doc-sub-page', browserName, 1);
161+
await page
162+
.getByRole('textbox', { name: 'doc title input' })
163+
.fill(randomDocName);
164+
const searchButton = page
165+
.getByTestId('left-panel-desktop')
166+
.getByRole('button', { name: 'search' });
167+
168+
await searchButton.click();
169+
await expect(
170+
page.getByRole('button', { name: 'Current doc' }),
171+
).toBeVisible();
172+
await page.getByRole('combobox', { name: 'Quick search input' }).click();
173+
await page
174+
.getByRole('combobox', { name: 'Quick search input' })
175+
.fill('sub');
176+
await expect(page.getByLabel(randomDocName)).toBeVisible();
177+
});
97178
});

0 commit comments

Comments
 (0)