Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Sep 7, 2023
1 parent f2cd985 commit fb3ea0f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
7 changes: 2 additions & 5 deletions dashboard/src/scenes/person/components/TreatmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function TreatmentContent({ onClose, treatment, personId }) {
.join(' ')}
onSubmit={async (e) => {
e.preventDefault();
const ok = handleSubmit({ closeOnSubmit: true });
const ok = await handleSubmit({ closeOnSubmit: true });
if (ok && isNewTreatment) toast.success('Traitement créé !');
if (ok && !isNewTreatment) toast.success('Traitement mis à jour !');
}}>
Expand Down Expand Up @@ -377,10 +377,7 @@ function TreatmentContent({ onClose, treatment, personId }) {
/>
</div>
<div
className={[
'tw-flex tw-h-[50vh] tw-w-full tw-flex-col tw-gap-4 tw-overflow-y-auto',
activeTab !== 'Commentaires' && 'tw-hidden',
]
className={['tw-flex tw-h-[50vh] tw-w-full tw-flex-col tw-gap-4 tw-overflow-y-auto', activeTab !== 'Commentaires' && 'tw-hidden']
.filter(Boolean)
.join(' ')}>
<CommentsModule
Expand Down
30 changes: 15 additions & 15 deletions e2e/documents_organizer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ test("Documents organizer", async ({ page }) => {
await expect(page.getByRole("cell", { name: `image-3.jpg ${now2.format("dddd D MMMM YYYY HH:mm")} Créé par User Admin Test - 1` })).toBeVisible();

await page.getByRole("button", { name: "Passer les documents en plein écran" }).click();
await page.locator("#person-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents-documents").getByText("NomCréé parCréé le").click();
await page.locator("#social-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents").getByText("NomCréé parCréé le").click();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-3\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-3\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
// await expect(page.getByRole("button", { name: "📂 👪 Documents familiaux(1)" })).toBeVisible();
await page.getByRole("button", { name: "+ Ajouter un dossier" }).click();
Expand Down Expand Up @@ -135,16 +135,16 @@ test("Documents organizer", async ({ page }) => {
await page.getByRole("link", { name: "Personnes suivies" }).click();
await page.getByRole("cell", { name: person1Name }).click();
await page.getByRole("button", { name: "Passer les documents en plein écran" }).click();
await page.locator("#person-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents-documents").getByText("NomCréé parCréé le").click();
await page.locator("#social-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents").getByText("NomCréé parCréé le").click();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-4\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-4\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
// await expect(page.getByRole("button", { name: "📂 👪 Documents familiaux(1)" })).toBeVisible();
await expect(page.locator("span").filter({ hasText: `▼📂Dossier2(0)User Admin Test - 1${now3.format("dddd D MMMM YYYY HH:mm")}` })).toBeVisible();
Expand All @@ -171,16 +171,16 @@ test("Documents organizer", async ({ page }) => {
await page.getByRole("link", { name: "Personnes suivies" }).click();
await page.getByRole("cell", { name: person1Name }).click();
await page.getByRole("button", { name: "Passer les documents en plein écran" }).click();
await page.locator("#person-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents-documents").getByText("NomCréé parCréé le").click();
await page.locator("#social-documents").getByText("NomCréé parCréé le").click();
await page.locator("#family-documents").getByText("NomCréé parCréé le").click();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-1\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-2\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).not.toBeVisible();
await expect(
page.locator("#person-documents").filter({ hasText: `📃image-4\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
page.locator("#social-documents").filter({ hasText: `📃image-4\.jpgUser Admin Test - 1${now2.format("dddd D MMMM YYYY HH:mm")}` })
).toBeVisible();
// await expect(page.locator("#family-person-documents").getByRole("button", { name: "📂 👪 Documents familiaux(1)" })).toBeVisible();
await expect(
Expand Down
2 changes: 1 addition & 1 deletion e2e/persons_person-full-test-migrated-from-jest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ test("test", async ({ page }) => {
await page.getByRole("link", { name: "Personnes suivies" }).click();
await expect(page).toHaveURL("http://localhost:8090/person");

await page.getByRole("cell", { name: `${personName} Sortie de file active : Départ vers autre région` }).click();
await page.getByRole("cell", { name: `${personName} - test pseudo Sortie de file active : Départ vers autre région` }).click();
await page.getByRole("button", { name: "Supprimer" }).click();

await page.locator('input[name="textToConfirm"]').fill(personName);
Expand Down

0 comments on commit fb3ea0f

Please sign in to comment.