@@ -27,6 +28,18 @@ const mountWithEditorProviders = (
)
}
+const TestContainer = withTestContainerErrorBoundary(
+ TestContainerWithoutErrorBoundary
+)
+
+const mountWithEditorProviders = (
+ component: React.ReactNode,
+ scope: Record
= {},
+ props: Record = {}
+) => {
+ cy.mount()
+}
+
describe('change list (Bootstrap 5)', function () {
const scope = {
ui: { view: 'history', pdfLayout: 'sideBySide', chatOpen: true },
diff --git a/services/web/test/frontend/features/history/components/toolbar.spec.tsx b/services/web/test/frontend/features/history/components/toolbar.spec.tsx
index 18b8b929e8..f60beff7ce 100644
--- a/services/web/test/frontend/features/history/components/toolbar.spec.tsx
+++ b/services/web/test/frontend/features/history/components/toolbar.spec.tsx
@@ -3,6 +3,28 @@ import { HistoryProvider } from '../../../../../frontend/js/features/history/con
import { HistoryContextValue } from '../../../../../frontend/js/features/history/context/types/history-context-value'
import { Diff } from '../../../../../frontend/js/features/history/services/types/doc'
import { EditorProviders } from '../../../helpers/editor-providers'
+import { FC } from 'react'
+import { withTestContainerErrorBoundary } from '../../../helpers/error-boundary'
+
+const TestContainerWithoutErrorBoundary: FC<{
+ scope: Record
+ diff: Diff
+ selection: HistoryContextValue['selection']
+}> = ({ scope, diff, selection }) => {
+ return (
+
+
+
+
+
+
+
+ )
+}
+
+const TestContainer = withTestContainerErrorBoundary(
+ TestContainerWithoutErrorBoundary
+)
describe('history toolbar', function () {
const editorProvidersScope = {
@@ -58,13 +80,11 @@ describe('history toolbar', function () {
}
cy.mount(
-
-
-
-
-
-
-
+
)
cy.get('.history-react-toolbar').within(() => {
@@ -108,13 +128,11 @@ describe('history toolbar', function () {
}
cy.mount(
-
-
-
-
-
-
-
+
)
cy.get('.history-react-toolbar').within(() => {
diff --git a/services/web/test/frontend/features/source-editor/helpers/test-container.tsx b/services/web/test/frontend/features/source-editor/helpers/test-container.tsx
index 8de4dcdc55..d0920df597 100644
--- a/services/web/test/frontend/features/source-editor/helpers/test-container.tsx
+++ b/services/web/test/frontend/features/source-editor/helpers/test-container.tsx
@@ -1,12 +1,18 @@
-import { FC, ComponentProps, Suspense } from 'react'
+import { FC, ComponentProps, PropsWithChildren, Suspense } from 'react'
+import { withTestContainerErrorBoundary } from '../../../helpers/error-boundary'
const style = { width: 785, height: 785 }
-export const TestContainer: FC> = ({
- children,
- ...rest
-}) => (
+const TestContainerWithoutErrorBoundary: FC<
+ PropsWithChildren>
+> = ({ children, ...rest }) => (
{children}
)
+
+// react-error-boundary version 5 requires an error boundary when using
+// useErrorBoundary, which we do in several components
+export const TestContainer = withTestContainerErrorBoundary(
+ TestContainerWithoutErrorBoundary
+)
diff --git a/services/web/test/frontend/helpers/error-boundary.tsx b/services/web/test/frontend/helpers/error-boundary.tsx
new file mode 100644
index 0000000000..3fe6101d2e
--- /dev/null
+++ b/services/web/test/frontend/helpers/error-boundary.tsx
@@ -0,0 +1,12 @@
+import { ComponentType, FC } from 'react'
+import withErrorBoundary from '@/infrastructure/error-boundary'
+
+const FallbackComponent: FC = () => {
+ return <>An error occurred within the test container>
+}
+
+export const withTestContainerErrorBoundary = function (
+ Component: ComponentType
+) {
+ return withErrorBoundary(Component, FallbackComponent)
+}