diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs index f62b7b3f..a51baaa2 100644 --- a/frontend/.eslintrc.cjs +++ b/frontend/.eslintrc.cjs @@ -1,56 +1,54 @@ /* eslint-env node */ -require('@rushstack/eslint-patch/modern-module-resolution') +require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { root: true, extends: [ - 'eslint:recommended', + "eslint:recommended", // 'standard-with-typescript', // À décommenter quand le code sera typé - 'standard', - '@vue/eslint-config-typescript', - 'plugin:vue/vue3-recommended', - './.eslintrc-auto-import.json', - "prettier" - ], - plugins: [ - 'vue', + "standard", + "@vue/eslint-config-typescript", + "plugin:vue/vue3-recommended", + "./.eslintrc-auto-import.json", + "prettier", ], + plugins: ["vue"], parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - parser: '@typescript-eslint/parser', + ecmaVersion: "latest", + sourceType: "module", + parser: "@typescript-eslint/parser", tsconfigRootDir: __dirname, - project: ['./tsconfig.app.json'], + project: ["./tsconfig.app.json"], }, env: { - 'vue/setup-compiler-macros': true, + "vue/setup-compiler-macros": true, browser: true, es2021: true, }, rules: { - 'comma-dangle': [2, 'always-multiline'], - '@typescript-eslint/comma-dangle': [2, 'always-multiline'], - 'vue/no-v-html': 0, - 'no-irregular-whitespace': 0, + "comma-dangle": [2, "always-multiline"], + "@typescript-eslint/comma-dangle": [2, "always-multiline"], + "vue/no-v-html": 0, + "no-irregular-whitespace": 0, }, overrides: [ { - files: ['**/__tests__/*.{j,t}s?(x)', '**/src/**/*.spec.{j,t}s?(x)'], + files: ["**/__tests__/*.{j,t}s?(x)", "**/src/**/*.spec.{j,t}s?(x)"], env: { jest: true, }, }, { - files: ['src/utils/**/*.{j,t}s?(x)'], + files: ["src/utils/**/*.{j,t}s?(x)"], rules: { - camelcase: 'off', + camelcase: "off", }, }, { - files: ['**/src/**/*.e2e.js*', '**/src/**/*.cy.js'], + files: ["**/src/**/*.e2e.js*", "**/src/**/*.cy.js"], globals: { cy: true, }, }, ], -} +}; diff --git a/frontend/README.md b/frontend/README.md index 9c7e6bff..def7ae69 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,7 +1,9 @@ # Basegun Vue.js frontend ## Project setup + ### Without Docker + ```bash # install requirements npm install @@ -12,37 +14,45 @@ npm run build # Lints and fixes files npm run lint ``` + ### With Docker + ```bash docker build --target dev -t basegun-front:dev . ``` -If you are in a network blocked with proxy, remember to add arg `--build_arg https_proxy` where `https_proxy` is a variable already set in your env. - +If you are in a network blocked with proxy, remember to add arg `--build_arg https_proxy` where `https_proxy` is a variable already set in your env. ## Run project + ### Without Docker + ```bash npm run dev ``` + Open localhost:3000 ### With Docker + ```bash docker run --rm -p 3000:3000 -d basegun-front:dev ``` ## Test project + Run end-to-end tests with cypress. You need first to have installed dependancies with `npm ci`. First run website with Docker then + ```bash # run in headless mode (only in terminal) npm --prefix frontend run test:e2e-run # run with graphical interface npm --prefix frontend run test:e2e-open -``` +``` ### Customize configuration + See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/frontend/cert/README.md b/frontend/cert/README.md index 1971b787..1d2ee52b 100644 --- a/frontend/cert/README.md +++ b/frontend/cert/README.md @@ -1,3 +1,3 @@ -This folder is only useful if your network imposes you to use custom certs. - -You can ignore it otherwise. \ No newline at end of file +This folder is only useful if your network imposes you to use custom certs. + +You can ignore it otherwise. diff --git a/frontend/cypress.config.cjs b/frontend/cypress.config.cjs index f9ab8144..67796588 100644 --- a/frontend/cypress.config.cjs +++ b/frontend/cypress.config.cjs @@ -1,11 +1,11 @@ -const { defineConfig } = require('cypress') +const { defineConfig } = require("cypress"); -const frontendHost = process.env.FRONTEND_HOST || 'localhost' -const frontendPort = process.env.FRONTEND_PORT || '3000' +const frontendHost = process.env.FRONTEND_HOST || "localhost"; +const frontendPort = process.env.FRONTEND_PORT || "3000"; module.exports = defineConfig({ e2e: { - specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,ts}', + specPattern: "cypress/e2e/**/*.{cy,spec}.{js,ts}", baseUrl: `http://${frontendHost}:${frontendPort}`, // NEO - Crosscall X4 - Résolution : 18:9 // Iphone XR @@ -13,4 +13,4 @@ module.exports = defineConfig({ viewportHeight: 896, video: false, }, -}) +}); diff --git a/frontend/cypress/.eslintrc.cjs b/frontend/cypress/.eslintrc.cjs index 0c938b0e..2ee3017f 100644 --- a/frontend/cypress/.eslintrc.cjs +++ b/frontend/cypress/.eslintrc.cjs @@ -1,12 +1,10 @@ module.exports = { - plugins: [ - 'cypress', - ], + plugins: ["cypress"], env: { mocha: true, - 'cypress/globals': true, + "cypress/globals": true, }, rules: { - strict: 'off', + strict: "off", }, -} +}; diff --git a/frontend/cypress/e2e/firearm-fiability.cy.js b/frontend/cypress/e2e/firearm-fiability.cy.js index 5415c9b7..cc463c84 100644 --- a/frontend/cypress/e2e/firearm-fiability.cy.js +++ b/frontend/cypress/e2e/firearm-fiability.cy.js @@ -1,51 +1,57 @@ -describe('Firearm Fiability', () => { - it('should identificate firearm with high fiability', () => { - cy.Identification() +describe("Firearm Fiability", () => { + it("should identificate firearm with high fiability", () => { + cy.Identification(); - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/pistolet-semi-auto.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.getByDataTestid('next-step').click() - cy.IdentificationPistoletSemiAuto() - cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie B') - cy.getByDataTestid('arm-category').should(() => { - expect(localStorage.getItem('confidenceLevel')).to.eq('"high"') - }) - }) + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/pistolet-semi-auto.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.getByDataTestid("next-step").click(); + cy.IdentificationPistoletSemiAuto(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie B"); + cy.getByDataTestid("arm-category").should(() => { + expect(localStorage.getItem("confidenceLevel")).to.eq('"high"'); + }); + }); - it('should identificate firearm with medium fiability', () => { - cy.Identification() + it("should identificate firearm with medium fiability", () => { + cy.Identification(); - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/arme-medium.png', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.url().should('contain', '/guide-identification/resultat-typologie') - cy.contains('h3', 'Catégorie A, B ou D') - cy.get('h2').should(() => { - expect(localStorage.getItem('confidenceLevel')).to.eq('"medium"') - }) - }) + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/arme-medium.png", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/guide-identification/resultat-typologie"); + cy.contains("h3", "Catégorie A, B ou D"); + cy.get("h2").should(() => { + expect(localStorage.getItem("confidenceLevel")).to.eq('"medium"'); + }); + }); - it('should identificate firearm with low fiability', () => { - cy.Identification() + it("should identificate firearm with low fiability", () => { + cy.Identification(); - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/arme-low.png', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.url().should('contain', '/guide-identification/resultat-typologie') - cy.contains('h2', 'Catégorie non déterminée') - cy.get('h2').should(() => { - expect(localStorage.getItem('confidenceLevel')).to.eq('"low"') - }) - }) -}) + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/arme-low.png", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/guide-identification/resultat-typologie"); + cy.contains("h2", "Catégorie non déterminée"); + cy.get("h2").should(() => { + expect(localStorage.getItem("confidenceLevel")).to.eq('"low"'); + }); + }); +}); diff --git a/frontend/cypress/e2e/firearm-identification.cy.js b/frontend/cypress/e2e/firearm-identification.cy.js index 198b5799..1b2ecc93 100644 --- a/frontend/cypress/e2e/firearm-identification.cy.js +++ b/frontend/cypress/e2e/firearm-identification.cy.js @@ -1,31 +1,35 @@ -describe('Firearm Identification', () => { - it('should identificate real firearm', () => { - cy.Identification() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/pistolet-semi-auto.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.getByDataTestid('next-step').click() - cy.IdentificationPistoletSemiAuto() - 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') - }) +describe("Firearm Identification", () => { + it("should identificate real firearm", () => { + cy.Identification(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/pistolet-semi-auto.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.getByDataTestid("next-step").click(); + cy.IdentificationPistoletSemiAuto(); + 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"); + }); - it('should identificate dummy firearm', () => { - cy.Identification() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/pistolet-semi-auto.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.getByDataTestid('next-step').click() - cy.IdentificationDummyPistolet() - cy.getByDataTestid('return-to-home-end').click() - cy.url().should('contain', '/accueil') - }) -}) + it("should identificate dummy firearm", () => { + cy.Identification(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/pistolet-semi-auto.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.getByDataTestid("next-step").click(); + cy.IdentificationDummyPistolet(); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/e2e/firearm-securing.cy.js b/frontend/cypress/e2e/firearm-securing.cy.js index 4f1a57fc..bf3888ba 100644 --- a/frontend/cypress/e2e/firearm-securing.cy.js +++ b/frontend/cypress/e2e/firearm-securing.cy.js @@ -1,32 +1,34 @@ -describe('Securing Firearm and Identification', () => { - it('should secure and identificate real firearm', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/pistolet-semi-auto.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.url().should('contain', '/mise-en-securite-choix-option-etape/1') - cy.getByDataTestid('button-next').should('have.attr', 'disabled') - cy.contains('Bouton à côté du pontet').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.url().should('contain', '/mise-en-securite-tutoriel') - cy.getVideo() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('li', 'Actionner la culasse') - 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', '/guide-identification/resultat-typologie') - cy.contains('h1', 'Typologie de l\'arme') - cy.contains('p', 'Basegun a identifié votre arme') - cy.getByDataTestid('next-step').click() - cy.IdentificationPistoletSemiAuto() - 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') - }) -}) +describe("Securing Firearm and Identification", () => { + it("should secure and identificate real firearm", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/pistolet-semi-auto.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/mise-en-securite-choix-option-etape/1"); + cy.getByDataTestid("button-next").should("have.attr", "disabled"); + cy.contains("Bouton à côté du pontet").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.url().should("contain", "/mise-en-securite-tutoriel"); + cy.getVideo(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("li", "Actionner la culasse"); + 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", "/guide-identification/resultat-typologie"); + cy.contains("h1", "Typologie de l'arme"); + cy.contains("p", "Basegun a identifié votre arme"); + cy.getByDataTestid("next-step").click(); + cy.IdentificationPistoletSemiAuto(); + 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/e2e/home.cy.js b/frontend/cypress/e2e/home.cy.js index c0a7d27b..82c5137a 100644 --- a/frontend/cypress/e2e/home.cy.js +++ b/frontend/cypress/e2e/home.cy.js @@ -1,56 +1,40 @@ -describe('HomePage', () => { - it('shoud visit HomePage', () => { - cy.visit('/') - cy.getByDataTestid('basegun-logo').should('exist') - cy.contains('li', 'Basegun est une application') - cy.get('swiper-container').shadow().find('.swiper-button-next').click() - cy.contains('li', 'ne remplace en aucun cas l\'avis d\'un expert') - cy.get('#agree-button').contains('J\'ai compris').click() - cy.url().should('contain', '/accueil') - }) +describe("HomePage", () => { + it("shoud visit HomePage", () => { + cy.visit("/"); + cy.getByDataTestid("basegun-logo").should("exist"); + cy.contains("li", "Basegun est une application"); + cy.get("swiper-container").shadow().find(".swiper-button-next").click(); + cy.contains("li", "ne remplace en aucun cas l'avis d'un expert"); + cy.get("#agree-button").contains("J'ai compris").click(); + cy.url().should("contain", "/accueil"); + }); - it('should open Menu informations', () => { - cy.visit('/') - cy.getByDataTestid('header-logo').contains('Ministère') - cy.get('#button-menu') - .should('exist') - .click() - cy.getByRole('navigation') - .contains('a', 'A propos') - .click() - cy.url() - .should('contain', '/a-propos') - cy.contains('p', 'Basegun est un projet') + it("should open Menu informations", () => { + cy.visit("/"); + cy.getByDataTestid("header-logo").contains("Ministère"); + cy.get("#button-menu").should("exist").click(); + cy.getByRole("navigation").contains("a", "A propos").click(); + cy.url().should("contain", "/a-propos"); + cy.contains("p", "Basegun est un projet"); - cy.get('#button-menu') - .click() - cy.getByRole('navigation') - .contains('a', 'Mentions légales') - .click() - cy.url() - .should('contain', '/mentions-legales') - cy.contains('p', 'Basegun') + cy.get("#button-menu").click(); + cy.getByRole("navigation").contains("a", "Mentions légales").click(); + cy.url().should("contain", "/mentions-legales"); + cy.contains("p", "Basegun"); - cy.get('#button-menu') - .click() - cy.getByRole('navigation') - .contains('a', 'Contact') - .click() - cy.url() - .should('contain', '/contact') - cy.contains('a', 'support.basegun@interieur.gouv.fr') - cy.getByRole('navigation') - .contains('a', 'Important') - .click({ force: true }) + cy.get("#button-menu").click(); + cy.getByRole("navigation").contains("a", "Contact").click(); + cy.url().should("contain", "/contact"); + cy.contains("a", "support.basegun@interieur.gouv.fr"); + cy.getByRole("navigation") + .contains("a", "Important") + .click({ force: true }); - cy.get('#button-menu') - .click() - cy.getByRole('navigation') - .contains('a', 'Accessibilité : partiellement conforme') - .click() - cy.url() - .should('contain', '/accessibilite') - cy.contains('h1', 'Déclaration d’accessibilité') - }) -}, -) + cy.get("#button-menu").click(); + cy.getByRole("navigation") + .contains("a", "Accessibilité : partiellement conforme") + .click(); + cy.url().should("contain", "/accessibilite"); + cy.contains("h1", "Déclaration d’accessibilité"); + }); +}); diff --git a/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js b/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js index 4f826eb8..48f058b1 100644 --- a/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js +++ b/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js @@ -1,15 +1,18 @@ -describe('Old Mechanism Pistol Securing', () => { - it('should secure and identificate old mechanism pistol', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/pistolet-ancien-a-percussion-monocoup.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.pasDeGuide() - cy.getByDataTestid('arm-category').should('contain', 'Catégorie D') - cy.getByDataTestid('return-to-home-end').click() - cy.url().should('contain', '/accueil') - }) -}) +describe("Old Mechanism Pistol Securing", () => { + it("should secure and identificate old mechanism pistol", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile( + "./cypress/images/pistolet-ancien-a-percussion-monocoup.jpg", + { force: true }, + ); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.pasDeGuide(); + cy.getByDataTestid("arm-category").should("contain", "Catégorie D"); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/e2e/recommendations-civilians-vs-fsi.cy.js b/frontend/cypress/e2e/recommendations-civilians-vs-fsi.cy.js index 2600c97b..85e71f65 100644 --- a/frontend/cypress/e2e/recommendations-civilians-vs-fsi.cy.js +++ b/frontend/cypress/e2e/recommendations-civilians-vs-fsi.cy.js @@ -1,33 +1,34 @@ -describe('Recommendations Civilians vs FSI', () => { - it('should show application version FSI', () => { - cy.visit('/', { - onBeforeLoad: win => { - Object.defineProperty(win.navigator, 'userAgent', { - value: 'SAID', - }) +describe("Recommendations Civilians vs FSI", () => { + it("should show application version FSI", () => { + cy.visit("/", { + onBeforeLoad: (win) => { + Object.defineProperty(win.navigator, "userAgent", { + value: "SAID", + }); }, - }) - cy.accueil() - cy.getByDataTestid('secure-firearm') - .contains('Je veux mettre en sécurité mon arme') - .click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('p', 'En cas de doute,') - }) + }); + cy.accueil(); + cy.getByDataTestid("secure-firearm") + .contains("Je veux mettre en sécurité mon arme") + .click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("p", "En cas de doute,"); + }); - it('should show application version Civilians', () => { - cy.visit('/', { - onBeforeLoad: win => { - Object.defineProperty(win.navigator, 'userAgent', { - value: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1', - }) + it("should show application version Civilians", () => { + cy.visit("/", { + onBeforeLoad: (win) => { + Object.defineProperty(win.navigator, "userAgent", { + value: + "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", + }); }, - }) - cy.accueil() - cy.getByDataTestid('secure-firearm') - .contains('Je veux mettre en sécurité mon arme') - .click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('span', 'extraire des munitions') - }) -}) + }); + cy.accueil(); + cy.getByDataTestid("secure-firearm") + .contains("Je veux mettre en sécurité mon arme") + .click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("span", "extraire des munitions"); + }); +}); diff --git a/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js b/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js index 3d2605b7..c4f3556e 100644 --- a/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js +++ b/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js @@ -1,21 +1,23 @@ -describe('Shoulder Bolt Rifle Securing', () => { - it('should secure and identficate real shoulder bolt rifle', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/epaule-a-verrou.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.getVideo() - cy.url().should('contain', '/mise-en-securite-tutoriel') - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('li', 'Ouvrez la culasse') - cy.getByDataTestid('button-next').click() - cy.IdentificationShoulderBoltRifle() - cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie C') - cy.getByDataTestid('return-to-home-end').click() - cy.url().should('contain', '/accueil') - }) -}) +describe("Shoulder Bolt Rifle Securing", () => { + it("should secure and identficate real shoulder bolt rifle", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/epaule-a-verrou.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.getVideo(); + cy.url().should("contain", "/mise-en-securite-tutoriel"); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("li", "Ouvrez la culasse"); + cy.getByDataTestid("button-next").click(); + cy.IdentificationShoulderBoltRifle(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie C"); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/e2e/typology-revolver-identification.cy.js b/frontend/cypress/e2e/typology-revolver-identification.cy.js index 6e658a8d..9e195b1f 100644 --- a/frontend/cypress/e2e/typology-revolver-identification.cy.js +++ b/frontend/cypress/e2e/typology-revolver-identification.cy.js @@ -1,16 +1,18 @@ -describe('Typology Revolver Identification', () => { - it('should identificate revolver typology', () => { - cy.Identification() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/revolver.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.IdentificationRevolver() - cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie B ou D') - cy.getByDataTestid('return-to-home-end').click() - cy.url().should('contain', '/accueil') - }) -}) +describe("Typology Revolver Identification", () => { + it("should identificate revolver typology", () => { + cy.Identification(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/revolver.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.IdentificationRevolver(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie B ou D"); + cy.getByDataTestid("return-to-home-end").click(); + cy.url().should("contain", "/accueil"); + }); +}); diff --git a/frontend/cypress/e2e/typology-revolver-securing.cy.js b/frontend/cypress/e2e/typology-revolver-securing.cy.js index ec1ac189..e2389518 100644 --- a/frontend/cypress/e2e/typology-revolver-securing.cy.js +++ b/frontend/cypress/e2e/typology-revolver-securing.cy.js @@ -1,74 +1,80 @@ -describe('Typology Revolver Securing', () => { - it('should identificate revolver with small fireplaces (?) ', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/revolver.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.url().should('contain', '/mise-en-securite-choix-option-etape/1') - cy.getByDataTestid('button-next').should('have.attr', 'disabled') - cy.contains('Petites Cheminées').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.url().should('contain', '/fin-mise-en-securite') - cy.contains('h1', 'mise en sécurité') - cy.contains('p', 'les manipulations sont complexes') - cy.getByDataTestid('go-to-identification').click() - cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie D') - }) +describe("Typology Revolver Securing", () => { + it("should identificate revolver with small fireplaces (?) ", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/revolver.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.url().should("contain", "/mise-en-securite-choix-option-etape/1"); + cy.getByDataTestid("button-next").should("have.attr", "disabled"); + cy.contains("Petites Cheminées").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.url().should("contain", "/fin-mise-en-securite"); + cy.contains("h1", "mise en sécurité"); + cy.contains("p", "les manipulations sont complexes"); + cy.getByDataTestid("go-to-identification").click(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie D"); + }); - it('should secure and identificate real revolver with barrel button', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/revolver.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.arrierePlatRevolver() - cy.contains('Bouton à côté du barillet').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.getVideo() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('li', 'Tirer ou pousser') - cy.getByDataTestid('button-next').click() - cy.url().should('contain', '/fin-mise-en-securite') - cy.getByDataTestid('go-to-identification').click() - cy.IdentificationRevolver() - 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') - }) - it('should secure and identificate real revolver with hidden door', () => { - cy.miseEnSecurite() - cy.getByDataTestid('select-file').as('fileInput') - cy.intercept('POST', '/api/upload').as('upload') - cy.get('@fileInput').selectFile('./cypress/images/revolver.jpg', { force: true }) - cy.wait('@upload').then(({ response }) => { - expect(response.statusCode).to.eq(200) - }) - cy.arrierePlatRevolver() - cy.contains('Portière qui cache le côté droit du barillet').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.getByDataTestid('button-next').should('have.attr', 'disabled') - cy.contains('Le barillet ne bascule pas').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('li', 'Contrôler que chaque chambre') - cy.getByDataTestid('button-next').click() - cy.url().should('contain', '/fin-mise-en-securite') - cy.getByDataTestid('go-to-identification').click() - cy.IdentificationRevolver() - 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') - }) -}) + it("should secure and identificate real revolver with barrel button", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/revolver.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.arrierePlatRevolver(); + cy.contains("Bouton à côté du barillet").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.getVideo(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("li", "Tirer ou pousser"); + cy.getByDataTestid("button-next").click(); + cy.url().should("contain", "/fin-mise-en-securite"); + cy.getByDataTestid("go-to-identification").click(); + cy.IdentificationRevolver(); + 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"); + }); + it("should secure and identificate real revolver with hidden door", () => { + cy.miseEnSecurite(); + cy.getByDataTestid("select-file").as("fileInput"); + cy.intercept("POST", "/api/upload").as("upload"); + cy.get("@fileInput").selectFile("./cypress/images/revolver.jpg", { + force: true, + }); + cy.wait("@upload").then(({ response }) => { + expect(response.statusCode).to.eq(200); + }); + cy.arrierePlatRevolver(); + cy.contains("Portière qui cache le côté droit du barillet").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.getByDataTestid("button-next").should("have.attr", "disabled"); + cy.contains("Le barillet ne bascule pas").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("li", "Contrôler que chaque chambre"); + cy.getByDataTestid("button-next").click(); + cy.url().should("contain", "/fin-mise-en-securite"); + cy.getByDataTestid("go-to-identification").click(); + cy.IdentificationRevolver(); + 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/support/commands.js b/frontend/cypress/support/commands.js index a78caadf..fa25e59f 100644 --- a/frontend/cypress/support/commands.js +++ b/frontend/cypress/support/commands.js @@ -23,164 +23,176 @@ // // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -import { mount } from 'cypress/vue' -import '@testing-library/cypress/add-commands' +import { mount } from "cypress/vue"; +import "@testing-library/cypress/add-commands"; -Cypress.Commands.add('mount', mount) +Cypress.Commands.add("mount", mount); -Cypress.Commands.add('getByDataTestid', (selector, options) => { - return cy.get(`[data-testid=${selector}]`, options) -}) +Cypress.Commands.add("getByDataTestid", (selector, options) => { + return cy.get(`[data-testid=${selector}]`, options); +}); -Cypress.Commands.add('getByRole', (selector, options) => { - return cy.get(`[role=${selector}]`, options) -}) +Cypress.Commands.add("getByRole", (selector, options) => { + return cy.get(`[role=${selector}]`, options); +}); -Cypress.Commands.add('getVideo', () => { - cy.get('video') - .then( - ($video) => { - $video[0].addEventListener('loadeddata', () => { - $video[0].play() - }) - $video[0].load() - }) - cy.wait(3000) - cy.get('video') - .then(($video) => { - $video[0].pause() - }) - cy.wait(2000) - cy.get('video').should('have.prop', 'paused', true) -}) +Cypress.Commands.add("getVideo", () => { + cy.get("video").then(($video) => { + $video[0].addEventListener("loadeddata", () => { + $video[0].play(); + }); + $video[0].load(); + }); + cy.wait(3000); + cy.get("video").then(($video) => { + $video[0].pause(); + }); + cy.wait(2000); + cy.get("video").should("have.prop", "paused", true); +}); -Cypress.Commands.add('accueil', () => { - cy.getByDataTestid('basegun-logo').should('exist') - cy.contains('li', 'Basegun est une application') - cy.get('swiper-container').shadow().find('.swiper-button-next').click() - cy.contains('li', 'ne remplace en aucun cas l\'avis d\'un expert') - cy.get('#agree-button').contains('J\'ai compris').click() - cy.url().should('contain', '/accueil') -}) +Cypress.Commands.add("accueil", () => { + cy.getByDataTestid("basegun-logo").should("exist"); + cy.contains("li", "Basegun est une application"); + cy.get("swiper-container").shadow().find(".swiper-button-next").click(); + cy.contains("li", "ne remplace en aucun cas l'avis d'un expert"); + cy.get("#agree-button").contains("J'ai compris").click(); + cy.url().should("contain", "/accueil"); +}); -Cypress.Commands.add('miseEnSecurite', () => { - cy.visit('/') - cy.getByDataTestid('basegun-logo').should('exist') - cy.contains('li', 'Basegun est une application') - cy.get('swiper-container').shadow().find('.swiper-button-next').click() - cy.contains('li', 'ne remplace en aucun cas l\'avis d\'un expert') - cy.get('#agree-button').contains('J\'ai compris').click() - cy.url().should('contain', '/accueil') - cy.getByDataTestid('secure-firearm') - .contains('Je veux mettre en sécurité mon arme') - .click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('span', 'extraire des munitions') - cy.getByDataTestid('button-next') - .contains('Suivant') - .click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('span', 'DIRECTION SÛRE') - cy.getByDataTestid('button-next') - .contains('Suivant') - .click() - cy.contains('h1', 'Mettre en sécurité mon arme') - cy.contains('span', 'tutoriel adapté') - cy.getByDataTestid('button-next') - .contains('Suivant') - .click() -}) +Cypress.Commands.add("miseEnSecurite", () => { + cy.visit("/"); + cy.getByDataTestid("basegun-logo").should("exist"); + cy.contains("li", "Basegun est une application"); + cy.get("swiper-container").shadow().find(".swiper-button-next").click(); + cy.contains("li", "ne remplace en aucun cas l'avis d'un expert"); + cy.get("#agree-button").contains("J'ai compris").click(); + cy.url().should("contain", "/accueil"); + cy.getByDataTestid("secure-firearm") + .contains("Je veux mettre en sécurité mon arme") + .click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("span", "extraire des munitions"); + cy.getByDataTestid("button-next").contains("Suivant").click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("span", "DIRECTION SÛRE"); + cy.getByDataTestid("button-next").contains("Suivant").click(); + cy.contains("h1", "Mettre en sécurité mon arme"); + cy.contains("span", "tutoriel adapté"); + cy.getByDataTestid("button-next").contains("Suivant").click(); +}); -Cypress.Commands.add('Identification', () => { - cy.visit('/') - cy.getByDataTestid('basegun-logo').should('exist') - cy.contains('li', 'Basegun est une application') - cy.get('swiper-container').shadow().find('.swiper-button-next').click() - cy.contains('li', 'ne remplace en aucun cas l\'avis d\'un expert') - cy.get('#agree-button').contains('J\'ai compris').click() - cy.url().should('contain', '/accueil') - cy.getByDataTestid('identification') - .contains('J’ai déjà mis mon arme en sécurité, je veux l’identifier') - .click() - cy.url().should('contain', '/instructions') - cy.contains('h1', 'Pour un résultat optimal') - cy.contains('span', 'canon vers la droite') -}) +Cypress.Commands.add("Identification", () => { + cy.visit("/"); + cy.getByDataTestid("basegun-logo").should("exist"); + cy.contains("li", "Basegun est une application"); + cy.get("swiper-container").shadow().find(".swiper-button-next").click(); + cy.contains("li", "ne remplace en aucun cas l'avis d'un expert"); + cy.get("#agree-button").contains("J'ai compris").click(); + cy.url().should("contain", "/accueil"); + cy.getByDataTestid("identification") + .contains("J’ai déjà mis mon arme en sécurité, je veux l’identifier") + .click(); + cy.url().should("contain", "/instructions"); + cy.contains("h1", "Pour un résultat optimal"); + cy.contains("span", "canon vers la droite"); +}); -Cypress.Commands.add('IdentificationPistoletSemiAuto', () => { - 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() - cy.url().should('contain', '/guide-identification/armes-alarme') - cy.getByDataTestid('instruction-armeAlarme').should('contain', 'Votre arme') - cy.getByDataTestid('next-step').click() - cy.getByDataTestid('aucune-correspondance').click() - cy.getByDataTestid('next-step').click() -}) +Cypress.Commands.add("IdentificationPistoletSemiAuto", () => { + 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(); + cy.url().should("contain", "/guide-identification/armes-alarme"); + cy.getByDataTestid("instruction-armeAlarme").should("contain", "Votre arme"); + cy.getByDataTestid("next-step").click(); + cy.getByDataTestid("aucune-correspondance").click(); + cy.getByDataTestid("next-step").click(); +}); -Cypress.Commands.add('IdentificationRevolver', () => { - cy.url().should('contain', '/resultat-typologie') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', 'guide-identification/informations-complementaires') - cy.getByDataTestid('explanation').should('contain', 'questions supplémentaires') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', '/guide-identification/munition-type') - cy.getByDataTestid('next-step').should('have.attr', 'disabled') - cy.contains('Balles').first().click() - cy.getByDataTestid('next-step').should('not.have.attr', 'disabled') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', '/guide-identification/armes-alarme') - cy.getByDataTestid('instruction-armeAlarme').should('contain', 'Votre arme') - cy.getByDataTestid('next-step').click() - cy.getByDataTestid('aucune-correspondance').click() - cy.getByDataTestid('next-step').click() -}) +Cypress.Commands.add("IdentificationRevolver", () => { + cy.url().should("contain", "/resultat-typologie"); + cy.getByDataTestid("next-step").click(); + cy.url().should( + "contain", + "guide-identification/informations-complementaires", + ); + cy.getByDataTestid("explanation").should( + "contain", + "questions supplémentaires", + ); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/munition-type"); + cy.getByDataTestid("next-step").should("have.attr", "disabled"); + cy.contains("Balles").first().click(); + cy.getByDataTestid("next-step").should("not.have.attr", "disabled"); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/armes-alarme"); + cy.getByDataTestid("instruction-armeAlarme").should("contain", "Votre arme"); + cy.getByDataTestid("next-step").click(); + cy.getByDataTestid("aucune-correspondance").click(); + cy.getByDataTestid("next-step").click(); +}); -Cypress.Commands.add('arrierePlatRevolver', () => { - cy.url().should('contain', '/mise-en-securite-choix-option-etape/1') - cy.getByDataTestid('button-next').should('have.attr', 'disabled') - cy.contains('Arrière plat').first().click() - cy.getByDataTestid('button-next').should('not.have.attr', 'disabled') - cy.getByDataTestid('button-next').click() - cy.url().should('contain', '/mise-en-securite-choix-option-etape/2') - cy.getByDataTestid('button-next').should('have.attr', 'disabled') -}) +Cypress.Commands.add("arrierePlatRevolver", () => { + cy.url().should("contain", "/mise-en-securite-choix-option-etape/1"); + cy.getByDataTestid("button-next").should("have.attr", "disabled"); + cy.contains("Arrière plat").first().click(); + cy.getByDataTestid("button-next").should("not.have.attr", "disabled"); + cy.getByDataTestid("button-next").click(); + cy.url().should("contain", "/mise-en-securite-choix-option-etape/2"); + cy.getByDataTestid("button-next").should("have.attr", "disabled"); +}); -Cypress.Commands.add('IdentificationShoulderBoltRifle', () => { - cy.url().should('contain', '/fin-mise-en-securite') - cy.getByDataTestid('go-to-identification').click() - cy.url().should('contain', '/resultat-typologie') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', 'guide-identification/informations-complementaires') - cy.getByDataTestid('explanation').should('contain', 'questions supplémentaires') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', '/guide-identification/munition-type') - cy.getByDataTestid('next-step').should('have.attr', 'disabled') - cy.contains('Balles').first().click() - cy.getByDataTestid('next-step').should('not.have.attr', 'disabled') - cy.getByDataTestid('next-step').click() -}) +Cypress.Commands.add("IdentificationShoulderBoltRifle", () => { + cy.url().should("contain", "/fin-mise-en-securite"); + cy.getByDataTestid("go-to-identification").click(); + cy.url().should("contain", "/resultat-typologie"); + cy.getByDataTestid("next-step").click(); + cy.url().should( + "contain", + "guide-identification/informations-complementaires", + ); + cy.getByDataTestid("explanation").should( + "contain", + "questions supplémentaires", + ); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/munition-type"); + cy.getByDataTestid("next-step").should("have.attr", "disabled"); + cy.contains("Balles").first().click(); + cy.getByDataTestid("next-step").should("not.have.attr", "disabled"); + cy.getByDataTestid("next-step").click(); +}); -Cypress.Commands.add('IdentificationDummyPistolet', () => { - cy.url().should('contain', '/guide-identification/informations-complementaires') - cy.getByDataTestid('explanation').should('contain', 'questions supplémentaires') - cy.getByDataTestid('next-step').click() - cy.getByDataTestid('next-step').should('have.attr', 'disabled') - cy.contains('Billes').first().click() - cy.url().should('contain', '/guide-identification/munition-type') - cy.getByDataTestid('next-step').should('not.have.attr', 'disabled') - cy.getByDataTestid('next-step').click() - cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie Non Classée') -}) +Cypress.Commands.add("IdentificationDummyPistolet", () => { + cy.url().should( + "contain", + "/guide-identification/informations-complementaires", + ); + cy.getByDataTestid("explanation").should( + "contain", + "questions supplémentaires", + ); + cy.getByDataTestid("next-step").click(); + cy.getByDataTestid("next-step").should("have.attr", "disabled"); + cy.contains("Billes").first().click(); + cy.url().should("contain", "/guide-identification/munition-type"); + cy.getByDataTestid("next-step").should("not.have.attr", "disabled"); + cy.getByDataTestid("next-step").click(); + cy.url().should("contain", "/guide-identification/resultat-final"); + cy.getByDataTestid("arm-category").should("contain", "Catégorie Non Classée"); +}); -Cypress.Commands.add('pasDeGuide', () => { - cy.contains('h1', 'Pas de guide de mise en sécurité pour votre arme') - cy.url().should('contain', '/fin-mise-en-securite') - cy.getByDataTestid('go-to-identification').click() - cy.url().should('contain', '/guide-identification/resultat-typologie') -}) +Cypress.Commands.add("pasDeGuide", () => { + cy.contains("h1", "Pas de guide de mise en sécurité pour votre arme"); + cy.url().should("contain", "/fin-mise-en-securite"); + cy.getByDataTestid("go-to-identification").click(); + cy.url().should("contain", "/guide-identification/resultat-typologie"); +}); diff --git a/frontend/cypress/support/e2e.js b/frontend/cypress/support/e2e.js index d68db96d..d076cec9 100644 --- a/frontend/cypress/support/e2e.js +++ b/frontend/cypress/support/e2e.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import "./commands"; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/frontend/cypress/tsconfig.json b/frontend/cypress/tsconfig.json index eb38171b..b5b2f972 100644 --- a/frontend/cypress/tsconfig.json +++ b/frontend/cypress/tsconfig.json @@ -1,8 +1,8 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["es5", "dom"], +{ + "compilerOptions": { + "target": "es5", + "lib": ["es5", "dom"], "types": ["cypress"] - }, - "include": ["./**/*"] + }, + "include": ["./**/*"] } diff --git a/frontend/index.html b/frontend/index.html index a53b7942..3d3ce834 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,21 +1,36 @@ - + - - - - + + + + Basegun - - - - - - + + + + + +
diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json index 38caa457..88cf2e5b 100644 --- a/frontend/jsconfig.json +++ b/frontend/jsconfig.json @@ -8,7 +8,7 @@ }, "moduleResolution": "node", "sourceMap": true, - "jsx": "preserve", + "jsx": "preserve" }, "exclude": ["node_modules"] -} \ No newline at end of file +} diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 111f9ccb..84a9e004 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,35 +1,32 @@