diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts
index 610fdbf3..c7487a1c 100644
--- a/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts
+++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts
@@ -25,7 +25,7 @@ test.describe('Doc Export', () => {
await createDoc(page, 'doc-editor', browserName, 1);
await page
.getByRole('button', {
- name: 'download',
+ name: 'Export the document',
})
.click();
@@ -78,8 +78,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
@@ -130,8 +129,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
@@ -200,7 +198,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
+ name: 'Export the document',
})
.click();
@@ -277,7 +275,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
+ name: 'Export the document',
})
.click();
@@ -327,8 +325,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
@@ -390,8 +387,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
@@ -465,8 +461,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
@@ -537,8 +532,7 @@ test.describe('Doc Export', () => {
await page
.getByRole('button', {
- name: 'download',
- exact: true,
+ name: 'Export the document',
})
.click();
diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts
index e7b2a201..8547e113 100644
--- a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts
+++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts
@@ -44,7 +44,9 @@ test.describe('Doc Header', () => {
await expect(card.getByText('Owner ยท')).toBeVisible();
await expect(page.getByRole('button', { name: 'Share' })).toBeVisible();
- await expect(page.getByRole('button', { name: 'download' })).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'Export the document' }),
+ ).toBeVisible();
await expect(
page.getByRole('button', { name: 'Open the document options' }),
).toBeVisible();
@@ -115,7 +117,9 @@ test.describe('Doc Header', () => {
await goToGridDoc(page);
- await expect(page.getByRole('button', { name: 'download' })).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'Export the document' }),
+ ).toBeVisible();
await page.getByLabel('Open the document options').click();
@@ -185,7 +189,9 @@ test.describe('Doc Header', () => {
await goToGridDoc(page);
- await expect(page.getByRole('button', { name: 'download' })).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'Export the document' }),
+ ).toBeVisible();
await page.getByLabel('Open the document options').click();
await expect(page.getByLabel('Delete document')).toBeDisabled();
@@ -245,7 +251,9 @@ test.describe('Doc Header', () => {
await goToGridDoc(page);
- await expect(page.getByRole('button', { name: 'download' })).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'Export the document' }),
+ ).toBeVisible();
await page.getByLabel('Open the document options').click();
await expect(page.getByLabel('Delete document')).toBeDisabled();
diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/__tests__/ExportMIT.test.tsx b/src/frontend/apps/impress/src/features/docs/doc-export/__tests__/ExportMIT.test.tsx
index 398f5213..8c3efaa0 100644
--- a/src/frontend/apps/impress/src/features/docs/doc-export/__tests__/ExportMIT.test.tsx
+++ b/src/frontend/apps/impress/src/features/docs/doc-export/__tests__/ExportMIT.test.tsx
@@ -1,13 +1,6 @@
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest';
const originalEnv = process.env.NEXT_PUBLIC_PUBLISH_AS_MIT;
-vi.mock('@/features/docs/doc-export/utils', () => ({
- anything: true,
-}));
-vi.mock('@/features/docs/doc-export/components/ModalExport', () => ({
- ModalExport: () => ModalExport,
-}));
-
describe('useModuleExport', () => {
afterAll(() => {
process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = originalEnv;
@@ -23,7 +16,7 @@ describe('useModuleExport', () => {
const Export = await import('@/features/docs/doc-export/');
expect(Export.default).toBeUndefined();
- });
+ }, 10000);
it('should load modules when NEXT_PUBLIC_PUBLISH_AS_MIT is false', async () => {
process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'false';
diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/__tests__/DocToolBoxLicence.spec.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/__tests__/DocToolBoxLicence.spec.tsx
new file mode 100644
index 00000000..6ef8d292
--- /dev/null
+++ b/src/frontend/apps/impress/src/features/docs/doc-header/__tests__/DocToolBoxLicence.spec.tsx
@@ -0,0 +1,69 @@
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import React from 'react';
+import { afterAll, beforeEach, describe, expect, vi } from 'vitest';
+
+import { AppWrapper } from '@/tests/utils';
+
+const originalEnv = process.env.NEXT_PUBLIC_PUBLISH_AS_MIT;
+
+vi.mock('next/router', async () => ({
+ ...(await vi.importActual('next/router')),
+ useRouter: () => ({
+ push: vi.fn(),
+ }),
+}));
+
+const doc = {
+ nb_accesses: 1,
+ abilities: {
+ versions_list: true,
+ destroy: true,
+ },
+};
+
+describe('DocToolBox - Licence', () => {
+ afterAll(() => {
+ process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = originalEnv;
+ });
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ vi.resetModules();
+ });
+
+ test('The export button is rendered when MIT version is deactivated', async () => {
+ process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'false';
+
+ const { DocToolBox } = await import('../components/DocToolBox');
+
+ render(, {
+ wrapper: AppWrapper,
+ });
+ const optionsButton = await screen.findByLabelText('Export the document');
+ await userEvent.click(optionsButton);
+ expect(
+ await screen.findByText(
+ 'Download your document in a .docx or .pdf format.',
+ ),
+ ).toBeInTheDocument();
+ }, 10000);
+
+ test('The export button is not rendered when MIT version is activated', async () => {
+ process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'true';
+
+ const { DocToolBox } = await import('../components/DocToolBox');
+
+ render(, {
+ wrapper: AppWrapper,
+ });
+
+ expect(
+ screen.getByLabelText('Open the document options'),
+ ).toBeInTheDocument();
+
+ expect(
+ screen.queryByLabelText('Export the document'),
+ ).not.toBeInTheDocument();
+ });
+});
diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx
index b84321c1..f0c11928 100644
--- a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx
+++ b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx
@@ -241,6 +241,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
setIsModalExportOpen(true);
}}
size={isSmallMobile ? 'small' : 'medium'}
+ aria-label={t('Export the document')}
/>
)}