From 317e0564cb293adfec39871e0dabf35c92f4cd91 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Tue, 24 Sep 2024 14:43:46 +0200 Subject: [PATCH] Fix few cypress tests --- .../VesselReportings/Summary/index.tsx | 2 +- frontend/src/features/SideWindow/index.tsx | 16 ++++++++++++++++ .../VesselSidebar/Controls/ControlsSummary.tsx | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/Reporting/components/VesselReportings/Summary/index.tsx b/frontend/src/features/Reporting/components/VesselReportings/Summary/index.tsx index fba6cf6f06..2813121856 100644 --- a/frontend/src/features/Reporting/components/VesselReportings/Summary/index.tsx +++ b/frontend/src/features/Reporting/components/VesselReportings/Summary/index.tsx @@ -11,7 +11,7 @@ export function Summary() { return ( -
Résumé des derniers signalements {yearsDepth && <>({yearsDepth} dernières années)}
+
Résumé des derniers signalements ({yearsDepth} dernières années)
diff --git a/frontend/src/features/SideWindow/index.tsx b/frontend/src/features/SideWindow/index.tsx index 72d5f7ab8a..2540d142e4 100644 --- a/frontend/src/features/SideWindow/index.tsx +++ b/frontend/src/features/SideWindow/index.tsx @@ -1,8 +1,10 @@ import { FrontendErrorBoundary } from '@components/FrontendErrorBoundary' import { MissionForm } from '@features/Mission/components/MissionForm' import { useListenToAllMissionEventsUpdates } from '@features/Mission/components/MissionForm/hooks/useListenToAllMissionEventsUpdates' +import { getAllCurrentReportings } from '@features/Reporting/useCases/getAllCurrentReportings' import { openSideWindowPath } from '@features/SideWindow/useCases/openSideWindowPath' import { Notifier, THEME } from '@mtes-mct/monitor-ui' +import { isCypress } from '@utils/isCypress' import { type CSSProperties, Fragment, useCallback, useEffect, useMemo, useState } from 'react' import styled from 'styled-components' @@ -15,6 +17,11 @@ import { useIsSuperUser } from '../../auth/hooks/useIsSuperUser' import { MissionEventContext } from '../../context/MissionEventContext' import { SideWindowMenuKey } from '../../domain/entities/sideWindow/constants' import { closeBeaconMalfunctionInKanban } from '../../domain/shared_slices/BeaconMalfunction' +import { getOperationalAlerts } from '../../domain/use_cases/alert/getOperationalAlerts' +import { getSilencedAlerts } from '../../domain/use_cases/alert/getSilencedAlerts' +import getAllBeaconMalfunctions from '../../domain/use_cases/beaconMalfunction/getAllBeaconMalfunctions' +import getAllGearCodes from '../../domain/use_cases/gearCode/getAllGearCodes' +import { getInfractions } from '../../domain/use_cases/infraction/getInfractions' import { useMainAppDispatch } from '../../hooks/useMainAppDispatch' import { useMainAppSelector } from '../../hooks/useMainAppSelector' import { Loader as MissionFormLoader } from '../Mission/components/MissionForm/Loader' @@ -69,6 +76,15 @@ export function SideWindow() { }, [openedBeaconMalfunctionInKanban, editedReportingInSideWindow, selectedPath.menu]) useEffect(() => { + if (isCypress()) { + dispatch(getOperationalAlerts()) + dispatch(getAllBeaconMalfunctions()) + dispatch(getSilencedAlerts()) + dispatch(getAllCurrentReportings()) + dispatch(getInfractions()) + dispatch(getAllGearCodes()) + } + window.addEventListener('beforeunload', () => { dispatch(sideWindowActions.close()) }) diff --git a/frontend/src/features/Vessel/components/VesselSidebar/Controls/ControlsSummary.tsx b/frontend/src/features/Vessel/components/VesselSidebar/Controls/ControlsSummary.tsx index 752a963a1f..649d9ad8d8 100644 --- a/frontend/src/features/Vessel/components/VesselSidebar/Controls/ControlsSummary.tsx +++ b/frontend/src/features/Vessel/components/VesselSidebar/Controls/ControlsSummary.tsx @@ -24,7 +24,7 @@ export function ControlsSummary({ controlsFromDate, lastControls, summary }: Con return ( -
Derniers contrôles {yearsDepth && <>({yearsDepth} dernières années)}
+
Derniers contrôles ({yearsDepth} dernières années)