Skip to content

Commit

Permalink
Fix prior notifications filter bar e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Mar 24, 2024
1 parent e4e1242 commit 00becb2
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
-- Do NOT update it directly, update the associated .jsonc file.

INSERT INTO vessels (id, cfr, mmsi, ircs, external_immatriculation, vessel_name, flag_state, length, under_charter) VALUES (101, 'CFR101', 'MMSI101', 'IRCS101', 'EXTIMM101', 'VIVA ESPANA', 'ES', 15, false);

INSERT INTO vessels (id, cfr, mmsi, ircs, external_immatriculation, vessel_name, flag_state, length, under_charter) VALUES (102, 'CFR102', 'MMSI102', 'IRCS102', 'EXTIMM102', 'LEVE NEDERLAND', 'NL', 20, true);
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_104'

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_105');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_106');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_107');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_108');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_109');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_110');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_111');

INSERT INTO logbook_raw_messages (operation_number) VALUES ('FAKE_OPERATION_112');

INSERT INTO logbook_reports (id, cfr, enriched, flag_state, integration_datetime_utc, log_type, operation_datetime_utc, operation_number, operation_type, report_datetime_utc, transmission_format, vessel_id, vessel_name, trip_gears, trip_segments, value) VALUES (101, 'FAK000999999', true, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'PNO', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'FAKE_OPERATION_101', 'DAT', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'ERS', 1, 'PHENOMENE', '[{"gear":"TBN","mesh":100,"dimensions":"250;180"},{"gear":"OTT","mesh":120.5,"dimensions":"250;280"}]', '[{"segment":"SWW04","segmentName":"Chaluts pélagiques"},{"segment":"SWW06","segmentName":"Sennes"}]', '{"catchOnboard":[{"weight":25,"nbFish":null,"species":"COD","faoZone":"27.8.a","effortZone":"C","economicZone":"FRA","statisticalRectangle":"23E6"}],"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false},{"pnoTypeName":"Préavis type B","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRSML","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null}');
UPDATE logbook_reports SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '1 hour', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE id = 101;
UPDATE logbook_reports SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '2 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE id = 101;
Expand All @@ -42,3 +28,5 @@ INSERT INTO logbook_reports (id, cfr, enriched, flag_state, integration_datetime
UPDATE logbook_reports SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE id = 104;
UPDATE logbook_reports SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '4 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE id = 104;
UPDATE logbook_reports SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE id = 104;

INSERT INTO logbook_reports (id, cfr, enriched, flag_state, integration_datetime_utc, log_type, operation_datetime_utc, operation_number, operation_type, report_datetime_utc, transmission_format, vessel_id, vessel_name, trip_gears, trip_segments, value) VALUES (105, 'CFR102', true, 'NLD', '2024-03-01T15:00:00', 'PNO', '2024-03-01T15:00:00', 'FAKE_OPERATION_105', 'DAT', '2024-03-01T15:00:00', 'ERS', 102, 'LEVE NEDERLAND', '[{"gear":"DHB","mesh":20.25,"dimensions":"500;500"},{"gear":"DRM","mesh":25.75,"dimensions":"1000;1000"}]', '[{"segment":"NWW03","segmentName":"Chalut de fond en eau profonde ≥100 mm"}]', '{"catchOnboard":[{"weight":25,"nbFish":null,"species":"FRF","faoZone":"27.8.a","effortZone":"C","economicZone":"FRA","statisticalRectangle":"23E6"}],"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false},{"pnoTypeName":"Préavis type B","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRVNE","predictedArrivalDatetimeUtc":"2024-03-01T17:00:00","predictedLandingDatetimeUtc":"2024-03-01T17:30:00","purpose":"LAN","tripStartDate":"2024-03-01T05:00:00"}');
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
"flag_state": "ES",
"length": 15,
"under_charter": false
},

