Skip to content

Commit

Permalink
fix: test e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault committed Dec 16, 2024
1 parent 6a292cc commit 158ef6d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ context('Main Window > Control Unit Dialog > Contact List', () => {

cy.contains('Unité DREAL Pays-de-La-Loire').should('be.visible')

cy.getDataCy('reinitialize-filters').scrollIntoView().click()
cy.clickButton('Réinitialiser les filtres')
})

it('Should open the current mission of the unit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ context('Side Window > Mission List > Filter Bar', () => {
})

afterEach(() => {
cy.getDataCy('reinitialize-filters').scrollIntoView().click()
cy.clickButton('Réinitialiser les filtres')
})

it('Should filter missions for the current week', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ context('Missions', () => {
cy.getDataCy('edit-mission-48').should('not.exist')

cy.log('Initialize filters')
cy.getDataCy('reinitialize-filters').click()
cy.clickButton('Réinitialiser les filtres')
cy.getDataCy('edit-mission-48').scrollIntoView().should('exist')

cy.log('Units should be filtered')
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/side_window/reporting/filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ context('Reportings', () => {
cy.wait('@getReportings')
})
afterEach(() => {
cy.getDataCy('reinitialize-filters').click({ force: true })
cy.clickButton('Réinitialiser les filtres')
})

it('Should filter reportings for the last seven days', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ context('Side Window > Vigilance Areas List > Filter Bar', () => {
})

afterEach(() => {
cy.getDataCy('reinitialize-filters').scrollIntoView().click()
cy.clickButton('Réinitialiser les filtres')
})

const verifyVigilanceAreaRows = (expectedText: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface ReinitializeFiltersButtonProps {

export function ReinitializeFiltersButton({ onClick }: ReinitializeFiltersButtonProps) {
return (
<ResetFiltersButton data-cy="reinitialize-filters" onClick={onClick}>
<ResetFiltersButton onClick={onClick}>
<Icon.Reset size={14} />
<span>Réinitialiser les filtres</span>
</ResetFiltersButton>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/features/missions/components/Filters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ export function MissionFilters({ context }: { context: MissionFilterContext }) {

const controlUnitsAsOptions = useMemo(() => {
const activeControlUnits = (legacyControlUnits ?? []).filter(isNotArchived)
const selectableControlUnits = activeControlUnits?.filter(activeControlUnit =>
selectedAdministrationNames?.includes(activeControlUnit.administration)
const selectableControlUnits = activeControlUnits?.filter(
activeControlUnit =>
!selectedAdministrationNames?.length || selectedAdministrationNames?.includes(activeControlUnit.administration)
)

return getOptionsFromIdAndName(selectableControlUnits) ?? []
Expand Down

0 comments on commit 158ef6d

Please sign in to comment.