-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: il est possible maintenant de poser des questions personnelles …
…aux usagés via les missions (#246) Co-authored-by: octo-guic <[email protected]>
- Loading branch information
Showing
13 changed files
with
139 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ debug.log* | |
/yarn-error.log* | ||
/_reports | ||
/build | ||
/playwright-report | ||
|
||
# Ignore miscellaneous | ||
.DS_Store | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import { QuestionRepository } from '@/kyc/ports/question.repository'; | ||
import { EventBus } from '@/shell/eventBus'; | ||
import { ToDoListEvent } from '@/toDoList/toDoListEventBusImpl'; | ||
|
||
export class EnvoyerReponseUsecase { | ||
constructor(private readonly questionRepository: QuestionRepository) {} | ||
constructor( | ||
private readonly questionRepository: QuestionRepository, | ||
private readonly eventBus: EventBus<ToDoListEvent> | ||
) {} | ||
|
||
async execute(utilisateurId: string, questionId: string, reponse: string[]): Promise<void> { | ||
await this.questionRepository.envoyerReponse(utilisateurId, questionId, reponse); | ||
this.eventBus.publish(ToDoListEvent.TODO_KYC_A_ETE_REPONDU); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,8 @@ | ||
import { test, expect, chromium } from '@playwright/test'; | ||
import { test, expect } from '@playwright/test'; | ||
import { connecterUtilisateur } from './utils/connecterUtilisateurs'; | ||
|
||
test('has title', async () => { | ||
const browser = await chromium.launch(); | ||
const context = await browser.newContext(); | ||
const page = await context.newPage(); | ||
|
||
await page.route('https://agir-back-dev.osc-fr1.scalingo.io/utilisateurs/login', route => { | ||
route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ | ||
utilisateur: { | ||
id: 'wojtek', | ||
nom: 'WOJCIK', | ||
prenom: 'Wojtek', | ||
email: '[email protected]', | ||
code_postal: '91120', | ||
commune: 'PALAISEAU', | ||
revenu_fiscal: null, | ||
nombre_de_parts_fiscales: 2.5, | ||
quizzProfile: { | ||
climat: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
dechet: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
loisir: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
logement: { | ||
level: 2, | ||
isCompleted: false, | ||
}, | ||
transport: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
alimentation: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
consommation: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
}, | ||
created_at: '2023-12-20T16:28:07.766Z', | ||
fonctionnalites_debloquees: ['aides', 'services', 'recommandations'], | ||
}, | ||
token: | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dGlsaXNhdGV1cklkIjoid29qdGVrIiwiaWF0IjoxNzAzMTU1MzM2LCJleHAiOjE3MDU3NDczMzZ9.bJOxx98NUoYDq3e0mXKgv-YjAq-ZfSRc4S05bgwvKdA', | ||
}), | ||
}); | ||
}); | ||
|
||
await page.goto('/authentification'); | ||
|
||
await page.fill('#email', '[email protected]'); | ||
await page.fill('#password-input', ''); | ||
|
||
await page.getByRole('button', { name: 'Se connecter' }).click(); | ||
await page.waitForURL('/coach/'); | ||
const page = await connecterUtilisateur(); | ||
|
||
await expect(page).toHaveTitle('Agir ! - Coach'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { connecterUtilisateur } from './utils/connecterUtilisateurs'; | ||
|
||
let page: Page; | ||
|
||
test.beforeAll(async () => { | ||
page = await connecterUtilisateur(); | ||
|
||
await page.route('https://agir-back-dev.osc-fr1.scalingo.io/kyc/1', route => { | ||
route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ | ||
id: '1', | ||
question: 'Comment avez vous connu le service ?', | ||
categorie: 'service', | ||
points: 10, | ||
type: 'libre', | ||
is_NGC: false, | ||
}), | ||
}); | ||
}); | ||
|
||
await page.goto('/kyc/1'); | ||
}); | ||
|
||
test('doit afficher le bon title et titre', async () => { | ||
await expect(page).toHaveTitle('Agir !'); | ||
await expect(page.getByRole('heading', { level: 1 })).toHaveText('Question pour mieux vous connaître'); | ||
}); | ||
|
||
test('reponse a un kyc doit afficher "Merci pour votre réponse"', async () => { | ||
await page.fill('#reponse', 'Ma réponse, lorem ipsum dolor'); | ||
await page.getByRole('button', { name: 'Valider' }).click(); | ||
|
||
expect(await page.textContent('#app > div > main > div > div > div > span.fr-display--xs.fr-mb-2w')).toBe( | ||
'Merci pour votre réponse !' | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Page, chromium } from '@playwright/test'; | ||
|
||
export const connecterUtilisateur: () => Promise<Page> = async () => { | ||
const browser = await chromium.launch(); | ||
const context = await browser.newContext(); | ||
const page = await context.newPage(); | ||
|
||
await page.route('https://agir-back-dev.osc-fr1.scalingo.io/utilisateurs/login', route => { | ||
route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ | ||
utilisateur: { | ||
id: 'wojtek', | ||
nom: 'WOJCIK', | ||
prenom: 'Wojtek', | ||
email: '[email protected]', | ||
code_postal: '91120', | ||
commune: 'PALAISEAU', | ||
revenu_fiscal: null, | ||
nombre_de_parts_fiscales: 2.5, | ||
quizzProfile: { | ||
climat: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
dechet: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
loisir: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
logement: { | ||
level: 2, | ||
isCompleted: false, | ||
}, | ||
transport: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
alimentation: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
consommation: { | ||
level: 1, | ||
isCompleted: false, | ||
}, | ||
}, | ||
created_at: '2023-12-20T16:28:07.766Z', | ||
fonctionnalites_debloquees: ['aides', 'services', 'recommandations'], | ||
}, | ||
token: | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dGlsaXNhdGV1cklkIjoid29qdGVrIiwiaWF0IjoxNzAzMTU1MzM2LCJleHAiOjE3MDU3NDczMzZ9.bJOxx98NUoYDq3e0mXKgv-YjAq-ZfSRc4S05bgwvKdA', | ||
}), | ||
}); | ||
}); | ||
|
||
await page.goto('/authentification'); | ||
await page.fill('#email', '[email protected]'); | ||
await page.fill('#password-input', ''); | ||
|
||
await page.getByRole('button', { name: 'Se connecter' }).click(); | ||
await page.waitForURL('/coach/'); | ||
|
||
return page; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters