Skip to content

Commit

Permalink
Fix few cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Sep 24, 2024
1 parent fb74e5c commit 317e056
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function Summary() {

return (
<Zone data-cy="vessel-reporting-summary">
<Header>Résumé des derniers signalements {yearsDepth && <>({yearsDepth} dernières années)</>}</Header>
<Header>Résumé des derniers signalements ({yearsDepth} dernières années)</Header>
<Body>
<Columns $isFirst>
<IconColumn>
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/features/SideWindow/index.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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'
Expand Down Expand Up @@ -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())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function ControlsSummary({ controlsFromDate, lastControls, summary }: Con

return (
<Zone data-cy="vessel-controls-summary">
<Header>Derniers contrôles {yearsDepth && <>({yearsDepth} dernières années)</>}</Header>
<Header>Derniers contrôles ({yearsDepth} dernières années)</Header>
<Body>
<InfractionsSummary
numberOfControlsWithSomeGearsSeized={numberOfControlsWithSomeGearsSeized}
Expand Down

0 comments on commit 317e056

Please sign in to comment.