diff --git a/frontend/packages/process-editor/src/ProcessEditor.test.tsx b/frontend/packages/process-editor/src/ProcessEditor.test.tsx index f5c3bb302b5..be0cbfd8dac 100644 --- a/frontend/packages/process-editor/src/ProcessEditor.test.tsx +++ b/frontend/packages/process-editor/src/ProcessEditor.test.tsx @@ -9,7 +9,6 @@ import { RouterProvider, createMemoryRouter } from 'react-router-dom'; const mockBPMNXML: string = ``; const mockAppLibVersion8: string = '8.0.3'; -const mockAppLibVersion7: string = '7.0.3'; const mockSaveBpmn = jest.fn(); @@ -41,7 +40,7 @@ describe('ProcessEditor', () => { beforeEach(jest.clearAllMocks); it('should render loading while bpmnXml is undefined', () => { renderProcessEditor({ bpmnXml: undefined }); - expect(screen.getByTitle(textMock('process_editor.loading'))).toBeInTheDocument(); + expect(screen.getByText(textMock('process_editor.loading'))).toBeInTheDocument(); }); it('should render "NoBpmnFoundAlert" when bpmnXml is null', () => { @@ -54,17 +53,6 @@ describe('ProcessEditor', () => { ).toBeInTheDocument(); }); - it('should render "canvas" when bpmnXml is provided and default render is edit-mode', async () => { - // eslint-disable-next-line testing-library/no-unnecessary-act - await act(() => { - renderProcessEditor(); - }); - - expect( - screen.getByRole('button', { name: textMock('process_editor.save') }), - ).toBeInTheDocument(); - }); - it('does not display the information about too old version when the version is 8 or newer', async () => { const user = userEvent.setup(); renderProcessEditor(); @@ -78,15 +66,4 @@ describe('ProcessEditor', () => { }); expect(alertHeader).not.toBeInTheDocument(); }); - - it('displays the alert when the version is 7 or older', async () => { - const user = userEvent.setup(); - renderProcessEditor({ appLibVersion: mockAppLibVersion7 }); - - // Fix to remove act error - await act(() => user.tab()); - - const tooOldText = screen.getByText(textMock('process_editor.too_old_version_title')); - expect(tooOldText).toBeInTheDocument(); - }); }); diff --git a/frontend/packages/process-editor/src/components/Canvas/Canvas.test.tsx b/frontend/packages/process-editor/src/components/Canvas/Canvas.test.tsx index 899a67c9268..b480ed08f52 100644 --- a/frontend/packages/process-editor/src/components/Canvas/Canvas.test.tsx +++ b/frontend/packages/process-editor/src/components/Canvas/Canvas.test.tsx @@ -4,6 +4,7 @@ import { Canvas } from './Canvas'; import { type BpmnContextProviderProps, useBpmnContext } from '../../contexts/BpmnContext'; import { BpmnContextProvider } from '../../contexts/BpmnContext'; import { RouterProvider, createMemoryRouter } from 'react-router-dom'; +import { textMock } from '../../../../../testing/mocks/i18nMock'; jest.mock('../../contexts/BpmnContext', () => ({ ...jest.requireActual('../../contexts/BpmnContext'), @@ -58,4 +59,12 @@ describe('Canvas', () => { renderCanvas({ appLibVersion: mockAppLibVersion8 }); screen.queryByTestId('bpmn-editor'); }); + it('displays the alert when the version is 7 or older', async () => { + (useBpmnContext as jest.Mock).mockReturnValue({ + ...jest.requireActual('../../contexts/BpmnContext'), + }); + renderCanvas({ appLibVersion: mockAppLibVersion7 }); + const tooOldText = screen.getByText(textMock('process_editor.too_old_version_title')); + expect(tooOldText).toBeInTheDocument(); + }); }); diff --git a/frontend/packages/process-editor/src/components/Canvas/Canvas.tsx b/frontend/packages/process-editor/src/components/Canvas/Canvas.tsx index 350ddf4a254..b851ba92693 100644 --- a/frontend/packages/process-editor/src/components/Canvas/Canvas.tsx +++ b/frontend/packages/process-editor/src/components/Canvas/Canvas.tsx @@ -8,9 +8,15 @@ import classes from './Canvas.module.css'; import { useBpmnContext } from '../../contexts/BpmnContext'; import { BPMNViewer } from './BPMNViewer'; import { BPMNEditor } from './BPMNEditor'; +import { VersionHelpText } from './VersionHelpText'; export const Canvas = (): React.ReactElement => { const { isEditAllowed } = useBpmnContext(); - return