diff --git a/frontend/cypress/e2e/shotgun-identification.cy.js b/frontend/cypress/e2e/shotgun-identification.cy.js new file mode 100644 index 000000000..b64b87a08 --- /dev/null +++ b/frontend/cypress/e2e/shotgun-identification.cy.js @@ -0,0 +1,42 @@ +describe("Shotgun identification", () => { + it("should identificate real shotgun", () => { + cy.Identification(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/fusil-a-pompe.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/carte-manquante"); + cy.getByDataTestid("button-next").click(); + cy.IdentificationRealShotgun(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie B ou C"); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); + + it("should identificate dummy shotgun", () => { + cy.Identification(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/fusil-a-pompe.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/carte-manquante"); + cy.getByDataTestid("button-next").click(); + cy.IdentificationDummyShotgun(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should( + "contain", + "Catégorie Non Classée", + ); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/e2e/shotgun-securing.cy.js b/frontend/cypress/e2e/shotgun-securing.cy.js new file mode 100644 index 000000000..f52d07263 --- /dev/null +++ b/frontend/cypress/e2e/shotgun-securing.cy.js @@ -0,0 +1,27 @@ +describe("Shotgun securing", () => { + it("should secure and identificate real shotgun", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/fusil-a-pompe.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/mise-en-securite-tutoriel"); + cy.getVideo(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("li", "Si la pompe est bloquée"); + cy.getByDataTestid("button-next").click(); + cy.contains("h1", "Fin de la mise en sécurité"); + cy.getByDataTestid("go-to-identification").click(); + cy.url().should("contain", "/carte-manquante"); + cy.getByDataTestid("button-next").click(); + cy.IdentificationRealShotgun(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie B"); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/images/fusil-a-pompe.jpg b/frontend/cypress/images/fusil-a-pompe.jpg new file mode 100755 index 000000000..0d2cdbc83 Binary files /dev/null and b/frontend/cypress/images/fusil-a-pompe.jpg differ diff --git a/frontend/cypress/support/commands.js b/frontend/cypress/support/commands.js index 5cb05b483..7df8b5310 100644 --- a/frontend/cypress/support/commands.js +++ b/frontend/cypress/support/commands.js @@ -198,3 +198,31 @@ Cypress.Commands.add("pasDeGuide", () => { cy.getByDataTestid("go-to-identification").click(); cy.url().should("contain", "/guide-identification/resultat-typologie"); }); + +Cypress.Commands.add("IdentificationRealShotgun", () => { + cy.getByDataTestid("next-step").click(); + cy.url().should( + "contain", + "guide-identification/informations-complementaires", + ); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/munition-type"); + cy.getByDataTestid("next-step").should("have.attr", "disabled"); + cy.contains("Cartouches").first().click(); + cy.getByDataTestid("next-step").should("not.have.attr", "disabled"); + cy.getByDataTestid("next-step").click(); +}); + +Cypress.Commands.add("IdentificationDummyShotgun", () => { + cy.getByDataTestid("next-step").click(); + cy.url().should( + "contain", + "guide-identification/informations-complementaires", + ); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/munition-type"); + cy.getByDataTestid("next-step").should("have.attr", "disabled"); + cy.contains("Billes").first().click(); + cy.getByDataTestid("next-step").should("not.have.attr", "disabled"); + cy.getByDataTestid("next-step").click(); +}); diff --git a/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_bille.jpg b/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_bille.jpg new file mode 100644 index 000000000..b372ad207 Binary files /dev/null and b/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_bille.jpg differ diff --git a/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_cartouche.jpeg b/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_cartouche.jpeg new file mode 100644 index 000000000..70a89c603 Binary files /dev/null and b/frontend/src/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_cartouche.jpeg differ diff --git a/frontend/src/utils/firearms-utils/epaule-a-levier-sous-garde.ts b/frontend/src/utils/firearms-utils/epaule-a-levier-sous-garde.ts index 60ea1ee75..4e95d729a 100644 --- a/frontend/src/utils/firearms-utils/epaule-a-levier-sous-garde.ts +++ b/frontend/src/utils/firearms-utils/epaule-a-levier-sous-garde.ts @@ -2,6 +2,8 @@ import levierSousGardeMagasinAvantImg from "@/assets/guide-mise-en-securite/phot import levierSousGardePasMagasinImg from "@/assets/guide-mise-en-securite/photos/epaule_a_levier_sous_garde/epaule_levier_ss_garde_magasin_fixe.jpg"; import levierSousGardeMagasinAvantVideo from "@/assets/guide-mise-en-securite/videos/epaule_a_levier_sous_garde/epaule_levier_ss_garde_magasin_avant.mp4"; import levierSousGardePasMagasinVideo from "@/assets/guide-mise-en-securite/videos/epaule_a_levier_sous_garde/epaule_levier_ss_garde_magasin_fixe.mp4"; +import levierSousGardeCartridges from "@/assets/guide-identification/photos/epaule_a_verrou/epaule_a_verrou_chargeur_cartouche.jpg"; +import levierSousGardeBalls from "@/assets/guide-identification/photos/epaule_a_verrou/epaule_a_verrou_chargeur_bille.jpg"; import { getEpaulLevierVerrouDisclaimer, getCommonCategory, @@ -51,5 +53,17 @@ export const epaule_a_levier_sous_garde = { ], }, ], + dummyOptions: [ + { + label: "Balles", + value: "cartouches", + img_ammo: levierSousGardeCartridges, + }, + { + label: "Billes ou trou pour billes", + value: "billes", + img_ammo: levierSousGardeBalls, + }, + ], getDisclaimer: getEpaulLevierVerrouDisclaimer, } as const; diff --git a/frontend/src/utils/firearms-utils/epaule-a-pompe.ts b/frontend/src/utils/firearms-utils/epaule-a-pompe.ts index 1119320f7..54270c9db 100644 --- a/frontend/src/utils/firearms-utils/epaule-a-pompe.ts +++ b/frontend/src/utils/firearms-utils/epaule-a-pompe.ts @@ -1,6 +1,6 @@ import epaulePompeSimpleVideo from "@/assets/guide-mise-en-securite/videos/epaule_a_pompe/epaule_pompe_simple.mp4"; -import pistoletSemiAutoModerneCartridges from "@/assets/guide-identification/photos/pistolet_semi_auto_moderne/pistolet_sa_moderne_chargeur_cartouche.jpg"; -import pistoletSemiAutoModerneBalls from "@/assets/guide-identification/photos/pistolet_semi_auto_moderne/pistolet_sa_moderne_chargeur_bille.jpg"; +import epaulePompeCartridges from "@/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_cartouche.jpeg"; +import epaulePompeModerneBalls from "@/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_bille.jpg"; export const epaule_a_pompe = { displayLabel: "Arme d'épaule à pompe", @@ -34,12 +34,12 @@ export const epaule_a_pompe = { { label: "Cartouches", value: "cartouches", - img_ammo: pistoletSemiAutoModerneCartridges, // Mettre la bonne image + img_ammo: epaulePompeCartridges, }, { label: "Billes", value: "billes", - img_ammo: pistoletSemiAutoModerneBalls, // Mettre la bonne image + img_ammo: epaulePompeModerneBalls, }, ], getDisclaimer: (category: string) => { diff --git a/frontend/src/utils/firearms-utils/epaule-semi-auto-militaire-milieu-20e.ts b/frontend/src/utils/firearms-utils/epaule-semi-auto-militaire-milieu-20e.ts index 87e844a78..ebfa64615 100644 --- a/frontend/src/utils/firearms-utils/epaule-semi-auto-militaire-milieu-20e.ts +++ b/frontend/src/utils/firearms-utils/epaule-semi-auto-militaire-milieu-20e.ts @@ -1,9 +1,23 @@ +import semiAutoMilitaireCartridges from "@/assets/guide-identification/photos/semi_auto_militaire_autre/semi_automatique_militaire_autre_chargeur_cartouche.jpg"; +import semiAutoMilitaireBalls from "@/assets/guide-identification/photos/semi_auto_militaire_autre/semi_automatique_militaire_autre_chargeur_billes.jpg"; /* Armes d’épaule semi-automatiques ou automatiques type militaire milieu 20e */ export const epaule_semi_auto_style_militaire_milieu_20e = { displayLabel: "Arme d’épaule semi-automatique ou automatique", getCategory: () => "A ou B", + dummyOptions: [ + { + label: "Cartouches", + value: "cartouches", + img_ammo: semiAutoMilitaireCartridges, + }, + { + label: "Billes", + value: "billes", + img_ammo: semiAutoMilitaireBalls, + }, + ], getDisclaimer: () => "Catégorie A si à l'origine l’arme était à répétition automatique puis a été transformée en arme semi automatique, ou si l’arme possède une crosse rétractable / pliable et qu’en configuration la plus courte elle mesure moins de 60 cm.", } as const; diff --git a/frontend/src/utils/firearms-utils/epaule-semi-auto-style-chasse.ts b/frontend/src/utils/firearms-utils/epaule-semi-auto-style-chasse.ts index 793aa65e3..38232ef90 100644 --- a/frontend/src/utils/firearms-utils/epaule-semi-auto-style-chasse.ts +++ b/frontend/src/utils/firearms-utils/epaule-semi-auto-style-chasse.ts @@ -1,4 +1,6 @@ import { getCommonCategory } from "@/utils/firearms-utils/index"; +import epaulePompeCartridges from "@/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_cartouche.jpeg"; +import epaulePompeModerneBalls from "@/assets/guide-identification/photos/epaule_a_pompe/epaule_a_pompe_chargeur_bille.jpg"; const DISCLAIMERS = { short: @@ -12,6 +14,18 @@ Armes d’épaule semi-automatiques ou automatiques type chasse export const epaule_semi_auto_style_chasse = { displayLabel: "Arme d’épaule semi-automatique", getCategory: getCommonCategory, + dummyOptions: [ + { + label: "Cartouches", + value: "cartouches", + img_ammo: epaulePompeCartridges, + }, + { + label: "Billes", + value: "billes", + img_ammo: epaulePompeModerneBalls, + }, + ], getDisclaimer: (category: string, isCardDetected: boolean) => { if (["B ou C", "C"].includes(category)) { if (isCardDetected === false) { diff --git a/frontend/src/views/GuideIdentificationFirearm/IdentificationSelectAmmo.vue b/frontend/src/views/GuideIdentificationFirearm/IdentificationSelectAmmo.vue index c35c58676..777f874c7 100644 --- a/frontend/src/views/GuideIdentificationFirearm/IdentificationSelectAmmo.vue +++ b/frontend/src/views/GuideIdentificationFirearm/IdentificationSelectAmmo.vue @@ -6,11 +6,6 @@ import { useStore } from "@/stores/result"; import TransparentMagazine from "@/assets/guide-identification/photos/semi_auto_militaire_autre/autre-epaule-transparent-magazine.jpg"; import FocusTransparentMagazine from "@/assets/guide-identification/photos/semi_auto_militaire_autre/autre-epaule-transparent-magazine-focus.jpg"; import { TYPOLOGIES } from "@/utils/firearms-utils/index"; -import { epaule_a_verrou } from "@/utils/firearms-utils/epaule-a-verrou"; // eslint-disable-line camelcase -import type { pistolet_semi_auto_moderne } from "@/utils/firearms-utils/pistolet-semi-auto-moderne"; // eslint-disable-line camelcase -import type { semi_auto_style_militaire_autre } from "@/utils/firearms-utils/semi-auto-style-militaire-autre"; // eslint-disable-line camelcase -import type { revolver } from "@/utils/firearms-utils/revolver"; -import type { epaule_a_pompe } from "@/utils/firearms-utils/epaule-a-pompe"; const store = useStore(); @@ -53,14 +48,6 @@ onMounted(() => { showModal.value = false; } }); - -// eslint-disable-next-line camelcase -type HasDummyOptions = - | typeof epaule_a_verrou - | typeof pistolet_semi_auto_moderne - | typeof semi_auto_style_militaire_autre - | typeof revolver - | typeof epaule_a_pompe;