Skip to content

Commit 41f76eb

Browse files
committed
⬆️(dependencies) upgrade Blocknote to 0.51.1
Upgrade Blocknote to 0.51.1 to get the latest features and bug fixes.
1 parent 9cde092 commit 41f76eb

19 files changed

Lines changed: 196 additions & 973 deletions

File tree

Binary file not shown.
Binary file not shown.

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'path';
33
import { expect, test } from '@playwright/test';
44

55
import { CONFIG, createDoc, overrideConfig } from './utils-common';
6+
import { openSuggestionMenu, writeInEditor } from './utils-editor';
67

78
test.describe('Config', () => {
89
if (process.env.IS_INSTANCE !== 'true') {
@@ -35,9 +36,16 @@ test.describe('Config', () => {
3536

3637
const fileChooserPromise = page.waitForEvent('filechooser');
3738

38-
await page.locator('.bn-block-outer').last().fill('Anything');
39-
await page.locator('.bn-block-outer').last().fill('/');
40-
await page.getByText('Resizable image with caption').click();
39+
await writeInEditor({
40+
page,
41+
text: 'Anything',
42+
});
43+
44+
await openSuggestionMenu({
45+
page,
46+
suggestion: 'Resizable image with caption',
47+
});
48+
4149
await page.getByText('Upload image').click();
4250

4351
const fileChooser = await fileChooserPromise;

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ if (process.env.IS_INSTANCE !== 'true') {
119119
await expect(editor.getByText('Bonjour le monde')).toBeVisible();
120120

121121
// Check Suggestion menu
122-
await page.locator('.bn-block-outer').last().fill('/');
122+
await openSuggestionMenu({
123+
page,
124+
});
123125
await expect(page.getByText('Write with AI')).toBeVisible();
124126

125127
// Reload the page to check that the AI change is still there
@@ -364,7 +366,9 @@ if (process.env.IS_INSTANCE !== 'true') {
364366
await editor.getByText('Hello').selectText();
365367

366368
await expect(page.getByRole('button', { name: 'Ask AI' })).toBeHidden();
367-
await page.locator('.bn-block-outer').last().fill('/');
369+
await openSuggestionMenu({
370+
page,
371+
});
368372
await expect(page.getByText('Write with AI')).toBeHidden();
369373
});
370374
});

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path';
33
import { expect, test } from '@playwright/test';
44

55
import { createDoc, overrideConfig, verifyDocName } from './utils-common';
6-
import { writeInEditor } from './utils-editor';
6+
import { openSuggestionMenu, writeInEditor } from './utils-editor';
77
import { connectOtherUserToDoc, updateShareLink } from './utils-share';
88
import { createRootSubPage } from './utils-sub-pages';
99

@@ -101,8 +101,10 @@ test.describe('Doc Collaboration', () => {
101101

102102
// Owner add a image
103103
const fileChooserPromise = page.waitForEvent('filechooser');
104-
await page.locator('.bn-block-outer').last().fill('/');
105-
await page.getByText('Resizable image with caption').click();
104+
await openSuggestionMenu({
105+
page,
106+
suggestion: 'Resizable image with caption',
107+
});
106108
await page.getByText('Upload image').click();
107109

108110
const fileChooser = await fileChooserPromise;

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
randomName,
77
verifyDocName,
88
} from './utils-common';
9+
import { openSuggestionMenu } from './utils-editor';
910
import { connectOtherUserToDoc } from './utils-share';
1011
import { SignIn } from './utils-signin';
1112

@@ -38,12 +39,10 @@ test.describe('Doc Create', () => {
3839

3940
await verifyDocName(page, title);
4041

41-
await page.locator('.bn-block-outer').last().fill('/');
42-
await page
43-
.getByText('New sub-doc', {
44-
exact: true,
45-
})
46-
.click();
42+
await openSuggestionMenu({
43+
page,
44+
suggestion: 'New sub-doc',
45+
});
4746

4847
const input = page.getByRole('textbox', { name: 'Document title' });
4948
await expect(input).toHaveText('', { timeout: 10000 });

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

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ test.describe('Doc Editor', () => {
7474
await page.keyboard.press('Enter');
7575

7676
const fileChooserPromise = page.waitForEvent('filechooser');
77-
await page.locator('.bn-block-outer').last().fill('/');
78-
await page.getByText('Resizable image with caption').click();
77+
await openSuggestionMenu({
78+
page,
79+
suggestion: 'Resizable image with caption',
80+
});
7981
await page.getByText('Upload image').click();
8082

8183
const fileChooser = await fileChooserPromise;
@@ -87,8 +89,6 @@ test.describe('Doc Editor', () => {
8789
.locator('.--docs--editor-container img.bn-visual-media')
8890
.first();
8991

90-
await expect(image).toHaveAttribute('role', 'presentation');
91-
9292
await image.click();
9393

9494
await expect(
@@ -219,9 +219,10 @@ test.describe('Doc Editor', () => {
219219

220220
await writeInEditor({ page, text: 'Hello World' });
221221

222-
await page.keyboard.press('Enter');
223-
await page.locator('.bn-block-outer').last().fill('/');
224-
await page.getByText('Resizable image with caption').click();
222+
await openSuggestionMenu({
223+
page,
224+
suggestion: 'Resizable image with caption',
225+
});
225226
await page.getByText('Upload image').click();
226227

227228
const fileChooser = await fileChooserPromise;
@@ -244,11 +245,6 @@ test.describe('Doc Editor', () => {
244245
expect(await image.getAttribute('src')).toMatch(
245246
/media\/.*\/attachments\/.*.png/,
246247
);
247-
248-
await expect(image).toHaveAttribute('role', 'presentation');
249-
await expect(image).toHaveAttribute('alt', '');
250-
await expect(image).toHaveAttribute('tabindex', '-1');
251-
await expect(image).toHaveAttribute('aria-hidden', 'true');
252248
});
253249

254250
if (process.env.IS_INSTANCE !== 'true') {
@@ -266,12 +262,11 @@ test.describe('Doc Editor', () => {
266262

267263
await verifyDocName(page, randomDoc);
268264

269-
await page.locator('.ProseMirror.bn-editor').click();
270-
await page.locator('.ProseMirror.bn-editor').fill('Hello World');
271-
272-
await page.keyboard.press('Enter');
273-
await page.locator('.bn-block-outer').last().fill('/');
274-
await page.getByText('Embedded file').click();
265+
await writeInEditor({ page, text: 'Hello World' });
266+
await openSuggestionMenu({
267+
page,
268+
suggestion: 'Embedded file',
269+
});
275270
await page.getByText('Upload file').click();
276271

277272
const fileChooser = await fileChooserPromise;
@@ -506,7 +501,7 @@ test.describe('Doc Editor', () => {
506501
}) => {
507502
const [randomDoc] = await createDoc(page, 'doc-scroll', browserName, 1);
508503

509-
for (let i = 0; i < 15; i++) {
504+
for (let i = 0; i < 30; i++) {
510505
await page.keyboard.press('Enter');
511506
await writeInEditor({ page, text: 'Hello Parent ' + i });
512507
}
@@ -515,37 +510,37 @@ test.describe('Doc Editor', () => {
515510
await expect(
516511
editor.getByText('Hello Parent 1', { exact: true }),
517512
).not.toBeInViewport();
518-
await expect(editor.getByText('Hello Parent 14')).toBeInViewport();
513+
await expect(editor.getByText('Hello Parent 29')).toBeInViewport();
519514

520515
const { name: docChild } = await createRootSubPage(
521516
page,
522517
browserName,
523518
'doc-scroll-child',
524519
);
525520

526-
for (let i = 0; i < 15; i++) {
521+
for (let i = 0; i < 30; i++) {
527522
await page.keyboard.press('Enter');
528523
await writeInEditor({ page, text: 'Hello Child ' + i });
529524
}
530525

531526
await expect(
532527
editor.getByText('Hello Child 1', { exact: true }),
533528
).not.toBeInViewport();
534-
await expect(editor.getByText('Hello Child 14')).toBeInViewport();
529+
await expect(editor.getByText('Hello Child 29')).toBeInViewport();
535530

536531
await navigateToPageFromTree({ page, title: randomDoc });
537532

538533
await expect(
539534
editor.getByText('Hello Parent 1', { exact: true }),
540535
).toBeInViewport();
541-
await expect(editor.getByText('Hello Parent 14')).not.toBeInViewport();
536+
await expect(editor.getByText('Hello Parent 29')).not.toBeInViewport();
542537

543538
await navigateToPageFromTree({ page, title: docChild });
544539

545540
await expect(
546541
editor.getByText('Hello Child 1', { exact: true }),
547542
).toBeInViewport();
548-
await expect(editor.getByText('Hello Child 14')).not.toBeInViewport();
543+
await expect(editor.getByText('Hello Child 29')).not.toBeInViewport();
549544
});
550545

551546
test('it embeds PDF', async ({ page, browserName }) => {
@@ -556,8 +551,7 @@ test.describe('Doc Editor', () => {
556551

557552
await page.getByRole('button', { name: 'Close the share modal' }).click();
558553

559-
await openSuggestionMenu({ page });
560-
await page.getByText('Embed a PDF file').click();
554+
await openSuggestionMenu({ page, suggestion: 'Embed a PDF file' });
561555

562556
const pdfBlock = page.locator('div[data-content-type="pdf"]').last();
563557

@@ -579,8 +573,7 @@ test.describe('Doc Editor', () => {
579573

580574
await expect(page.getByText('Invalid or missing PDF file')).toBeVisible();
581575

582-
await openSuggestionMenu({ page });
583-
await page.getByText('Embed a PDF file').click();
576+
await openSuggestionMenu({ page, suggestion: 'Embed a PDF file' });
584577

585578
// Now with a valid PDF
586579
await page.getByText(/Add (PDF|file)/).click();

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,11 @@ test.describe('Doc Export', () => {
116116
await verifyDocName(page, randomDoc);
117117

118118
// Add some content and at least one image so that the ZIP contains media files.
119-
await page.locator('.ProseMirror.bn-editor').click();
120-
await page.locator('.ProseMirror.bn-editor').fill('Hello HTML ZIP');
121-
122-
await page.keyboard.press('Enter');
123-
await page.locator('.bn-block-outer').last().fill('/');
124-
await page.getByText('Resizable image with caption').click();
119+
await writeInEditor({ page, text: 'Hello HTML ZIP' });
120+
await openSuggestionMenu({
121+
page,
122+
suggestion: 'Resizable image with caption',
123+
});
125124

126125
const fileChooserPromise = page.waitForEvent('filechooser');
127126
await page.getByText('Upload image').click();
@@ -222,8 +221,10 @@ test.describe('Doc Export', () => {
222221

223222
await expect(image).toBeVisible();
224223

225-
await page.locator('.bn-block-outer').last().fill('/');
226-
await page.getByText('Resizable image with caption').click();
224+
await openSuggestionMenu({
225+
page,
226+
suggestion: 'Resizable image with caption',
227+
});
227228
await page.getByRole('tab', { name: 'Embed' }).click();
228229
await page
229230
.getByRole('textbox', { name: 'Enter URL' })

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,34 @@ export const getEditor = async ({ page }: { page: Page }) => {
88
return editor;
99
};
1010

11-
export const openSuggestionMenu = async ({ page }: { page: Page }) => {
12-
const editor = await writeInEditor({ page, text: '/' });
11+
export const openSuggestionMenu = async ({
12+
page,
13+
suggestion,
14+
}: {
15+
page: Page;
16+
suggestion?: string;
17+
}) => {
18+
const editor = await getEditor({ page });
19+
if (
20+
(await editor.locator('.bn-trailing-block.ProseMirror-widget').count()) > 0
21+
) {
22+
await editor.locator('.bn-trailing-block.ProseMirror-widget').click();
23+
} else {
24+
await editor.click();
25+
}
26+
await page.keyboard.press('Enter');
27+
await page.keyboard.type('/');
1328

1429
const suggestionMenu = page.locator('.bn-suggestion-menu');
1530

31+
if (suggestion) {
32+
await suggestionMenu
33+
.getByText(suggestion, {
34+
exact: true,
35+
})
36+
.click();
37+
}
38+
1639
return { editor, suggestionMenu };
1740
};
1841

@@ -24,6 +47,13 @@ export const writeInEditor = async ({
2447
text: string;
2548
}) => {
2649
const editor = await getEditor({ page });
50+
if (
51+
(await editor.locator('.bn-trailing-block.ProseMirror-widget').count()) > 0
52+
) {
53+
await editor.locator('.bn-trailing-block.ProseMirror-widget').click();
54+
} else {
55+
await editor.click();
56+
}
2757
await editor
2858
.locator('.bn-block-outer:last-child')
2959
.last()

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ export const overrideDocContent = async ({
5555
await page.waitForTimeout(1000);
5656

5757
// Add Image SVG
58-
await page.keyboard.press('Enter');
59-
const { suggestionMenu } = await openSuggestionMenu({ page });
60-
await suggestionMenu.getByText('Resizable image with caption').click();
58+
await openSuggestionMenu({
59+
page,
60+
suggestion: 'Resizable image with caption',
61+
});
6162
const fileChooserPromise = page.waitForEvent('filechooser');
6263
await page.getByText('Upload image').click();
6364
const fileChooser = await fileChooserPromise;
@@ -73,8 +74,10 @@ export const overrideDocContent = async ({
7374
await page.waitForTimeout(1000);
7475

7576
// Add Image PNG
76-
await openSuggestionMenu({ page });
77-
await suggestionMenu.getByText('Resizable image with caption').click();
77+
await openSuggestionMenu({
78+
page,
79+
suggestion: 'Resizable image with caption',
80+
});
7881
const fileChooserPNGPromise = page.waitForEvent('filechooser');
7982
await page.getByText('Upload image').click();
8083
const fileChooserPNG = await fileChooserPNGPromise;

0 commit comments

Comments
 (0)