Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ❇️ add tutorial to secure a firearm #159

Merged
merged 81 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
47d5fde
refactor: :recycle: remove swiper component and add page instead
NadeigeC May 23, 2023
dffbe91
refactor: :recycle: remove swiper component and add page instead
NadeigeC May 23, 2023
8f7d110
refactor: :recycle: refactoring StartPage
NadeigeC May 25, 2023
72bba23
chore: :arrow_up: Upgrade dependancies
NadeigeC May 25, 2023
6f54591
feat: :bug: Fix routing
NadeigeC May 30, 2023
529aa61
feat: :sparkles: Add 2 buttons on StartPage
NadeigeC May 30, 2023
c0c2dcc
Merge pull request #161 from datalab-mi/feat/refactor-start-page
NadeigeC Jun 1, 2023
a8cab97
feat: :sparkles: Add new stepper to securing firearm
NadeigeC Jun 6, 2023
4398369
style: :art:
NadeigeC Jun 6, 2023
3c4eb3b
style: :lipstick: Move stepper title inline
NadeigeC Jun 7, 2023
e6a56c9
Merge pull request #162 from datalab-mi/feat/secure-a-firearm-stepper…
NadeigeC Jun 7, 2023
fc963e8
feat: :lipstick: Update Basegun baseline
NadeigeC Jun 7, 2023
78619a1
feat: :sparkles: Add tutorial content to secure a firearm
NadeigeC Jun 8, 2023
812e4ce
feat: :art: Add new identification guide
NadeigeC Jun 12, 2023
f98ee4d
WIP identification stepper
NadeigeC Jun 14, 2023
b815955
fix: :bug: Fix issues in routing
NadeigeC Jun 22, 2023
1d7bbe4
chore: :arrow_up: Upgrade dependancies
NadeigeC Jun 27, 2023
2672729
refactor: :art: Replace OnboardingPage by Swiper
NadeigeC Jun 27, 2023
28ab8c9
refactor: :art:
NadeigeC Jun 28, 2023
75a6f00
refactor: :recycle: Refactoring on page result
NadeigeC Jun 28, 2023
7d79ad7
fix: :art: Improve navigation in identificationGuide
NadeigeC Jul 4, 2023
2af9db6
style: :lipstick: Add style on ResultPage
NadeigeC Jul 4, 2023
3ef06c6
feat: :zap: WIP : Switch to different routes for each tutorial
NadeigeC Jul 5, 2023
5afc2d8
Merge pull request #163 from datalab-mi/feat/add-tutorial-content-to-…
NadeigeC Jul 6, 2023
7837843
add test video to secure a firearm
NadeigeC Jul 7, 2023
c4e1528
feat: :sparkles: Add securing-firearm-util.js file
NadeigeC Aug 8, 2023
8da8a2e
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
NadeigeC Aug 8, 2023
6333e98
fix: :white_check_mark: Fix tests E2E in securing branch
NadeigeC Aug 8, 2023
682096f
split securing-firearms-utils.js in 12 specifics files
NadeigeC Aug 8, 2023
048feb0
feat: :zap: Fix selectAmmo for dummy typologies
NadeigeC Aug 9, 2023
96a6c76
WIP
NadeigeC Aug 10, 2023
7a3430c
WIP MES
NadeigeC Aug 11, 2023
d520fa8
Merge branch 'enh/new_classification_model' into feat/add-tutorial-to…
NadeigeC Aug 11, 2023
cfba02e
upgrade dependencies
NadeigeC Aug 17, 2023
4d85af8
Wip MES
NadeigeC Aug 17, 2023
fd0f1cf
Add new photos and videos in several typologies
NadeigeC Aug 17, 2023
07f2c8c
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
NadeigeC Aug 17, 2023
4a5d133
Add specific select options for revolver
NadeigeC Aug 18, 2023
f9807b5
Change legal category if revolver black powder
NadeigeC Aug 18, 2023
e61f3b1
Add step 3 options for revolver
NadeigeC Aug 21, 2023
aa9375b
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
NadeigeC Aug 21, 2023
98e9313
Add content and style on accordions title
NadeigeC Aug 22, 2023
4b21325
wip css integration
NadeigeC Aug 22, 2023
50c986f
add minified header on mobile
NadeigeC Aug 23, 2023
766607d
style: :lipstick: Add whole logo only on start pages
NadeigeC Aug 24, 2023
81dd074
style: :lipstick: Add whole logo only on start pages
NadeigeC Aug 24, 2023
28f3534
fix DsfrRadioButton rich image ratio
NadeigeC Aug 28, 2023
a6cd71a
Merge pull request #171 from datalab-mi/fix/move-to-swiper-element
NadeigeC Aug 28, 2023
e307c9a
add accordion design to revolver-1873-fr
NadeigeC Aug 29, 2023
691823b
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
NadeigeC Aug 29, 2023
c449bd8
add video parts to accordion design
NadeigeC Aug 29, 2023
53bbacd
refactor: :recycle: Remove useless code and clean code
NadeigeC Aug 29, 2023
d406af5
refactor: :recycle: Renaming components
NadeigeC Aug 29, 2023
52e7069
refactor: :recycle: Add highlight bold on tutorial texts manipulations
NadeigeC Aug 30, 2023
809f407
refactor: :recycle: remove useless const identificationTutorial
NadeigeC Aug 30, 2023
5f52da4
wip-refacto
NadeigeC Aug 31, 2023
70ac6cf
refactor: :recycle: improve navigation in guideSecuringFirearms
NadeigeC Sep 1, 2023
53ea308
perf: :recycle: Downsize too big photos
NadeigeC Sep 1, 2023
8772cfe
Merge pull request #174 from datalab-mi/enh/remove-useless-code-and-r…
NadeigeC Sep 1, 2023
a4dd6d1
refactoring titles styles
NadeigeC Sep 4, 2023
241880f
chore: :arrow_down: Downgrade Cypress from 13.1.0 to 12.17.4
NadeigeC Sep 5, 2023
34904d6
refactor: :zap: Make accordion tutorial only visible for revolver 187…
NadeigeC Sep 7, 2023
7ef3856
style: :lipstick: add new routes names and new icons on securing tuto…
NadeigeC Sep 7, 2023
86580d7
feat: :sparkles: add a different security message for civilians
NadeigeC Sep 11, 2023
baec28e
fix: :bug: fix tutorial display for revolver different from 1892 and …
NadeigeC Sep 12, 2023
16864dc
style: :lipstick: add new images with focus for securing firearm
nutfdt Sep 12, 2023
41ad66b
style: :lipstick: add new photos with circle
NadeigeC Sep 13, 2023
aee5039
refactoring titles styles
NadeigeC Sep 4, 2023
9e47cd5
refactor: :recycle: wip refactor selectOption component
NadeigeC Sep 15, 2023
9728f02
Merge pull request #180 from datalab-mi/feat/display-different-securi…
NadeigeC Sep 18, 2023
de9f37a
fix: :bug: fix navigation for revolver typology
NadeigeC Sep 21, 2023
9f2d8fe
refactor: :recycle: Fix refactoring selectOption component
NadeigeC Sep 21, 2023
3a0f386
Merge pull request #183 from datalab-mi/enh/refactoring-selectoption-…
NadeigeC Sep 25, 2023
d466be9
chore: :arrow_up: upgrade dependencies
NadeigeC Sep 28, 2023
918633a
[WIP] test: 🧪 tests/e2e (#176)
nutfdt Oct 3, 2023
6b2c309
feat: :sparkles: handle video in options steps (#187)
nutfdt Oct 9, 2023
874a379
style: :lipstick: updated shotgun videos
nutfdt Oct 9, 2023
7ed6eb8
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
nutfdt Oct 9, 2023
09776e2
test: :white_check_mark: skip fiability test
nutfdt Oct 10, 2023
d59f199
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
nutfdt Oct 10, 2023
b98dfee
Merge branch 'develop' into feat/add-tutorial-to-secure-a-firearm
nutfdt Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,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.
Expand Down
3 changes: 3 additions & 0 deletions backend/requirements/common.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--extra-index-url https://download.pytorch.org/whl/torch
fastapi==0.68.0
uvicorn==0.14.0
torch==1.11.0
torchvision==0.12.0
python-multipart>=0.0.5
gelf-formatter==0.2.1
pyyaml>=5.4.1
Expand Down
33 changes: 33 additions & 0 deletions docker-compose-backend.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions frontend/.editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion frontend/src/.eslintrc.js → frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
},
},
{
files: ['**/src/**/*.e2e.js*'],
files: ['**/src/**/*.e2e.js*', '**/src/**/*.cy.js'],
globals: {
cy: true,
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
})
},
})
76 changes: 76 additions & 0 deletions frontend/cypress/e2e/firearm-fiability.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
describe('Firearm Fiability', () => {
it('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('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('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"')
})
})
})
61 changes: 61 additions & 0 deletions frontend/cypress/e2e/firearm-identification.cy.js
Original file line number Diff line number Diff line change
@@ -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')
})
})
30 changes: 30 additions & 0 deletions frontend/cypress/e2e/firearm-securing.cy.js
Original file line number Diff line number Diff line change
@@ -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')
})
})
45 changes: 0 additions & 45 deletions frontend/cypress/e2e/get-basegun-result.cy.js

This file was deleted.

38 changes: 21 additions & 17 deletions frontend/cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -20,24 +20,28 @@ describe('HomePage', () => {
.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.fr')

cy.get('#button-menu')
.click()
cy.getByRole('navigation')
.contains('a', 'Contact')
.click()
cy.url()
.should('contain', '/contact')
cy.get('.information')
.should('exist')
.click()
cy.url().should('contain','/')
})
}
)
cy.contains('a', '[email protected]')
cy.getByRole('navigation')
.contains('a', 'Important')
.click({ force: true })
})
},
)
16 changes: 16 additions & 0 deletions frontend/cypress/e2e/old-mechanism-pistol-securing.cy.js
Original file line number Diff line number Diff line change
@@ -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')
})
})
Loading