// - Vessel: LEVE NEDERLAND
// - Flag state: NL
{
"id": 102,
"cfr": "CFR102",
"mmsi": "MMSI102",
"ircs": "IRCS102",
"external_immatriculation": "EXTIMM102",
"vessel_name": "LEVE NEDERLAND",
"flag_state": "NL",
"length": 20,
"under_charter": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
{ "operation_number": "FAKE_OPERATION_102" },
{ "operation_number": "FAKE_OPERATION_103" },
{ "operation_number": "FAKE_OPERATION_104" },
{ "operation_number": "FAKE_OPERATION_105" },
{ "operation_number": "FAKE_OPERATION_106" },
{ "operation_number": "FAKE_OPERATION_107" },
{ "operation_number": "FAKE_OPERATION_108" },
{ "operation_number": "FAKE_OPERATION_109" },
{ "operation_number": "FAKE_OPERATION_110" },
{ "operation_number": "FAKE_OPERATION_111" },
{ "operation_number": "FAKE_OPERATION_112" }
{ "operation_number": "FAKE_OPERATION_105" }
]
},
{
Expand All @@ -39,8 +32,8 @@
{ "gear": "OTT", "mesh": 120.5, "dimensions": "250;280" }
],
"trip_segments:jsonb": [
{ "segment": "SWW04", "segment_name": "Chaluts pélagiques" },
{ "segment": "SWW06", "segment_name": "Sennes" }
{ "segment": "SWW04", "segmentName": "Chaluts pélagiques" },
{ "segment": "SWW06", "segmentName": "Sennes" }
],
"value:jsonb": {
"catchOnboard": [
Expand Down Expand Up @@ -95,8 +88,8 @@
{ "gear": "OT", "mesh": 120.5, "dimensions": "250;280" }
],
"trip_segments:jsonb": [
{ "segment": "SWW10", "segment_name": "Palangres ciblant les espèces démersales" },
{ "segment": "SWW11", "segment_name": "Hameçons" }
{ "segment": "SWW10", "segmentName": "Palangres ciblant les espèces démersales" },
{ "segment": "SWW11", "segmentName": "Hameçons" }
],
"value:jsonb": {
"catchOnboard": [
Expand Down Expand Up @@ -180,8 +173,8 @@
{ "gear": "TBS", "mesh": 120.5, "dimensions": "250;280" }
],
"trip_segments:jsonb": [
{ "segment": "NWW03", "segment_name": "Chalut de fond en eau profonde" },
{ "segment": "NWW05", "segment_name": "Chalut à perche" }
{ "segment": "NWW03", "segmentName": "Chalut de fond en eau profonde" },
{ "segment": "NWW05", "segmentName": "Chalut à perche" }
],
"value:jsonb": {
"catchOnboard": [
Expand Down Expand Up @@ -213,6 +206,60 @@
"purpose": "LAN",
"tripStartDate:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')"
}
},

// - Vessel: LEVE NEDERLAND
{
"id": 105,
"cfr": "CFR102",
"enriched": true,
"flag_state": "NLD",
"integration_datetime_utc": "2024-03-01T15:00:00",
"log_type": "PNO",
"operation_datetime_utc": "2024-03-01T15:00:00",
"operation_number": "FAKE_OPERATION_105",
"operation_type": "DAT",
"report_datetime_utc": "2024-03-01T15:00:00",
"transmission_format": "ERS",
"vessel_id": 102,
"vessel_name": "LEVE NEDERLAND",
"trip_gears:jsonb": [
{ "gear": "DHB", "mesh": 20.25, "dimensions": "500;500" },
{ "gear": "DRM", "mesh": 25.75, "dimensions": "1000;1000" }
],
"trip_segments:jsonb": [
{ "segment": "NWW03", "segmentName": "Chalut de fond en eau profonde ≥100 mm" }
],
"value:jsonb": {
"catchOnboard": [
{
"weight": 25.0,
"nbFish": null,
"species": "FRF",
"faoZone": "27.8.a",
"effortZone": "C",
"economicZone": "FRA",
"statisticalRectangle": "23E6"
}
],
"pnoTypes": [
{
"pnoTypeName": "Préavis type A",
"minimumNotificationPeriod": 4.0,
"hasDesignatedPorts": false
},
{
"pnoTypeName": "Préavis type B",
"minimumNotificationPeriod": 8.0,
"hasDesignatedPorts": true
}
],
"port": "FRVNE",
"predictedArrivalDatetimeUtc": "2024-03-01T17:00:00",
"predictedLandingDatetimeUtc": "2024-03-01T17:30:00",
"purpose": "LAN",
"tripStartDate": "2024-03-01T05:00:00"
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ context('Side Window > Prior Notification List > Filter Bar', () => {

cy.intercept('GET', `${apiPathBase}*flagStates=FRA&flagStates=ESP*`).as('getPriorNotifications')

cy.fill('Nationalité', ['Espagne', 'France'])
cy.fill('Nationalités', ['Espagne', 'France'])

cy.wait('@getPriorNotifications')

Expand Down Expand Up @@ -54,15 +54,7 @@ context('Side Window > Prior Notification List > Filter Bar', () => {

cy.intercept('GET', `${apiPathBase}*tripGearCodes=OTT&tripGearCodes=TBS*`).as('getPriorNotifications')

cy.get('#gearCodes').click()
cy.get('[role="searchbox"]').type('OTT')
cy.get('.rs-picker-cascader-search-match').click()
cy.get('[role="searchbox"]').clear().type('TBS')
cy.get('.rs-picker-cascader-search-match').click()
cy.get('body').type('{esc}')

// TODO Fix that in monitor-ui.
// cy.fill('Engins utilisés', ['OTT', 'TBS'])
cy.fill('Engins utilisés', ['OTT', 'TBS'])

cy.wait('@getPriorNotifications')

Expand Down Expand Up @@ -181,15 +173,7 @@ context('Side Window > Prior Notification List > Filter Bar', () => {

cy.intercept('GET', `${apiPathBase}*&tripSegmentSegments=NWW03*`).as('getPriorNotifications')

cy.get('#portLocodes').click()
cy.get('[role="searchbox"]').type('Saint-Malo')
cy.get('.rs-picker-cascader-search-match').click()
cy.get('[role="searchbox"]').clear().type('Vannes')
cy.get('.rs-picker-cascader-search-match').click()
cy.get('body').type('{esc}')

// TODO Fix that in monitor-ui.
// cy.fill('Ports d’arrivée', ['FRSML', 'FRVNE'])
cy.fill('Ports d’arrivée', ['Saint-Malo', 'Vanne'])

cy.get('.Table-SimpleTable tr').should('have.length.to.be.greaterThan', 0)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export const openSideWindowPriorNotificationList = () => {
if (document.querySelector('[data-cy="first-loader"]')) {
cy.getDataCy('first-loader').should('not.be.visible')
}

cy.wait(1000)
}
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@dnd-kit/core": "6.1.0",
"@dnd-kit/modifiers": "6.0.1",
"@mtes-mct/monitor-ui": "13.8.0",
"@mtes-mct/monitor-ui": "13.9.0",
"@reduxjs/toolkit": "1.9.6",
"@sentry/browser": "7.55.2",
"@sentry/react": "7.52.1",
Expand Down

0 comments on commit 00becb2

Please sign in to comment.