♻️(frontend) replace cors proxy for export

We were using the cors proxy of Blocknote.js
to export the document. Now we use our own proxy
to avoid CORS issues.
This commit is contained in:
Anthony LC
2025-03-13 11:52:11 +01:00
committed by Anthony LC
parent 6efc2377fe
commit 9176328200
9 changed files with 57 additions and 40 deletions

View File

@@ -136,6 +136,11 @@ test.describe('Doc Export', () => {
test('it exports the docs with images', async ({ page, browserName }) => {
const [randomDoc] = await createDoc(page, 'doc-editor', browserName, 1);
const responseCorsPromise = page.waitForResponse(
(response) =>
response.url().includes('/cors-proxy/') && response.status() === 200,
);
const fileChooserPromise = page.waitForEvent('filechooser');
const downloadPromise = page.waitForEvent('download', (download) => {
return download.suggestedFilename().includes(`${randomDoc}.pdf`);
@@ -160,6 +165,14 @@ test.describe('Doc Export', () => {
await expect(image).toBeVisible();
await page.locator('.bn-block-outer').last().fill('/');
await page.getByText('Resizable image with caption').click();
await page.getByRole('tab', { name: 'Embed' }).click();
await page
.getByRole('textbox', { name: 'Enter URL' })
.fill('https://docs.numerique.gouv.fr/assets/logo-gouv.png');
await page.getByText('Embed image').click();
await page
.getByRole('button', {
name: 'download',
@@ -188,6 +201,8 @@ test.describe('Doc Export', () => {
})
.click();
const responseCors = await responseCorsPromise;
expect(responseCors.ok()).toBe(true);
const download = await downloadPromise;
expect(download.suggestedFilename()).toBe(`${randomDoc}.pdf`);