diff --git a/README.md b/README.md
index 1ec848cc..9b3a4ec0 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ Try to find error log
* In terminal, run `docker logs basegun-backend`
* If you cannot access terminal or don't see anything, go to `localhost:5000/logs` or `preprod.basegun.fr/logs` to see latest logs.
-=> Error "missing model": Download model from the url specified in the [backend Dockerfile](https://github.com/datalab-mi/Basegun/blob/develop/backend/Dockerfile).
+=> ErrorPage "missing model": Download model from the url specified in the [backend Dockerfile](https://github.com/datalab-mi/Basegun/blob/develop/backend/Dockerfile).
### The website runs the analysis, but no image shows up
Use browser html inspector to find the url given in the image src.
diff --git a/docker-compose-backend.yml b/docker-compose-backend.yml
new file mode 100644
index 00000000..ba781d51
--- /dev/null
+++ b/docker-compose-backend.yml
@@ -0,0 +1,33 @@
+version: '3.8'
+services:
+ backend:
+ build:
+ args:
+ - http_proxy
+ - https_proxy
+ - no_proxy
+ - VERSION=${TAG:-2.0}
+ - CACERT_LOCATION
+ context: ./backend
+ target: ${BUILD_TARGET:-dev}
+ container_name: basegun-backend
+ environment:
+ - PATH_LOGS=/app/logs
+ - OS_USERNAME
+ - OS_PASSWORD
+ - OS_PROJECT_NAME
+ - http_proxy
+ - https_proxy
+ - UVICORN_LOG_LEVEL=${UVICORN_LOG_LEVEL}
+ - LOG_LEVEL=${UVICORN_LOG_LEVEL}
+ - no_proxy
+ - WORKSPACE=dev
+ - REQUESTS_CA_BUNDLE=$CACERT_LOCATION
+ image: basegun-backend:${TAG:-2.0}-dev
+ ports:
+ - 5000:5000
+ volumes:
+ - $PWD/backend/src:/app/src
+ - $PWD/backend/tests:/app/tests
+ - $PWD/backend/logs:/app/logs
+ - /app/src/weights
\ No newline at end of file
diff --git a/frontend/.editorconfig b/frontend/.editorconfig
new file mode 100644
index 00000000..64d3d6a0
--- /dev/null
+++ b/frontend/.editorconfig
@@ -0,0 +1,12 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
\ No newline at end of file
diff --git a/frontend/src/.eslintrc.js b/frontend/.eslintrc.js
similarity index 91%
rename from frontend/src/.eslintrc.js
rename to frontend/.eslintrc.js
index cccc5d3e..f9272f19 100644
--- a/frontend/src/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -30,7 +30,7 @@ module.exports = {
},
},
{
- files: ['**/src/**/*.e2e.js*'],
+ files: ['**/src/**/*.e2e.js*', '**/src/**/*.cy.js'],
globals: {
cy: true,
},
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 5cbb4e49..8dfbef8c 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -7,7 +7,7 @@ ARG NODE_EXTRA_CA_CERTS
COPY ./cert/. /etc/ssl/certs/
COPY ./package.json ./package-lock.json ./
-RUN npm ci
+RUN npm ci --legacy-peer-deps
COPY src ./src
COPY public ./public
diff --git a/frontend/cypress.config.js b/frontend/cypress.config.js
index 56bea616..32ed892e 100644
--- a/frontend/cypress.config.js
+++ b/frontend/cypress.config.js
@@ -5,12 +5,12 @@ const frontendPort = process.env.FRONTEND_PORT
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
- viewportWidth: 414,
- viewportHeight: 896,
+ viewportWidth: 414,
+ viewportHeight: 896,
video: false,
- }
-})
\ No newline at end of file
+ },
+})
diff --git a/frontend/cypress/e2e/firearm-fiability.cy.js b/frontend/cypress/e2e/firearm-fiability.cy.js
new file mode 100644
index 00000000..4fe45730
--- /dev/null
+++ b/frontend/cypress/e2e/firearm-fiability.cy.js
@@ -0,0 +1,76 @@
+describe('Firearm Fiability', () => {
+ it.skip('should identificate firearm with high fiability', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ 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.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('cartouches').first().click()
+ 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 B')
+ cy.getByDataTestid('arm-category').should(() => {
+ expect(localStorage.getItem('confidenceLevel')).to.eq('"high"')
+ })
+ })
+
+ it.skip('should identificate firearm with medium fiability', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ cy.getByDataTestid('select-file').as('fileInput')
+ cy.intercept('POST', '/api/upload').as('upload')
+ cy.get('@fileInput').selectFile('./cypress/images/arme-medium.jpg', { force: true })
+ cy.wait('@upload').then(({ response }) => {
+ expect(response.statusCode).to.eq(200)
+ })
+ cy.url().should('contain', '/guide-identification/resultat-typologie')
+ cy.contains('p', 'Arme semi-automatique ou automatique')
+ cy.get('h2').should(() => {
+ expect(localStorage.getItem('confidenceLevel')).to.eq('"medium"')
+ })
+ })
+
+ it.skip('should identificate firearm with low fiability', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ cy.getByDataTestid('select-file').as('fileInput')
+ cy.intercept('POST', '/api/upload').as('upload')
+ cy.get('@fileInput').selectFile('./cypress/images/arme-low.jpg', { force: true })
+ cy.wait('@upload').then(({ response }) => {
+ expect(response.statusCode).to.eq(200)
+ })
+ cy.url().should('contain', '/guide-identification/resultat-typologie')
+ cy.contains('p', '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
new file mode 100644
index 00000000..26a5669e
--- /dev/null
+++ b/frontend/cypress/e2e/firearm-identification.cy.js
@@ -0,0 +1,61 @@
+describe('Firearm Identification', () => {
+ it('should identificate real firearm', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ 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.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('cartouches').first().click()
+ 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 B')
+ cy.getByDataTestid('return-to-home-end').click()
+ cy.url().should('contain', '/accueil')
+ })
+
+ it('should identificate dummy firearm', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ 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.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')
+ 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
new file mode 100644
index 00000000..6121cfc6
--- /dev/null
+++ b/frontend/cypress/e2e/firearm-securing.cy.js
@@ -0,0 +1,30 @@
+describe('Securing Firearm and Identification', () => {
+ it('should secure and identificate real firearm', () => {
+ cy.accueil()
+ 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 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('h2', 'Mettre en sécurité mon arme')
+ cy.contains('li', 'Actionner la culasse')
+ cy.getByDataTestid('button-next').click()
+ cy.Identification()
+ 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/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/get-basegun-result.cy.js b/frontend/cypress/e2e/get-basegun-result.cy.js
deleted file mode 100644
index de7f16e3..00000000
--- a/frontend/cypress/e2e/get-basegun-result.cy.js
+++ /dev/null
@@ -1,45 +0,0 @@
-describe('Get Basegun result', () => {
- it('should have dummy button enabled', () => {
- cy.visit('/')
- cy.get('.swiper-button-next').click()
- cy.get('#position-button')
- .contains('J\'ai compris')
- .click()
- cy.url()
- .should('contain', '/accueil')
- cy.getByDataTestid('start')
- .contains('Démarrer')
- .click()
- cy.url()
- .should('contain', '/instructions')
- cy.contains('h3', 'Pour un résultat optimal')
- cy.contains('span', 'canon vers la droite')
-
- 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','/resultat')
- cy.getByDataTestid('legal-category').contains('Catégorie B')
- cy.getByDataTestid('dummy-button')
- .should('be.enabled')
- .contains('Vérifier si l\'arme est factice')
- })
-
- it('should have dummy button disabled', () => {
- cy.visit('/instructions')
- 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.url().should('contain','/resultat')
- cy.getByDataTestid('legal-category').contains('D')
- cy.getByDataTestid('dummy-button')
- .should('be.disabled')
- .contains('Pas de guide de vérification')
- })
-})
\ No newline at end of file
diff --git a/frontend/cypress/e2e/home.cy.js b/frontend/cypress/e2e/home.cy.js
index 086bb2c9..61ae7e13 100644
--- a/frontend/cypress/e2e/home.cy.js
+++ b/frontend/cypress/e2e/home.cy.js
@@ -1,14 +1,14 @@
describe('HomePage', () => {
- it('shoud visit HomePage', () => {
- cy.visit('/')
- cy.getByDataTestid('basegun-logo').should('exist')
- cy.contains('li', 'Basegun est une application')
- cy.get('.swiper-button-next').click()
- cy.contains('li', 'Une arme doit toujours être')
- cy.get('#position-button').contains('J\'ai compris').click()
- cy.url().should('contain', '/accueil')
- })
-
+ 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')
@@ -20,6 +20,8 @@ describe('HomePage', () => {
.click()
cy.url()
.should('contain', '/a-propos')
+ cy.contains('p', 'Basegun est un projet')
+
cy.get('#button-menu')
.click()
cy.getByRole('navigation')
@@ -27,6 +29,8 @@ describe('HomePage', () => {
.click()
cy.url()
.should('contain', '/mentions-legales')
+ cy.contains('p', 'basegun.fr')
+
cy.get('#button-menu')
.click()
cy.getByRole('navigation')
@@ -34,10 +38,10 @@ describe('HomePage', () => {
.click()
cy.url()
.should('contain', '/contact')
- cy.get('.information')
- .should('exist')
- .click()
- cy.url().should('contain','/')
- })
- }
-)
\ No newline at end of file
+ cy.contains('a', 'basegun@interieur.gouv.fr')
+ cy.getByRole('navigation')
+ .contains('a', 'Important')
+ .click({ force: true })
+ })
+},
+)
diff --git a/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js b/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js
new file mode 100644
index 00000000..2be7676a
--- /dev/null
+++ b/frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js
@@ -0,0 +1,16 @@
+describe('Old Mechanism Pistol Securing', () => {
+ it('should secure and identificate old mechanism pistol', () => {
+ cy.accueil()
+ 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
new file mode 100644
index 00000000..109afa77
--- /dev/null
+++ b/frontend/cypress/e2e/recommendations-civilians-vs-fsi.cy.js
@@ -0,0 +1,34 @@
+describe('Recommendations Civilians vs FSI', () => {
+ it('should show application version FSI', () => {
+ cy.accueil()
+ cy.getByDataTestid('secure-firearm')
+ .contains('Je veux mettre en sécurité mon arme')
+ .click()
+ cy.url().should('contain', '/guide-mise-en-securite/mise-en-securite-recommandations')
+ cy.contains('h2', 'Mettre en sécurité mon arme')
+ cy.contains('span', 'extraire des munitions')
+ cy.get('h2')
+ })
+
+ 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.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.url().should('contain', '/guide-mise-en-securite/mise-en-securite-recommandations')
+ cy.contains('h2', '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
new file mode 100644
index 00000000..d664802d
--- /dev/null
+++ b/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js
@@ -0,0 +1,25 @@
+describe('Shoulder Bolt Rifle Securing', () => {
+ it('should secure and identficate real shoulder bolt rifle', () => {
+ cy.accueil()
+ 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('h2', 'Mettre en sécurité mon arme')
+ cy.contains('li', 'Ouvrez la culasse')
+ cy.getByDataTestid('button-next').click()
+ cy.Identification()
+ 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/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')
+ })
+})
diff --git a/frontend/cypress/e2e/typology-revolver-identification.cy.js b/frontend/cypress/e2e/typology-revolver-identification.cy.js
new file mode 100644
index 00000000..26569659
--- /dev/null
+++ b/frontend/cypress/e2e/typology-revolver-identification.cy.js
@@ -0,0 +1,31 @@
+describe('Typology Revolver Identification', () => {
+ it('should identificate revolver typology', () => {
+ cy.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('h3', 'Pour un résultat optimal')
+ cy.contains('span', 'canon vers la droite')
+
+ 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.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/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
new file mode 100644
index 00000000..a10e817c
--- /dev/null
+++ b/frontend/cypress/e2e/typology-revolver-securing.cy.js
@@ -0,0 +1,91 @@
+describe('Typology Revolver Securing', () => {
+ it('should identificate revolver with small fireplaces (?) ', () => {
+ cy.accueil()
+ 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('h2', 'mise en sécurité')
+ cy.contains('p', 'les manipulations sont complexes')
+ cy.getByDataTestid('go-to-identification').click()
+ cy.url().should('contain', '/guide-identification/resultat-typologie')
+ cy.getByDataTestid('arm-category').should('contain', 'Catégorie D')
+ })
+
+ it('should secure and identificate real revolver with barrel button', () => {
+ cy.accueil()
+ 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('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')
+ cy.contains('Revolver bouton barillet').first().click()
+ cy.getByDataTestid('button-next').should('not.have.attr', 'disabled')
+ cy.getByDataTestid('button-next').click()
+ cy.getVideo()
+ cy.contains('h2', '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.Identification()
+ cy.contains('balles').first().click()
+ cy.getByDataTestid('next-step').click()
+ 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.accueil()
+ 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('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')
+ 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.get('.fr-accordions-group > li').first().click()
+ cy.getByDataTestid('button-step-mes').click({ multiple: true }, { force: true })
+ cy.getByDataTestid('button-next').should('not.have.attr', 'disabled')
+ cy.getByDataTestid('button-next').click()
+ cy.Identification()
+ cy.contains('balles').first().click()
+ cy.getByDataTestid('next-step').click()
+ 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/arme-low.jpg b/frontend/cypress/images/arme-low.jpg
new file mode 100644
index 00000000..498efe2b
Binary files /dev/null and b/frontend/cypress/images/arme-low.jpg differ
diff --git a/frontend/cypress/images/arme-medium.jpg b/frontend/cypress/images/arme-medium.jpg
new file mode 100644
index 00000000..91df7175
Binary files /dev/null and b/frontend/cypress/images/arme-medium.jpg differ
diff --git a/frontend/cypress/images/autre-epaule.jpeg b/frontend/cypress/images/autre-epaule.jpeg
deleted file mode 100644
index cb4f5068..00000000
Binary files a/frontend/cypress/images/autre-epaule.jpeg and /dev/null differ
diff --git a/frontend/cypress/images/pistolet-semi-auto.jpg b/frontend/cypress/images/pistolet-semi-auto.jpg
index ee88b763..5d95b0a4 100644
Binary files a/frontend/cypress/images/pistolet-semi-auto.jpg and b/frontend/cypress/images/pistolet-semi-auto.jpg differ
diff --git a/frontend/cypress/support/commands.js b/frontend/cypress/support/commands.js
index 2b9255e3..b412f7de 100644
--- a/frontend/cypress/support/commands.js
+++ b/frontend/cypress/support/commands.js
@@ -35,3 +35,75 @@ Cypress.Commands.add('getByDataTestid', (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('accueil', () => {
+ 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')
+})
+
+Cypress.Commands.add('miseEnSecurite', () => {
+ cy.getByDataTestid('secure-firearm')
+ .contains('Je veux mettre en sécurité mon arme')
+ .click()
+ cy.url().should('contain', '/guide-mise-en-securite/mise-en-securite-recommandations')
+ cy.contains('h2', 'Mettre en sécurité mon arme')
+ cy.contains('span', 'extraire des munitions')
+ cy.getByDataTestid('button-next')
+ .contains('Suivant')
+ .click()
+ cy.url().should('contain', '/guide-mise-en-securite/mise-en-securite-instructions')
+ cy.contains('h2', 'Mettre en sécurité mon arme')
+ cy.contains('span', 'DIRECTION SÛRE')
+ cy.getByDataTestid('button-next')
+ .contains('Suivant')
+ .click()
+ cy.url().should('contain', '/guide-mise-en-securite/mise-en-securite-introduction')
+ cy.contains('h2', 'Mettre en sécurité mon arme')
+ cy.contains('span', 'tutoriel adapté')
+ cy.getByDataTestid('button-next')
+ .contains('Suivant')
+ .click()
+})
+
+Cypress.Commands.add('Identification', () => {
+ cy.contains('h2', 'Fin de la mise en sécurité')
+ cy.getByDataTestid('go-to-identification').click()
+ cy.url().should('contain', '/guide-identification/resultat-typologie')
+ cy.contains('h2', 'Typologie de l\'arme')
+ cy.contains('p', 'Basegun a identifié votre arme')
+ 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')
+})
+
+Cypress.Commands.add('pasDeGuide', () => {
+ cy.contains('h2', '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/index.html b/frontend/index.html
index 747f2f63..a7551ed6 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -10,7 +10,7 @@
-
+