Files
Recette_T2A/tests/t2a.spec.ts
2026-04-27 17:31:02 +02:00

2363 lines
155 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//npx playwright test tests/opt.spec.ts
//npx playwright test tests/opt.spec.ts --headed
//npx playwright test tests/opt.spec.ts --debug
//allure serve allure-results
import { Page, test, expect } from '@playwright/test';
// Réutilisation de la session
let finess = '640780417';
test.describe('Module T2A', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:8090/amadeaweb/AIVA_T2A_PREPROD');
await page.locator('input[class="ISTxtFld IS_LoginInput"]').fill('JENKINS');
await page.locator('input[class="ISPwdFld IS_PasswordInput"]').fill('JENKINSES');
await page.locator('a[class="IS_button IS_SubmitButton"]').click();
await page.getByText('Vos contrôles').waitFor({ state: 'visible', timeout: 20000 });
});
test.describe('I) Initialisation', () => {
test.describe('1- Vos contrôles', () => {
test('a) Nouveau contrôle', async ({ page }) => {
await page.getByTitle('Nouveau contrôle').nth(1).click();
await expect.soft(page.getByText('Nouveau Contrôle', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Vous pouvez initier un nouveau contrôle dès la réception du premier courrier dinformation. Pour cela, vous aurez besoin des fichiers PMSI')).toBeVisible();
await page.getByText('Démarrer').click();
// Etape 1
await expect(page.getByText('Etape 1 - Documenter le contrôle')).toBeVisible();
await expect.soft(page.getByRole('combobox', { name: 'Saisir un finess ou un nom d' })).toBeVisible();
await page.getByRole('combobox', { name: 'Saisir un finess ou un nom d' }).fill("0");
await expect.soft(page.getByRole('option', { name: '640780417 - CENTRE' })).toBeVisible();
await page.getByRole('option', { name: '640780417 - CENTRE' }).click();
await page.getByRole('row', { name: '*Année des dossiers contrôlés', exact: true }).getByRole('spinbutton').fill('2024');
await page.waitForTimeout(1000);
await page.getByRole('row', { name: '*Nom du Médecin Dim', exact: true }).getByRole('textbox').fill('JENKINS');
await page.getByRole('row', { name: '*Nom du Médecin Dim', exact: true }).getByRole('textbox').fill('JENKINS');
await page.waitForTimeout(1000);
await page.getByRole('row', { name: '*Nombre de champs contrôlés', exact: true }).getByRole('spinbutton').fill('3');
await page.waitForTimeout(1000);
await page.getByRole('row', { name: '*Nombre de champs contrôlés', exact: true }).getByRole('spinbutton').fill('3');
await page.getByText('ETAPE SUIVANTE').click();
await expect.soft(page.getByText('Les informations préfixées d\'')).toBeVisible();
await page.locator('label[is_id="0/sanctionable"] input').click();
await expect.soft(page.locator('label[is_id="0/sanctionable"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/CMA"] input').click();
await expect.soft(page.locator('label[is_id="0/CMA"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/P_HDJ"] input').click();
await expect.soft(page.locator('label[is_id="0/P_HDJ"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/P_UHCD"] input').click();
await expect.soft(page.locator('label[is_id="0/P_UHCD"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/AUTRE"] input').click();
await expect.soft(page.locator('label[is_id="0/AUTRE"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/S_CONTIGUS"] input').click();
await expect.soft(page.locator('label[is_id="0/S_CONTIGUS"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/R_GHM"] input').click();
await expect.soft(page.locator('label[is_id="0/R_GHM"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/S_NONFACT_AM"] input').click();
await expect.soft(page.locator('label[is_id="0/S_NONFACT_AM"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/DP_CCAM"] input').click();
await expect.soft(page.locator('label[is_id="0/DP_CCAM"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="0/PIE"] input').click();
await expect.soft(page.locator('label[is_id="0/PIE"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="1/sanctionable"] input').click();
await expect.soft(page.locator('label[is_id="1/sanctionable"] input')).toBeChecked();
await page.waitForTimeout(500);
await page.locator('label[is_id="2/sanctionable"] input').click();
await expect.soft(page.locator('label[is_id="2/sanctionable"] input')).toBeChecked();
await page.getByText('ETAPE SUIVANTE').click();
await expect(page.getByText('Etape 2 - Centraliser les')).toBeVisible();
await expect.soft(page.getByText('Télécharger des documents PDF')).toBeVisible();
await expect.soft(page.getByRole('textbox', { name: 'Document à télécharger' })).toBeVisible();
await page.getByRole('textbox', { name: 'Document à télécharger' }).click();
await expect.soft(page.getByRole('cell', { name: 'AVANT-Courrier Annonce du' })).toBeVisible();
await page.getByRole('cell', { name: 'AVANT-Courrier Annonce du' }).click();
await expect.soft(page.getByRole('button', { name: 'Choose File' })).toBeVisible();
const [fileChooser] = await Promise.all([
page.waitForEvent('filechooser'),
page.getByRole('button', { name: 'Choose File' }).click()
]);
//await fileChooser.setFiles('tests/testfiles/sample.pdf'); // A compléter
await page.getByText('ETAPE SUIVANTE').click();
await expect(page.getByText('Etape 3- Importer les')).toBeVisible();
await expect.soft(page.getByText('Télécharger les fichiers à traiter')).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Type de fichier à télécharger' })).toBeVisible();
await page.getByRole('textbox', { name: 'Type de fichier à télécharger' }).click();
await expect.soft(page.getByRole('cell', { name: 'Fichier DRUIDES' })).toBeVisible();
await page.getByRole('cell', { name: 'Fichier DRUIDES' }).click();
await expect.soft(page.getByRole('button', { name: 'Choose File' })).toBeVisible();
const [fileChooser3] = await Promise.all([
page.waitForEvent('filechooser'),
page.getByRole('button', { name: 'Choose File' }).click()
]);
//await fileChooser3.setFiles('tests/testfiles/sample.pdf'); // A compléter
await page.getByText('ETAPE SUIVANTE').click();
await expect.soft(page.getByRole('cell', { name: 'Il n\'y a aucun fichier à' })).toBeVisible();
await page.getByText('OK').click();
await page.locator('i.fa.fa-close').click();
await page.getByTitle('Ouvrir un contrôle').click();
//await page.getByRole('row', { name: '  330000662 - INSTITUT' }).locator('a').nth(2).click();
await page.locator('i.fa.fa-trash').first().click();
await expect.soft(page.getByRole('heading', { name: 'SUPPRESSION' })).toBeVisible();
await page.getByText('OK').click();
//await expect.soft(page.getByRole('heading', { name: 'CONFIRMER' })).toBeVisible();
//await page.getByText('Oui').click();
//await page.getByRole('option', { name: '640780417 - CENTRE' }).waitFor({ state: 'hidden' });
});
test('b) Modifier les informations du contrôle', async ({ page }) => {
await page.getByTitle('Modifier des informations sur le contrôle').last().click();
await expect(page.getByText(`Editer Contrôle 1 - ${finess} - CENTRE MEDICO-PSYCHOLOGIQUE 2023`)).toBeVisible();
// Etape 1
await expect(page.getByText(`Etape 1 - Documenter le contrôle N° 1 - ${finess}`)).toBeVisible();
await expect.soft(page.getByText('*Finess')).toBeVisible();
await expect.soft(page.getByPlaceholder('Saisir un finess ou un nom d\'établissement e')).toHaveValue(`${finess} - CENTRE HOSPITALIER DE LA COTE BASQUE`);
await expect.soft(page.getByText('*Année des dossiers contrôlés')).toBeVisible();
await expect.soft(page.locator('input[is_id="0/annee"]')).toHaveValue('2023');
await expect.soft(page.getByText('*Nom du Médecin Dim')).toBeVisible();
await expect.soft(page.locator('input[is_id="0/md"]')).toHaveValue('Amina ETTORCHI');
await expect.soft(page.getByText('*Nombre de champs contrôlés')).toBeVisible();
await expect.soft(page.locator('input[is_id="0/nb_champs_controles"]')).toHaveValue('5');
// Etape 2
await page.getByText('ETAPE SUIVANTE').click();
await expect(page.getByText('Etape 2 - Centraliser les documents reçus')).toBeVisible();
await expect(page.getByText('Télécharger des documents PDF')).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Document à télécharger' })).toBeVisible();
// Retour Etape 1
await page.getByText('ETAPE PRÉCÉDENTE').click();
await expect(page.getByText(`Etape 1 - Documenter le contrôle N° 1 - ${finess}`)).toBeVisible();
// Etape 3
await page.getByText('ETAPE SUIVANTE').click();
await page.getByText('Etape 2 - Centraliser les documents reçus').waitFor({ state: 'visible'});
await page.getByText('ETAPE SUIVANTE').click();
await expect(page.getByText('Etape 3- Importer les fichiers DRUIDES à traiter')).toBeVisible();
await expect.soft(page.getByText('Télécharger les fichiers à traiter')).toBeVisible();
await expect.soft(page.getByRole('textbox', { name: 'Type de fichier à télécharger' })).toBeVisible();
// Retour Etape 2
await page.getByText('ETAPE PRÉCÉDENTE').click();
await expect(page.getByText('Etape 2 - Centraliser les documents reçus')).toBeVisible();
// Etape 4
await page.getByText('ETAPE SUIVANTE').click();
await page.getByText('Etape 3- Importer les fichiers DRUIDES à traiter').waitFor({ state: 'visible'});
await page.getByText('ETAPE SUIVANTE').click();
await expect(page.getByRole('cell', { name: 'Il n\'y a aucun fichier à traiter' })).toBeVisible();
await page.getByText('OK').click();
// Quiter
await page.locator('i.fa.fa-close').first().click();
await page.getByText('Vos contrôles').waitFor({ state: 'visible' });
});
test('c) Ouvrir un contrôle', async ({ page }) => {
// Informations du contrôle
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id="2/Voir"]').last()).toBeVisible();
await page.locator('a[is_id="2/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
await expect(page.getByText(titre)).toBeVisible();
await expect(page.locator('li.active span')).toHaveText(`${phaseDuControle}`);
});
});
test.describe('2- Menu', () => {
test.beforeEach(async ({ page }) => {
// Clic sur l'icone dossier
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id*="/Voir"]').last()).toBeVisible();
await page.locator('a[is_id*="/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
await page.getByText(titre).waitFor({ state: 'visible', timeout: 20000 });
await page.getByText(`${phaseDuControle}`).waitFor({ state: 'visible'});
});
test.describe('a) Rapports', () => {
test('i) Initialiser le contrôle', async ({ page }) => {
await page.getByText('INITIER LE CONTRÔLE', { exact: true }).click();
await page.locator('h3.t').waitFor({ state: 'visible'});
//await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('RSS Candidats- Evaluation PMSI -')).toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Indicateurs clés');
// Analyses
await page.locator('a').filter({ hasText: 'Analyses' }).click();
await expect(page.getByText('Valorisation des dossiers potentiels')).toBeVisible();
// Tableau avec tout les champs
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).toBeVisible();
await expect.soft(page.getByText('Champ 3')).toBeVisible();
await expect.soft(page.getByText('Champ 4')).toBeVisible();
await expect.soft(page.getByText('Champ 5')).toBeVisible();
// const total = Number(await page.locator('span[is_id="0/Nb"]').textContent()) + Number(await page.locator('span[is_id="1/Nb"]').textContent()) + Number(await page.locator('span[is_id="2/Nb"]').textContent())
// + Number(await page.locator('span[is_id="3/Nb"]').textContent()) + Number(await page.locator('span[is_id="4/Nb"]').textContent());
// await expect.soft(page.locator('span[is_id="5/Nb"]')).toHaveText(total.toString());
// Filtrer par champs 1
await page.getByRole('textbox', { name: 'Tous les champs' }).click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).not.toBeVisible();
await expect.soft(page.getByText('Champ 3')).not.toBeVisible();
await expect.soft(page.getByText('Champ 4')).not.toBeVisible();
await expect.soft(page.getByText('Champ 5')).not.toBeVisible();
// Activité de soin
await page.getByText('Activité de soin').click();
await expect.soft(page.getByText('Champs déclinés par Activité de soin')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Activité de soin'}).nth(1)).toBeVisible();
// Exporter sous Excel
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter sous Excel').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('P0-R1.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('ii) Preparer le contrôle', async ({ page }) => {
await page.getByText('PREPARER LE CONTRÖLE', { exact: true }).click();
await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('Rapport des dossiers contrôlés au')).toBeVisible();
await expect.soft(page.getByText('Vue d\'ensemble des séjours contrôlés')).toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Indicateurs clés');
// Analyses
await page.locator('a').filter({ hasText: 'Analyse' }).click();
await expect(page.getByText('Valorisation des dossiers potentiels')).toBeVisible();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).toBeVisible();
await expect.soft(page.getByText('Champ 3')).toBeVisible();
await expect.soft(page.getByText('Champ 4')).toBeVisible();
await expect.soft(page.getByText('Champ 5')).toBeVisible();
const total = Number(await page.locator('span[is_id="0/Nb"]').textContent()) + Number(await page.locator('span[is_id="1/Nb"]').textContent()) + Number(await page.locator('span[is_id="2/Nb"]').textContent())
+ Number(await page.locator('span[is_id="3/Nb"]').textContent()) + Number(await page.locator('span[is_id="4/Nb"]').textContent());
await expect.soft(page.locator('span[is_id="5/Nb"]')).toHaveText(total.toString());
// Filtrer par champs 1
await page.getByRole('textbox', { name: 'Tous les champs' }).click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).not.toBeVisible();
await expect.soft(page.getByText('Champ 3')).not.toBeVisible();
await expect.soft(page.getByText('Champ 4')).not.toBeVisible();
await expect.soft(page.getByText('Champ 5')).not.toBeVisible();
// Activité de soin
await page.getByText('Activité de soin').click();
await expect.soft(page.getByText('Champs déclinés par Activité de soin')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Activité de soin'}).nth(1)).toBeVisible();
// Exporter sous Excel
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter sous Excel').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('P1-R1.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('iii) Suivre le contrôle', async ({ page }) => {
await page.getByText('SUIVRE LE CONTRÔLE', { exact: true }).click();
await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('Rapport du contrôle sur site au ')).toBeVisible();
await expect.soft(page.getByText('Vue d\'ensemble de la Concertation')).toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Indicateurs clés');
// Analyses
await page.locator('a').filter({ hasText: 'Analyse Concertation' }).click();
await expect(page.getByText('Analyse des résultats')).toBeVisible();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).toBeVisible();
await expect.soft(page.getByText('Champ 3')).toBeVisible();
await expect.soft(page.getByText('Champ 4')).toBeVisible();
await expect.soft(page.getByText('Champ 5')).toBeVisible();
const total = Number(await page.locator('span[is_id="0/Nb"]').first().textContent()) + Number(await page.locator('span[is_id="1/Nb"]').first().textContent()) + Number(await page.locator('span[is_id="2/Nb"]').first().textContent())
+ Number(await page.locator('span[is_id="3/Nb"]').first().textContent()) + Number(await page.locator('span[is_id="4/Nb"]').first().textContent());
await expect.soft(page.locator('span[is_id="5/Nb"]').first()).toHaveText(total.toString());
// Filtrer par champs 1
await page.locator('input[value^="Tous les champs"]').click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 2')).not.toBeVisible();
await expect.soft(page.getByText('Champ 3')).not.toBeVisible();
await expect.soft(page.getByText('Champ 4')).not.toBeVisible();
await expect.soft(page.getByText('Champ 5')).not.toBeVisible();
// Résultats de la concertation
await page.getByText('Résultat de la concertation').click();
await expect.soft(page.getByText('Champs déclinés par Résultat')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Résultats'}).nth(1)).toBeVisible();
// Exporter sous Excel
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter sous Excel').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('P2-R1.xlsx.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Analyse des DAS
await page.locator('a').filter({ hasText: 'Analyse des DAS' }).click();
await expect(page.getByText('Analyse des Résultats')).toBeVisible();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 3')).toBeVisible();
await expect.soft(page.getByText('Champ 4')).toBeVisible();
await expect.soft(page.getByText('Champ 5')).toBeVisible();
// Filtrer par champs 1
await page.locator('input[value^="Tous les champs"]').click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('Champ 1')).toBeVisible();
await expect.soft(page.getByText('Champ 3')).not.toBeVisible();
await expect.soft(page.getByText('Champ 4')).not.toBeVisible();
await expect.soft(page.getByText('Champ 5')).not.toBeVisible();
// Exporter sous Excel
const downloadPromiseDAS = page.waitForEvent('download');
await page.getByText('Exporter sous Excel').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const downloadDAS = await downloadPromiseDAS;
const suggestedNameDAS = downloadDAS.suggestedFilename();
expect.soft(suggestedNameDAS).toBe('P2-DAS.xlsx');
// Enregistrer le fichier
await downloadDAS.saveAs('downloads/' + suggestedNameDAS);
});
test('iv) Gerer l\'apres controle', async ({ page }) => {
await page.getByText('GERER L\'APRES CONTRÔLE', { exact: true }).click();
await page.locator('h3.t').waitFor({ state: 'visible'});
await expect.soft(page.getByText('Synthèse des indus').nth(1)).toBeVisible();
// Naviguer vers les autres onglets
//SUIVRE LE CONTRÖLE
await page.getByText('SUIVRE LE CONTRÔLE', { exact: true }).nth(1).click();
await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('Vue d\'ensemble de la Concertation')).toBeVisible();
//PREPARER LE CONTRÖLE
await page.getByText('PREPARER LE CONTRÖLE', { exact: true }).nth(1).click();
await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('Rapport des dossiers contrôlés au')).toBeVisible();
await expect.soft(page.getByText('Vue d\'ensemble des séjours contrôlés')).toBeVisible();
//INITIER LE CONTRôLE
await page.getByText('INITIER LE CONTRÔLE', { exact: true }).nth(1).click();
await expect(page.locator('h3.t')).toHaveText('Rapports');
await expect.soft(page.getByText('RSS Candidats- Evaluation PMSI -')).toBeVisible();
});
});
test('b) Vos fichiers', async ({ page }) => {
// Deplier le menu Fichiers
await page.getByRole('row', { name: 'Vos fichiers' }).locator('a').nth(1).click();
await expect.soft(page.getByText('DRUIDES')).toBeVisible();
await expect.soft(page.getByText('RSS_def')).toBeVisible();
// Telecharger la fiche de liaison
const downloadPromise = page.waitForEvent('download');
await page.getByText('Fichede Liaison').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe(`Fiche_liaison_${finess}.xlsx`);
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Ajout de fichier
await page.getByTitle('Télécharger un nouveau fichier').nth(1).click();
await expect.soft(page.getByText('Télécharger les fichiers à traiter')).toBeVisible();
});
test('c) Vos Documents', async ({ page }) => {
// Deplier le menu Fichiers
await page.getByRole('row', { name: 'Vos Documents' }).locator('a').nth(1).click();
await expect(page.getByText('Courrier Annonce du Contrôle')).toBeVisible();
// Visualiser le courrier d'annonce du contrôle
await page.getByText('Courrier Annonce du Contrôle').click();
await expect.soft(page.getByText(' DOCUMENT DU CONTRÔLE')).toBeVisible();
await expect.soft(page.getByText('Composant utilisateur inaccessible')).not.toBeVisible();
// Fermer le document
await page.locator('a.IS_icon.IS_FrameCloseButton').click();
await expect.soft(page.getByText('DOCUMENT DU CONTRÔLE')).not.toBeVisible();
// Ajout d'un document
await page.getByTitle('Voir ou rechercher un document').click();
await expect.soft(page.getByText('Télécharger des documents PDF')).toBeVisible();
await page.getByRole('textbox', { name: 'Document à télécharger' }).click();
await expect(page.getByRole('cell', { name: 'APRES-UCR - Argumentaire' })).toBeVisible();
await page.getByRole('cell', { name: 'APRES-UCR - Argumentaire' }).click();
await expect.soft(page.getByRole('button', { name: 'Choose File' })).toBeVisible();
await page.getByText('Valider').click();
await expect.soft(page.getByText('Télécharger des documents PDF')).not.toBeVisible();
});
test('d) Vos Envoies', async ({ page }) => {
// Deplier le menu Envoies
await page.getByRole('row', { name: 'Vos envois' }).locator('a').nth(1).click();
await expect.soft(page.getByText('Document généré pour UCR').first()).toBeVisible();
// Visualiser le document généré pour UCR
await page.getByRole('article').filter({ hasText: 'Vos Envois Type de' }).locator('a').nth(2).click();
await expect(page.getByText(' DOCUMENT GENERE POUR: UCR')).toBeVisible();
await expect.soft(page.getByText('Composant utilisateur inaccessible')).not.toBeVisible();
await expect.soft(page.getByText('Template inaccessible')).not.toBeVisible();
// Telecharger le fichier
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Télécharger le fichier').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe(`0-${finess}_DocumentPourUCR.html`);
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Fermer le document
await page.locator('a.IS_icon.IS_FrameCloseButton').click();
await expect.soft(page.getByText('DOCUMENT GENERE POUR: UCR')).not.toBeVisible();
});
test('e) Agenda et Notifications', async ({ page }) => {
// Agenda
await expect.soft(page.getByText('Agenda').nth(1)).not.toBeVisible();
await page.getByText('Agenda').first().click();
await expect.soft(page.getByText('Agenda').nth(1)).not.toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Agenda');
// Notifications
await page.getByText('Notifications').first().click();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Notifications');
// Passer d'un onglet à un autre
await page.locator('a').filter({ hasText: 'INITIER le contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('INITIER le contrôle');
await expect.soft(page.getByText('Notifications').first()).toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Notifications');
await page.getByText('Agenda').nth(1).click();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Agenda');
await page.locator('a').filter({ hasText: 'PREPARER le contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('PREPARER le contrôle');
await expect.soft(page.getByText('Agenda').nth(1)).toBeVisible();
await expect.soft(page.locator('li.active span').nth(1)).toHaveText('Agenda');
await page.locator('I.fa.fa-close').click();
await expect.soft(page.getByText('Agenda').nth(1)).not.toBeVisible();
await expect.soft(page.getByText('Notifications').first()).not.toBeVisible();
});
});
});
test.describe('II) INITIER le contrôle', () => {
test.beforeEach(async ({ page }) => {
// Clic sur l'icone dossier
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id*="/Voir"]').last()).toBeVisible();
await page.locator('a[is_id*="/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
await page.getByText(titre).waitFor({ state: 'visible', timeout: 20000 });
await page.getByText(`${phaseDuControle}`).waitFor({ state: 'visible'});
await page.locator('a').filter({ hasText: 'INITIER le contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('INITIER le contrôle');
await expect(page.getByText(`Le contrôle comporte ${nbChamps} champs`)).toBeVisible();
});
test('1- Liste des champs configurés', async ({ page }) => {
// Cliquer sur le plus rouge
await page.getByText('+', { exact: true }).click();
await expect.soft(page.getByText(' AJOUT CONFIGURATION')).toBeVisible();
await page.getByPlaceholder('Numéro du champ').fill('2');
await page.getByText('Valider').click();
await expect.soft(page.getByText('Configuration du champ 2')).toBeVisible();
await page.getByText('Afficher les champs configurés').click();
await expect.soft(page.getByText('Liste des champs configurés')).toBeVisible();
await page.locator('td[is_id="0/supp"]').click();
await expect.soft(page.getByRole('cell', { name: 'Confirmer-vous la suppression' })).toBeVisible();
await page.getByText('Non').last().click(); // Ne pas supprimer le champ
});
test('2- Valorisation des dossiers du RSSDEF', async ({ page }) => {
// Telecharger le fichier
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter sous Excel').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('P0-R1.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Filtrer par champs 1
await page.getByRole('textbox', { name: 'Tous les champs' }).click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByRole('cell', { name: 'Champ 1', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByText('Champ 2').nth(1)).not.toBeVisible();
await expect.soft(page.getByText('Champ 3').nth(1)).not.toBeVisible();
await expect.soft(page.getByText('Champ 4').nth(1)).not.toBeVisible();
await expect.soft(page.getByText('Champ 5').nth(3)).not.toBeVisible();
// Activité de soin
await page.getByText('Activité de soin').click();
await expect.soft(page.getByText('Champs déclinés par Activité de soin')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Activité de soin'}).nth(1)).toBeVisible();
// Sévérité GHM
await page.getByText('Sévérité GHM').click();
await expect.soft(page.getByText('Champs déclinés par Sévérité GHM')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Sévérité GHM'}).nth(1)).toBeVisible();
// Spécialité
await page.getByText('Spécialité').click();
await expect.soft(page.getByText('Champs déclinés par Spécialité')).toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Spécialité'}).nth(1)).toBeVisible();
// Fermer
await page.locator('i.fa.fa-remove').click();
await expect.soft(page.locator('span', {hasText: 'Activité de soin'}).nth(1)).not.toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Sévérité GHM'}).nth(1)).not.toBeVisible();
await expect.soft(page.locator('span', {hasText: 'Sévérité GHM'}).nth(1)).not.toBeVisible();
});
});
test.describe('III) PREPARER le contrôle', () => {
test.beforeEach(async ({ page }) => {
// Clic sur l'icone dossier
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id*="/Voir"]').last()).toBeVisible();
await page.locator('a[is_id*="/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
//await page.getByText(titre).waitFor({ state: 'visible', timeout: 20000 });
await page.getByText(`${phaseDuControle}`).waitFor({ state: 'visible'});
await page.locator('a').filter({ hasText: 'PREPARER le contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('PREPARER le contrôle');
await page.getByText('Synthèse Préparation').waitFor({ state: 'visible' });
//await expect.soft(page.getByText('Synthèse Préparation')).toBeVisible();
await expect.soft(page.getByText('Suivi de la Préparation')).toBeVisible();
});
test.describe('1- Synthèse Préparation (Fiche OGC)', () => {
test.beforeEach(async ({ page }, testInfo) => {
if (testInfo.title === 'g) Ouvrir la fiche avec le numero de séjour') {
return;
}
await page.getByRole('textbox', { name: 'Taper un numéro de séjour ou' }).fill('57');
await page.locator('header, .IS_Container, body').first().click(); // dehors du champ
await page.getByText('Fiche OGC 57').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
});
test('a) Changer l\état du dossier', async ({ page }) => {
// Cliquee sur "A risque"
await expect.soft(page.locator('a.IS_button.success').last()).toHaveText('Défendable')
await page.getByText('A risque', { exact: true }).click();
await expect.soft(page.locator('a.IS_button.warning')).toHaveText('A risque');
await page.getByText('Sauvegarder').click();
await expect.soft(page.getByRole('heading', { name: 'Sauvegarde' })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'A RISQUE', exact: true }).locator('span')).toBeVisible();
await page.getByText('Enregistrer et quitter la').click();
await page.getByText('Fiche OGC 57 - Séjour numéro').waitFor({ state: 'hidden' });
await page.getByRole('textbox', { name: 'Taper un numéro de séjour ou' }).fill('57');
await page.locator('header, .IS_Container, body').first().click(); // dehors du champ
await page.getByText('Fiche OGC 57').waitFor({ state: 'visible' });
await expect.soft(page.locator('a.IS_button.warning')).toHaveText('A risque');
// Cliquer sur Non défendable
await page.getByText('Défendable', { exact: true }).click();
await expect.soft(page.locator('a.IS_button.success').last()).toHaveText('Défendable')
await page.getByText('Sauvegarder').click();
await expect.soft(page.getByRole('heading', { name: 'Sauvegarde' })).toBeVisible();
await expect.soft(page.getByText('Fiche OGC 57 - Séjour numéro')).toBeVisible();
await page.getByText('Enregistrer', { exact: true }).click();
await expect.soft(page.getByText('Fiche OGC 57 - Séjour numéro')).toBeVisible();
});
test('b) Déplier pour plus d\informations', async ({ page }) => {
await page.locator('a.IS_icon.IS_Minimize_Button.IS_Restore').nth(5).click();
await expect(page.getByText('Homme de')).toBeVisible();
await expect(page.getByText('taux de remboursement AM ')).toBeVisible();
await expect(page.getByText('Le patient a été hospitalisé pendant')).toBeVisible();
});
test('c) Montants brut / AM', async ({ page }) => {
await expect.soft(page.getByRole('radio', { name: 'Montants AM' })).toBeChecked();
await expect.soft(page.getByText('MNT AM GHS-EXB+EXH', { exact: true })).toBeVisible();
await expect.soft(page.getByText('MNT AM SUPPL')).toBeVisible();
await expect.soft(page.getByText('MNT AM GAINS PERTE DU GHS')).toBeVisible();
await expect(page.getByRole('radio', { name: 'Montants Brut' })).not.toBeChecked();
await page.getByRole('radio', { name: 'Montants Brut' }).click();
await expect(page.getByRole('radio', { name: 'Montants Brut' })).toBeChecked();
await expect.soft(page.getByText('MNT BR GHS-EXB+EXH', { exact: true })).toBeVisible();
await expect.soft(page.getByText('MNT BR SUPPL')).toBeVisible();
await expect.soft(page.getByText('MNT BR GAINS PERTE DU GHS')).toBeVisible();
});
test('d) Forcer le MNT AM = 0', async ({ page }) => {
await page.getByText('Forcer les MNT AM = 0').click();
await expect(page.getByRole('heading', { name: 'Cochez les étapes' })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'PREPA', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'Toutes les étapes', exact: true })).toBeVisible();
await page.getByText('valider et quitter').click();
await expect.soft(page.getByRole('heading', { name: 'Cochez les étapes' })).not.toBeVisible();
});
test('e) Filtrer les diags et actes modifiés', async ({ page }) => {
await page.getByText('Filtrer les diags et actes modifiés').click();
await expect(page.getByText('Annuler le filtrage')).toBeVisible();
await page.getByText('Annuler le filtrage').click();
await expect.soft(page.getByText('Filtrer les diags et actes modifiés')).toBeVisible();
});
test('f) Plier déplier', async ({ page }) => {
// Donnees du séjour
await expect.soft(page.getByText('Unité médicale')).toBeVisible();
await page.locator('a.IS_icon.IS_Minimize_Button').nth(7).click();
await expect.soft(page.getByText('Unité médicale')).not.toBeVisible();
// Tableau de synthése
await expect.soft(page.getByRole('cell', { name: 'NB EXH', exact: true })).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'NB SUPPL SRC', exact: true })).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'NB SUPPL STF', exact: true })).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'IGS', exact: true })).not.toBeVisible();
await page.locator('a.IS_icon.IS_Minimize_Button').nth(9).click();
await page.waitForTimeout(1000); // attendre l'animation
await expect.soft(page.getByRole('cell', { name: 'NB EXH', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'NB SUPPL SRC', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'NB SUPPL STF', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'IGS', exact: true })).toBeVisible();
// Dates et modes d'entrée sortie
await expect.soft(page.getByRole('cell', { name: 'Prépa', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'Entrée Sortie', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_Minimize_Button').nth(10).click();
await page.waitForTimeout(1000); // attendre l'animation
await expect.soft(page.getByRole('cell', { name: 'Prépa', exact: true })).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'Entrée Sortie', exact: true })).not.toBeVisible();
// Diagnostiques
await expect.soft(page.getByRole('cell', { name: 'ETAB', exact: true }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'DP', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'DR', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_Minimize_Button').nth(11).click();
await page.waitForTimeout(1000); // attendre l'animation
await expect.soft(page.getByRole('cell', { name: 'ETAB', exact: true }).nth(2)).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'DP', exact: true }).nth(1)).not.toBeVisible();
await expect.soft(page.getByRole('cell', { name: 'DR', exact: true })).not.toBeVisible();
// Actes
await expect.soft(page.getByRole('cell', { name: 'ETAB', exact: true }).nth(1)).toBeVisible();
await page.locator('a.IS_icon.IS_Minimize_Button').nth(12).click();
await page.waitForTimeout(1000); // attendre l'animation
await expect.soft(page.getByRole('cell', { name: 'ETAB', exact: true }).nth(1)).not.toBeVisible();
// Fermer sans sauvegarder
await page.getByTitle('Fermer la fenêtre').click();
await expect.soft(page.getByRole('heading', { name: 'Confirmez' })).toBeVisible(); // vérifier que les modifications n'ont pas été sauvegardées
await page.getByText('Oui', { exact: true }).click();
await expect.soft(page.getByText('Fiche OGC 57')).not.toBeVisible();
});
test('g) Ouvrir la fiche avec le numero de séjour', async ({ page }) => {
await page.getByRole('textbox', { name: 'Taper un numéro de séjour ou' }).fill('2300394920230301');
await page.locator('header, .IS_Container, body').first().click(); // dehors du champ
await page.getByText('Fiche OGC 57').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
});
});
test.describe('2- Suivi de Préparation', () => {
test('a) Filtre dossier défondables', async ({ page }) => {
await page.getByRole('row', { name: 'Dossiers défendables ?' }).locator('a').click();
await expect.soft(page.getByRole('cell', { name: '706 séj', exact: true })).toBeVisible();
await page.getByText('Rien').click();
await expect.soft(page.locator('td[is_id="0/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="1/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="2/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="3/choix"] input')).not.toBeChecked();
// Cocher A risque
await page.locator('td[is_id="1/choix"] input').click();
await expect.soft(page.locator('td[is_id="1/choix"] input')).toBeChecked();
await expect.soft(page.getByText('Filtre Défendable = A risque')).toBeVisible();
// Tout cocher
await page.getByText('Tout', { exact: true }).click();
await expect.soft(page.locator('td[is_id="0/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="1/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="2/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="3/choix"] input')).toBeChecked();
});
test('Filtrage UM', async ({ page }) => {
await page.getByRole('row', { name: 'Filtrage UM ...+' }).locator('a').click();
await expect(page.getByText('Séléctionner un UM dans la liste')).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Liste des UM' })).toBeVisible();
await page.getByRole('textbox', { name: 'Liste des UM' }).click();
await page.getByRole('cell', { name: '0147' }).click();
await expect.soft(page.getByText('Filtre UM = 047')).toBeVisible();
await page.locator('i.fa.fa-close').click();
await expect.soft(page.getByText('Filtre UM = 047')).not.toBeVisible();
});
test('c) CMA et GHM', async ({ page }) => {
await expect(page.getByRole('radio', { name: 'Sévérité du GHM' })).toBeChecked();
await expect(page.getByRole('radio', { name: 'CMA du diagnostic' })).not.toBeChecked();
await expect.soft(page.getByText('Répartition des OGC par champ et sévérité du GHM')).toBeVisible();
await page.getByRole('radio', { name: 'CMA du diagnostic' }).click();
await expect(page.getByRole('radio', { name: 'CMA du diagnostic' })).toBeChecked();
await expect(page.getByRole('radio', { name: 'Sévérité du GHM' })).not.toBeChecked();
await expect.soft(page.getByText('Répartition des OGC par champ et par CMA(DA)')).toBeVisible();
});
});
test.describe('3- Liste des OGC', () => {
test.beforeEach(async ({ page }, testInfo) => {
if (testInfo.title === 'f) Ouvrir la liste OGC spécifique') {
return;
}
await page.getByText('56séj').click();
await page.getByRole('cell', { name: 'Liste des OGC filtrés' }).waitFor({ state: 'visible' });
});
test('a) Exporter la liste', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter La liste des OGC').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('Liste_OGC_Selectionnés_PREPA.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('b) Exporter les argumentaires', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter les argumentaires').click();
await expect.soft(page.getByRole('heading', { name: 'Fichiers Argumentaires' })).toBeVisible();
await page.getByText('Oui', { exact: true }).click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('Argufiles_');
expect.soft(suggestedName).toContain('.zip');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('c) Ouvrir les argumentaires', async ({ page }) => {
await page.locator('Div[style="top:0px"] div.l0.r0 a').first().click();
await page.getByRole('heading', { name: 'OGC : 1 - Séjour' }).waitFor({ state: 'visible' });
await expect.soft(page.getByText('ARGUMENTAIRES OGC ')).toBeVisible();
// Télécharger les argumentaires
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter les argumentaires').nth(1).click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('ExportArgu.html');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Memo
await page.getByText('Mémo').nth(1).click();
await expect.soft(page.getByRole('heading', { name: 'Mémo', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').nth(1).click();
// Recherche de saisines
await page.getByRole('row', { name: 'Aide à l\'argumentaire' }).locator('a').click();
await expect.soft(page.getByRole('textbox', { name: 'Rechercher un code ou un terme' })).toBeVisible();
await expect.soft(page.getByText('Saisines :')).toBeVisible();
await expect.soft(page.getByText('Agora :')).toBeVisible();
await page.getByRole('textbox', { name: 'Rechercher un code ou un terme' }).fill('transfusion');
await page.getByTitle('Rechercher', { exact: true }).click();
await expect.soft(page.getByText('Saisines :')).toBeVisible();
await expect.soft(page.getByText('Agora : ')).toBeVisible();
await expect.soft(page.getByText('Transfusion sanguine en DAS')).toBeVisible();
await page.getByText('Transfusion sanguine en DAS').click();
await expect.soft(page.getByText('transfusion sanguine en DAS').nth(1)).toBeVisible();
await expect.soft(page.getByText('Un dossier concerne un')).toBeVisible();
// Agora
await page.getByText('Agora : ').click();
await expect.soft(page.getByText('sujets trouvés sur Agora')).toBeVisible();
await expect.soft(page.locator('td[is_id="34/titre"]')).toBeVisible();
await page.getByText('Patient avec anémie traitée par transfusion : choix du DP (8 occurences)').click();
await expect.soft(page.getByText('Patient avec anémie traitée par transfusion : choix du DP', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Source : Agora, sujet N°')).toBeVisible();
const tdAgora = page.locator('div.IS_Container.IS_VFlowLayout.verticalScroll').nth(3);
// COCOA
await page.getByText('CoCoA : ').click();
await expect.soft(page.getByText('sujets trouvés sur la CoCoA')).toBeVisible();
await page.getByTitle('P02.3 (2 occurence)').click();
await expect.soft(page.getByText('CoCoA', { exact: true })).toBeVisible();
await expect.soft(page.getByRole('heading', { name: 'P02.3 - Foetus et nouveau-né' }).locator('b')).toBeVisible();
// Vérifier que tous les "transfusion" sont dans des <mark>
const allMarked = await tdAgora.evaluate((element) => {
const text = element.textContent || '';
const totalCount = (text.match(/transfusion/gi) || []).length;
const markedCount = element.querySelectorAll('mark').length;
const markedTexts = Array.from(element.querySelectorAll('mark'))
.filter(mark => /transfusion/i.test(mark.textContent || ''))
.length;
return {
totalTransfusions: totalCount,
markedTransfusions: markedTexts,
allAreMarked: totalCount === markedTexts && totalCount > 0
};
});
expect.soft(allMarked.allAreMarked).toBe(true);
await page.getByRole('link', { name: '53310' }).click();
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('link', { name: '53310' }).click()
]);
await newPage.waitForLoadState();
await expect(newPage).toHaveURL(/connect-pasrel\.atih\.sante\.fr\/cas\/login/);
// Recherche de Diags ou Actes
await page.getByText('Recherche de Diags ou Actes').click();
await expect.soft(page.getByText('Recherche de code')).toBeVisible();
await expect.soft(page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' })).toBeVisible();
await page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' }).fill('K8');
await expect.soft(page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' })).toBeVisible();
await page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' }).click();
// changement d'onglet
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
await page.getByText('DIM Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('DIM Argumentaire');
await page.getByText('Contrôleur Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Contrôleur Argumentaire');
await page.locator('a.IS_icon.IS_FrameCloseButton.hideCloseButton.hideCloseButton').click();
await expect.soft(page.locator('Div[style="top:0px"] div.l0.r0 a').first()).toHaveAttribute('title', 'Des argumentaires et un mémo ont été saisis');
});
test('d) Documments justificatifs', async ({ page }) => {
await page.locator('Div[style="top:0px"] div.l1.r1 a').first().click();
await expect(page.getByText('Documents Justificatifs', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Seuls les documents PDF sont affichables')).toBeVisible();
//await page.getByTitle('Télécharger un scan').click();
//await expect.soft(page.getByRole('heading', { name: 'Télécharger des documents PDF' })).toBeVisible();
//await page.getByRole('row', { name: 'Télécharger des documents PDF' }).locator('a').click();
//await expect.soft(page.getByRole('heading', { name: 'Télécharger des documents PDF' })).not.toBeVisible();
await page.locator('i.fa.fa-folder').first().click();
await expect.soft(page.locator('ul.active li')).toBeVisible();
await page.locator('ul.active li').click();
// Version originale
await expect(page.getByRole('heading', { name: '.pdf' })).toBeVisible();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toHaveText('Version originale');
// Télecharger le justificatif original
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('.pdf');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Version modifiée
await page.getByText('Version modifiée').click();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toContainText('Version modifiée');
//Défiler entre les pages
await page.getByRole('cell', { name: 'Page 1' }).locator('a').click();
await page.waitForTimeout(1000); // attendre le chargement
//if (await page.getByRole('cell', { name: 'Page 2' }).first().isVisible()) {
await page.getByRole('cell', { name: 'Page 2' }).first().click();
//}
await expect.soft(page.getByRole('cell', { name: 'Page 2' })).toBeVisible();
// Retour à la page 1 avec la flèche gauche
await page.getByTitle('Page précédente').click();
await expect.soft(page.getByRole('cell', { name: 'Page 1' })).toBeVisible();
// Télecharger le justificatif modifié
const downloadPromiseModif = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const downloadModif = await downloadPromiseModif;
const suggestedNameModif = downloadModif.suggestedFilename();
expect.soft(suggestedNameModif).toContain('modif.pdf');
// Enregistrer le fichier
await downloadModif.saveAs('downloads/' + suggestedNameModif);
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: '.pdf' })).not.toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByText('Documents Justificatifs', { exact: true })).not.toBeVisible();
});
test('e) Ouvrir la fiche OGC', async({page}) => {
await page.locator('div[style="top:0px"] div.l2.r2 span').click();
await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
// Argumentaire
await page.locator('i.fa.fa-Commenting').last().click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
await page.getByText('DIM Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/DIM\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('f) Ouvrir la liste OGC spécifique', async({page}) => {
await page.getByTitle('montant 40 706€').click();
await page.getByText('Liste des OGC filtrés').waitFor({ state: 'visible' });
await expect.soft(page.getByText('num champ 1')).toBeVisible();
await expect.soft(page.getByText('Nb séjours préparation Reval 8')).toBeVisible();
});
});
test.describe('4- Fiche OGC', () => {
test.beforeEach(async ({ page }) => {
await page.getByTitle('montant 40 706€').click();
await page.getByText('Liste des OGC filtrés').waitFor({ state: 'visible' });
await expect.soft(page.getByText('num champ 1')).toBeVisible();
await expect.soft(page.getByText('Nb séjours préparation Reval 8')).toBeVisible();
await page.getByText('n°3', { exact: true }).click();
await page.getByText('Fiche OGC 3').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
});
test('a) Ajouter/Supprimer un diagnostique', async ({ page }) => {
// Ajout
await page.getByTitle('Ajouter des diagnostics').first().click();
await expect(page.getByRole('heading', { name: 'Ajout de diagnostics' })).toBeVisible();
await page.getByRole('textbox', { name: 'Saisir un code ou un mot et cliquer sur entrée pour voir les resultats' }).fill('K850');
await page.locator('a.IS_button.transparentBackGround i.fa.fa-search').click();
await expect(page.getByText('K850*PANCREATITE AIG. IDIOP')).toBeVisible();
await page.getByText('K850*PANCREATITE AIG. IDIOP').click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('DA : K850-PANCREATITE AIG. IDIOP')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).toBeVisible();
// Suppression
await page.getByRole('row', { name: 'K850 Pancreatite Aig.' }).locator('a[title="supprimmer le DA"]').click();
await expect.soft(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).not.toBeVisible();
});
test('a) Ajouter/Supprimer un Acte', async ({ page }) => {
// Ajout
await page.getByTitle('Ajouter des diagnostics').last().click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).toBeVisible();
await page.getByRole('combobox', { name: 'Taper des mots clé' }).fill('Neurochirurgie');
await expect(page.getByRole('option', { name: 'YYYY189' })).toBeVisible();
await page.getByRole('option', { name: 'YYYY189' }).click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('YYYY189 Activite 1 ajouté')).toBeVisible();
await expect.soft(page.locator('a[is_id="0/delete"]')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).not.toBeVisible();
await expect(page.getByRole('row', { name: 'YYYY189' })).toBeVisible();
// Suppression
await page.getByText('Prépa', { exact: true }).nth(3).click();
await page.waitForTimeout(1000);
await page.getByRole('row', { name: 'YYYY189' }).locator('a[title="supprimmer le DA"]').click();
await expect.soft(page.getByRole('row', { name: 'YYYY189' })).not.toBeVisible();
});
});
});
test.describe('IV) Suivre le contrôle', () => {
test.beforeEach(async ({ page }) => {
// Clic sur l'icone dossier
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id*="/Voir"]').last()).toBeVisible();
await page.locator('a[is_id*="/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
//await page.getByText(titre).waitFor({ state: 'visible', timeout: 20000 });
await page.getByText(`${phaseDuControle}`).waitFor({ state: 'visible'});
await page.locator('a').filter({ hasText: 'SUIVRE le contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('SUIVRE le contrôle');
await expect.soft(page.getByText('Synthèse des dossiers')).toBeVisible();
await expect.soft(page.getByText('Suivi du contrôle')).toBeVisible();
});
test('1- Filtre', async ({ page }) => {
await page.getByRole('row', { name: 'Déplier pour filtrer' }).locator('a').click();
// OGC
await expect.soft(page.getByText('706 OGC', { exact: true })).toBeVisible();
await page.getByPlaceholder('Ogc ou Séj').fill('57');
await page.locator('header, .IS_Container, body').first().click(); //Cliquer en dehors du champ
await expect.soft(page.getByText('1 OGC', { exact: true }).first()).toBeVisible();
// Réinitialiser le filtre
await page.getByPlaceholder('Ogc ou Séj').fill('');
await page.getByText('Déplier pour filtrer').click(); //Cliquer en dehors du champ
await expect.soft(page.getByText('706 OGC', { exact: true })).toBeVisible();
// Champs
await page.getByRole('textbox', { name: 'Tous les champs de contrôle' }).click();
await page.getByRole('row', { name: 'Champ 1', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('TotalChamp 1')).toBeVisible();
await expect.soft(page.getByText('56 OGC', { exact: true }).first()).toBeVisible();
// Réinitialiser le filtre
await page.getByRole('textbox', { name: 'Tous les champs de contrôle' }).click();
await page.getByRole('row', { name: 'Tous les champs', exact: true }).getByRole('cell').click();
// Dossiers préparés ou non
await page.getByRole('textbox', { name: 'Tous les dossiers préparés ou non' }).click();
await page.getByRole('row', { name: 'Tous les OGC préparés', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('699 OGC', { exact: true }).first()).toBeVisible();
// Dossiers concertés ou non
await page.getByRole('textbox', { name: 'Tous les dossiers concertés ou non' }).click();
await page.getByRole('row', { name: 'OGC Concertés Accord', exact: true }).getByRole('cell').click();
await expect.soft(page.getByText('552 OGC', { exact: true }).first()).toBeVisible();
// Dossier défendable ?
await page.getByRole('row', { name: 'Dossiers défendables ?' }).locator('a').click();
//await expect.soft(page.getByRole('cell', { name: '706 séj', exact: true })).toBeVisible();
await page.getByText('Rien').click();
await expect.soft(page.locator('td[is_id="0/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="1/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="2/choix"] input')).not.toBeChecked();
await expect.soft(page.locator('td[is_id="3/choix"] input')).not.toBeChecked();
// Cocher A risque
await page.locator('td[is_id="1/choix"] input').click();
await expect.soft(page.locator('td[is_id="1/choix"] input')).toBeChecked();
await expect.soft(page.getByText('Supprimmer les filtres')).toBeVisible();
// Tout cocher
await page.getByText('Tout', { exact: true }).click();
await expect.soft(page.locator('td[is_id="0/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="1/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="2/choix"] input')).toBeChecked();
await expect.soft(page.locator('td[is_id="3/choix"] input')).toBeChecked();
// Filtrage UM
await page.getByRole('row', { name: 'Filtrage UM ...+' }).locator('a').click();
await expect(page.getByText('Séléctionner un UM dans la liste')).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Liste des UM' })).toBeVisible();
await page.getByRole('textbox', { name: 'Liste des UM' }).click();
await page.getByRole('cell', { name: '0147' }).click();
await expect.soft(page.getByRole('cell', { name: '2 OGC', exact: true })).toBeVisible();
await page.locator('i.fa.fa-close').click();
await page.getByRole('cell', { name: '552 OGC', exact: true }).waitFor({ state: 'visible'});
//await expect.soft(page.getByRole('cell', { name: '552 OGC', exact: true })).toBeVisible();
});
test.describe('3- Liste des OGC', () => {
test.beforeEach(async ({ page }, testInfo) => {
await page.locator('a[is_id^="0/MD R"]').click();
await page.getByRole('cell', { name: 'Liste des OGC filtrés' }).waitFor({ state: 'visible' });
});
test('a) Exporter la liste', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter La liste des OGC').click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toBe('Liste_OGC_Selectionnés_PENDANT.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('b) Exporter les argumentaires', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter les argumentaires').click();
await expect.soft(page.getByRole('heading', { name: 'Fichiers Argumentaires' })).toBeVisible();
await page.getByText('Oui', { exact: true }).click();
await page.waitForTimeout(3000); // attente du téléchargement
//tester si le nom du fichier est correct
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('Argufiles_');
expect.soft(suggestedName).toContain('.zip');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('c) Ouvrir les argumentaires', async ({ page }) => {
await page.locator('Div[style="top:0px"] div.l0.r0 a').first().click();
await page.getByRole('heading', { name: 'OGC : 17 - Séjour' }).waitFor({ state: 'visible'});
await expect.soft(page.getByText('ARGUMENTAIRES OGC ')).toBeVisible();
// Télécharger les argumentaires
//const downloadPromise = page.waitForEvent('download');
//await page.getByText('Exporter les argumentaires').nth(1).click();
//const download = await downloadPromise;
//const suggestedName = download.suggestedFilename();
//expect.soft(suggestedName).toContain('ExportArgu.html');
// Enregistrer le fichier
//await download.saveAs('downloads/' + suggestedName);
// Memo
await page.getByText('Mémo').nth(1).click();
await expect.soft(page.getByRole('heading', { name: 'Mémo', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').nth(1).click();
// Recherche de saisines
await page.getByRole('row', { name: 'Aide à l\'argumentaire' }).locator('a').click();
await expect.soft(page.getByRole('textbox', { name: 'Rechercher un code ou un terme' })).toBeVisible();
await expect.soft(page.getByText('Saisines :')).toBeVisible();
await expect.soft(page.getByText('Agora : ')).toBeVisible();
await page.getByRole('textbox', { name: 'Rechercher un code ou un terme' }).fill('transfusion');
await page.getByTitle('Rechercher', { exact: true }).click();
await expect.soft(page.getByText('Saisines :')).toBeVisible();
await expect.soft(page.getByText('Agora :')).toBeVisible();
await expect.soft(page.getByText('Transfusion sanguine en DAS')).toBeVisible();
await page.getByText('Transfusion sanguine en DAS').click();
await expect.soft(page.getByText('transfusion sanguine en DAS').nth(1)).toBeVisible();
await expect.soft(page.getByText('Un dossier concerne un')).toBeVisible();
// Agora
await page.getByText('Agora :').click();
await expect.soft(page.getByText(' sujets trouvés sur Agora')).toBeVisible();
await expect.soft(page.locator('td[is_id="34/titre"]')).toBeVisible();
await page.getByText('Patient avec anémie traitée par transfusion : choix du DP (8 occurences)').click();
await expect.soft(page.getByText('Patient avec anémie traitée par transfusion : choix du DP', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Source : Agora, sujet N°')).toBeVisible();
await page.getByRole('link', { name: '53310' }).click();
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('link', { name: '53310' }).click()
]);
await newPage.waitForLoadState();
await expect(newPage).toHaveURL(/connect-pasrel\.atih\.sante\.fr\/cas\/login/);
// COCOA
await page.getByText('CoCoA : ').click();
await expect.soft(page.getByText('sujets trouvés sur la CoCoA')).toBeVisible();
await page.getByTitle('P02.3 (2 occurence)').click();
await expect.soft(page.getByText('CoCoA', { exact: true })).toBeVisible();
await expect.soft(page.getByRole('heading', { name: 'P02.3 - Foetus et nouveau-né' }).locator('b')).toBeVisible();
// Recherche de Diags ou Actes
await page.getByText('Recherche de Diags ou Actes').click();
await expect.soft(page.getByText('Recherche de code')).toBeVisible();
await expect.soft(page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' })).toBeVisible();
await page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' }).fill('K8');
await expect.soft(page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' })).toBeVisible();
await page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' }).click();
// changement d'onglet
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
await page.getByText('DIM Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('DIM Argumentaire');
await page.getByText('Contrôleur Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Contrôleur Argumentaire');
await page.locator('a.IS_icon.IS_FrameCloseButton.hideCloseButton.hideCloseButton').click();
await expect.soft(page.locator('Div[style="top:0px"] div.l0.r0 a').first()).toHaveAttribute('title', 'Des argumentaires et un mémo ont été saisis');
});
test('d) Documments justificatifs', async ({ page }) => {
await page.locator('Div[style="top:0px"] div.l1.r1 a').first().click();
await expect(page.getByText('Documents Justificatifs', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Seuls les documents PDF sont affichables')).toBeVisible();
//await page.getByTitle('Télécharger un scan').click();
//await expect.soft(page.getByRole('heading', { name: 'Télécharger des documents PDF' })).toBeVisible();
//await page.getByRole('row', { name: 'Télécharger des documents PDF' }).locator('a').click();
//await expect.soft(page.getByRole('heading', { name: 'Télécharger des documents PDF' })).not.toBeVisible();
await page.locator('i.fa.fa-folder').first().click();
await expect.soft(page.locator('ul.active li')).toBeVisible();
await page.locator('ul.active li').click();
// Version originale
await expect(page.getByRole('heading', { name: '.pdf' })).toBeVisible();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toHaveText('Version originale');
// Télecharger le justificatif original
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('.pdf');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Version modifiée
await page.getByText('Version modifiée').click();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toContainText('Version modifiée');
//Défiler entre les pages
await page.getByRole('cell', { name: 'Page 1' }).locator('a').click();
await page.waitForTimeout(1000); // attendre le chargement
//if (await page.getByRole('cell', { name: 'Page 2' }).first().isVisible()) {
await page.getByRole('cell', { name: 'Page 2' }).first().click();
//}
await expect.soft(page.getByRole('cell', { name: 'Page 2' })).toBeVisible();
// Retour à la page 1 avec la flèche gauche
await page.getByTitle('Page précédente').click();
await expect.soft(page.getByRole('cell', { name: 'Page 1' })).toBeVisible();
// Télecharger le justificatif modifié
const downloadPromiseModif = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const downloadModif = await downloadPromiseModif;
const suggestedNameModif = downloadModif.suggestedFilename();
expect.soft(suggestedNameModif).toContain('modif.pdf');
// Enregistrer le fichier
await downloadModif.saveAs('downloads/' + suggestedNameModif);
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: '.pdf' })).not.toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByText('Documents Justificatifs', { exact: true })).not.toBeVisible();
});
test.describe('e) Fiche OGC', () => {
test.beforeEach(async ({ page }) => {
await page.locator('div[style="top:0px"] div.l2.r2 span').click();
await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
await expect.soft(page.locator('a[is_id="0/PMD"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/MC"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/MD"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/CC"]').first()).toBeVisible();
});
test('i) Contrôleur', async ({ page }) => {
// Recopie l'ensemble du codage de la prepa
await expect.soft(page.getByRole('cell', { name: '07C131' }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2347' }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '3 261 €' }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-1 545 €' }).nth(2)).toBeVisible();
await page.getByTitle('Recopie l\'ensemble du codage de la PREPA (tout rum)').click();
await expect.soft(page.locator('td[is_id="1/MC"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="2/MC"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="3/MC"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="4/MC"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '0 €' }).nth(4)).toBeVisible();
// Recopie l'ensemble du codage de l'etab
await page.getByTitle('Recopie l\'ensemble du codage de l\'ETAB (tout rum)').click();
await expect.soft(page.locator('td[is_id="0/MC"] i.fa.fa-check').first()).toBeVisible();
// Ajout Diagnostic
await page.getByTitle('Ajouter des diagnostic', { exact: true }).nth(1).click();
await expect(page.getByRole('heading', { name: 'Ajout de diagnostics' })).toBeVisible();
await page.getByRole('textbox', { name: 'Saisir un code ou un mot et cliquer sur entrée pour voir les resultats' }).fill('K850');
await page.locator('a.IS_button.transparentBackGround i.fa.fa-search').click();
await expect(page.getByText('K850*PANCREATITE AIG. IDIOP')).toBeVisible();
await page.getByText('K850*PANCREATITE AIG. IDIOP').click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('DA : K850-PANCREATITE AIG. IDIOP')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).toBeVisible();
// Suppression
await page.getByRole('row', { name: 'K850 Pancreatite Aig.' }).locator('i.fa.fa-trash').nth(1).click();
await expect.soft(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).not.toBeVisible();
// Ajout Acte
await page.getByTitle('Ajouter des diagnostic', { exact: true }).nth(3).click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).toBeVisible();
await page.getByRole('combobox', { name: 'Taper des mots clé' }).fill('Neurochirurgie');
await expect(page.getByRole('option', { name: 'YYYY189' })).toBeVisible();
await page.getByRole('option', { name: 'YYYY189' }).click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('YYYY189 Activite 1 ajouté')).toBeVisible();
await expect.soft(page.locator('a[is_id="0/delete"]')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).not.toBeVisible();
await expect(page.getByRole('row', { name: 'YYYY189' })).toBeVisible();
// Suppression
await page.getByText('Contrôleur', { exact: true }).nth(3).click();
await page.waitForTimeout(1000);
await page.locator('a[is_id="0/MC_del"]').nth(6).click();
await expect.soft(page.getByRole('row', { name: 'YYYY189' })).not.toBeVisible();
// Argumentaire
await page.locator('a[is_id="0/MC"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Contrôleur\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('ii) DIM', async ({ page }) => {
// Recopie l'ensemble du codage du medecin controleur
await expect.soft(page.getByRole('cell', { name: '07C133', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2349', exact: true })).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '6 977 €'}).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2 171 €'}).nth(2)).toBeVisible();
await page.getByTitle('Recopie l\'ensemble du codage du Médecin contrôleur(tout rum)').click();
await expect.soft(page.getByRole('cell', { name: '07C131' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2347' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '3 261 €' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-1 545 €' }).nth(3)).toBeVisible();
// Recopie l'ensemble du codage de la prepa
await page.getByTitle('recopie l\'ensemble du codage de la préparation(tout rum)').click();
await expect.soft(page.locator('td[is_id="1/MD"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="2/MD"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="3/MD"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.locator('td[is_id="4/MD"] i.fa.fa-check').first()).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '0 €' }).nth(4)).toBeVisible();
// Ajout Diagnostic
await page.getByTitle('Ajouter des diagnostics').nth(2).click();
await expect(page.getByRole('heading', { name: 'Ajout de diagnostics' })).toBeVisible();
await page.getByRole('textbox', { name: 'Saisir un code ou un mot et cliquer sur entrée pour voir les resultats' }).fill('K850');
await page.locator('a.IS_button.transparentBackGround i.fa.fa-search').click();
await expect(page.getByText('K850*PANCREATITE AIG. IDIOP')).toBeVisible();
await page.getByText('K850*PANCREATITE AIG. IDIOP').click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('DA : K850-PANCREATITE AIG. IDIOP')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).toBeVisible();
// Suppression
await page.getByRole('row', { name: 'K850 Pancreatite Aig.' }).locator('i.fa.fa-trash').nth(1).click();
await expect.soft(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).not.toBeVisible();
// Ajout Acte
await page.getByTitle('Ajouter des diagnostics').nth(4).click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).toBeVisible();
await page.getByRole('combobox', { name: 'Taper des mots clé' }).fill('Neurochirurgie');
await expect(page.getByRole('option', { name: 'YYYY189' })).toBeVisible();
await page.getByRole('option', { name: 'YYYY189' }).click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('YYYY189 Activite 1 ajouté')).toBeVisible();
await expect.soft(page.locator('a[is_id="0/delete"]')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).not.toBeVisible();
await expect(page.getByRole('row', { name: 'YYYY189' })).toBeVisible();
// Suppression
await page.getByText('DIM', { exact: true }).nth(5).click();
await page.waitForTimeout(1000);
await page.locator('a[is_id="0/MD_del"]').nth(6).click();
await expect.soft(page.getByRole('row', { name: 'YYYY189' })).not.toBeVisible();
// Argumentaire
// DIM
await page.locator('a[is_id="0/MD"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/DIM\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('iii) Concertation', async ({ page }) => {
// Recopie l'ensemble du codage du medecin controleur
await expect.soft(page.getByRole('cell', { name: '07C131' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2347' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '3 261' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-1 545 €' }).nth(3)).toBeVisible();
// Recopie l'ensemble du codage du DIM
await page.getByTitle('Recopie l\'ensemble du codage du DIM(tout rum)').click();
await expect.soft(page.getByRole('cell', { name: '07C133', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2349', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '6 977 €'}).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2 171 €'}).nth(3)).toBeVisible();
// Recopie l'ensemble du codage du controleur
await page.getByTitle('recopie l\'ensemble du codage du MEDECIN CONTRÔLEUR(tout rum)').click();
await expect.soft(page.getByRole('cell', { name: '07C131' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2347' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '3 261 €' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-1 545 €' }).nth(3)).toBeVisible();
// Ajout Diagnostic
await page.getByTitle('Ajouter des diagnostic', { exact: true }).nth(2).click();
await expect(page.getByRole('heading', { name: 'Ajout de diagnostics' })).toBeVisible();
await page.getByRole('textbox', { name: 'Saisir un code ou un mot et cliquer sur entrée pour voir les resultats' }).fill('K850');
await page.locator('a.IS_button.transparentBackGround i.fa.fa-search').click();
await expect(page.getByText('K850*PANCREATITE AIG. IDIOP')).toBeVisible();
await page.getByText('K850*PANCREATITE AIG. IDIOP').click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('DA : K850-PANCREATITE AIG. IDIOP')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).toBeVisible();
// Suppression
await page.getByRole('row', { name: 'K850 Pancreatite Aig.' }).locator('i.fa.fa-trash').nth(2).click();
await expect.soft(page.getByRole('row', { name: 'K850 Pancreatite Aig.' })).not.toBeVisible();
// Ajout Acte
await page.getByTitle('Ajouter des actes').nth(1).click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).toBeVisible();
await page.getByRole('combobox', { name: 'Taper des mots clé' }).fill('Neurochirurgie');
await expect(page.getByRole('option', { name: 'YYYY189' })).toBeVisible();
await page.getByRole('option', { name: 'YYYY189' }).click();
await expect(page.getByTitle('Cliquer pour ajouter ce diagnostic')).toBeVisible();
await page.getByTitle('Cliquer pour ajouter ce diagnostic').click();
await expect.soft(page.getByText('YYYY189 Activite 1 ajouté')).toBeVisible();
await expect.soft(page.locator('a[is_id="0/delete"]')).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByRole('heading', { name: 'Saisie des actes' })).not.toBeVisible();
await expect(page.getByRole('row', { name: 'YYYY189' })).toBeVisible();
// Suppression
await page.getByText('Concertation').nth(10).click();
await page.waitForTimeout(1000);
await page.getByRole('row', { name: '24/05/2023  1 acte YYYY189 R' }).locator('a').nth(3).click();
await expect.soft(page.getByRole('row', { name: 'YYYY189' })).not.toBeVisible();
});
});
});
});
/*
test.describe('V) Gérer l\'après contrôle', () => {
test.beforeEach(async ({ page }) => {
// Clic sur l'icone dossier
const nomEtablissement = await page.getByTitle('Ouvrir 0').textContent();
const nomEtab = nomEtablissement?.split(' - ').pop()?.trim();
const annee = "2023"; //await page.locator('span[is_id="1/annee"]').textContent();
const nbChamps = "5"; //await page.locator('span[is_id="1/nb_champs_controles"]').textContent();
const phaseDuControle = 'GERER l\'après contrôle';
// Clic sur l'icone dossier
//await expect(page.getByTitle('Ouvrir 0').first()).toBeVisible();
//await page.getByTitle('Ouvrir 0').first().click();
await expect(page.locator('a[is_id*="/Voir"]').last()).toBeVisible();
await page.locator('a[is_id*="/Voir"]').last().click();
//Première arrivée
const titre = `Contrôle ${nomEtab} ${annee}${nbChamps} Champs contrôlés`;
//await page.getByText(titre).waitFor({ state: 'visible', timeout: 20000 });
await page.getByText(`${phaseDuControle}`).waitFor({ state: 'visible'});
//await page.locator('a').filter({ hasText: 'GERER l\'après contrôle' }).click();
await expect.soft(page.locator('li.active span').first()).toHaveText('GERER l\'après contrôle');
await expect.soft(page.getByText('Suivi et actions post concertation')).toBeVisible();
await expect.soft(page.getByText('Synthèse des indus')).toBeVisible();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('Vue d\'ensemble');
});
test.describe('1- UCR', () => {
test.beforeEach(async ({ page }, testInfo) => {
await page.getByText('UCR', { exact: true }).click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('UCR');
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Préparer l\'Envoi UCR');
});
test.describe('a) Préparer l\'Envoi UCR', () => {
test('i) Filtre', async ({ page }) => {
// Tour désélectionner
await page.getByText('Désélectionner tout').click();
await expect.soft(page.locator('div.l0.r0 input').first()).not.toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(1)).not.toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(2)).not.toBeChecked();
// Cocher les désaccords
await page.getByText('Cocher les dossiers en désaccords').click();
await expect.soft(page.locator('div.l0.r0 input').first()).toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(1)).toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(2)).toBeChecked();
// Télécharger le document UCR
const downloadPromise = page.waitForEvent('download');
await page.getByText('Générer le document pour UCR').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('DocumentPourUCR.html');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test.describe('e) Fiche OGC', () => {
test.beforeEach(async ({ page }) => {
await page.locator('div.l1.r1').nth(1).click();
await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
await expect.soft(page.locator('a[is_id="0/MD"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/CC"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/UCR"]').first()).toBeVisible();
await expect.soft(page.locator('a[is_id="0/ATIH"]').first()).toBeVisible();
});
test('i) UCR', async ({ page }) => {
// Recopie l'ensemble du codage du DIM
await expect.soft(page.getByRole('cell', { name: '07C141', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2351', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2 575 €' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-802 €' }).nth(3)).toBeVisible();
await page.getByTitle('Recopie l\'ensemble du codage DIM(tout rum)').first().click();
await expect.soft(page.locator('td[is_id="1/UCR"] i.fa.fa-check')).toBeVisible();
await expect.soft(page.locator('td[is_id="2/UCR"] i.fa.fa-check')).toBeVisible();
await expect.soft(page.locator('td[is_id="3/UCR"] i.fa.fa-check')).toBeVisible();
await expect.soft(page.locator('td[is_id="4/UCR"] i.fa.fa-check')).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '0 €' }).nth(5)).toBeVisible();
// Recopie l'ensemble du codage de la concertation
await page.getByTitle('recopie l\'ensemble du codage de la CONCERTATION(tout rum)').first().click();
await expect.soft(page.getByRole('cell', { name: '07C141', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2351', exact: true }).nth(1)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2 575 €' }).nth(3)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-802 €' }).nth(3)).toBeVisible();
});
test('ii) ATIH', async ({ page }) => {
// Recopie l'ensemble du codage du DIM
//await expect.soft(page.locator('td[is_id="1/ATIH"] i.fa.fa-check')).toBeVisible();
//await expect.soft(page.locator('td[is_id="2/ATIH"] i.fa.fa-check')).toBeVisible();
//await expect.soft(page.locator('td[is_id="3/ATIH"] i.fa.fa-check')).toBeVisible();
//await expect.soft(page.locator('td[is_id="4/ATIH"] i.fa.fa-check')).toBeVisible();
//await page.getByTitle('recopie l\'ensemble du codage DIM(tout rum)').nth(1).click();
//await expect.soft(page.getByRole('cell', { name: '0 €' }).nth(5)).toBeVisible();
// Recopie l'ensemble du codage de la concertation
await page.getByTitle('recopie l\'ensemble du codage de la CONCERTATION(tout rum)').nth(1).click();
await expect.soft(page.getByRole('cell', { name: '07C141', exact: true }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2351', exact: true }).nth(2)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '2 575 €' }).nth(4)).toBeVisible();
await expect.soft(page.getByRole('cell', { name: '-802 €' }).nth(4)).toBeVisible();
});
});
test('ii) Justificatifs', async ({ page }) => {
// Tour désélectionner
await page.getByText('Désélectionner tout').click();
await page.waitForTimeout(1000);
await page.getByText('Voir ou ajouterJustifs').click(); // Trier
await page.locator('div.l2.r2 a').first().click();
await expect.soft(page.getByRole('heading', { name: 'Documents & Justificatifs OGC' })).toBeVisible();
await page.locator('i.fa.fa-folder').first().click();
await expect.soft(page.locator('ul.active li')).toBeVisible();
await page.locator('ul.active li').click();
// Version originale
await expect.soft(page.getByRole('heading', { name: '.pdf' })).toBeVisible();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toHaveText('Version originale');
// Télecharger le justificatif original
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('.pdf');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Version modifiée
await page.getByText('Version modifiée').click();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toContainText('Version modifiée');
//Défiler entre les pages
await page.getByRole('cell', { name: 'Page 1' }).locator('a').click();
await page.waitForTimeout(1000); // attendre le chargement
if (await page.getByRole('cell', { name: 'Page 2' }).first().isVisible()) {
await page.getByRole('cell', { name: 'Page 2' }).first().click();
}
await expect.soft(page.getByRole('cell', { name: 'Page 2' })).toBeVisible();
// Retour à la page 1 avec la flèche gauche
await page.getByTitle('Page précédente').click();
await expect.soft(page.getByRole('cell', { name: 'Page 1' })).toBeVisible();
// Télecharger le justificatif modifié
const downloadPromiseModif = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const downloadModif = await downloadPromiseModif;
const suggestedNameModif = downloadModif.suggestedFilename();
expect.soft(suggestedNameModif).toContain('modif.pdf');
// Enregistrer le fichier
await downloadModif.saveAs('downloads/' + suggestedNameModif);
});
test('iii) Argumentaires', async ({ page }) => {
await page.locator('div.l3.r3 a').first().click();
await expect(page.getByText('ARGUMENTAIRES OGC')).toBeVisible();
// Télécharger les argumentaires
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter les argumentaires').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('ExportArgu.html');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Memo
await page.getByText('Mémo').click();
await expect.soft(page.getByRole('heading', { name: 'Mémo', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').click();
// Recherche de saisines
await page.getByText('Recherche de saisines').click();
await expect.soft(page.getByRole('textbox', { name: 'Rechercher un code ou un terme' })).toBeVisible();
await expect.soft(page.getByText('Saisines : 0')).toBeVisible();
await expect.soft(page.getByText('Agora : 0')).toBeVisible();
await page.getByRole('textbox', { name: 'Rechercher un code ou un terme' }).fill('transfusion');
await page.getByTitle('Rechercher', { exact: true }).click();
await expect.soft(page.getByText('Saisines : 6')).toBeVisible();
await expect.soft(page.getByText('Agora : ')).toBeVisible();
await expect.soft(page.getByText('Transfusion sanguine en DAS')).toBeVisible();
await page.getByText('Transfusion sanguine en DAS').click();
await expect.soft(page.getByText('transfusion sanguine en DAS').nth(1)).toBeVisible();
await expect.soft(page.getByText('Un dossier concerne un')).toBeVisible();
// Agora
await page.getByText('Agora : ').click();
await expect.soft(page.getByText(' sujets trouvés sur Agora')).toBeVisible();
await expect.soft(page.locator('td[is_id="34/titre"]')).toBeVisible();
await page.getByText('Patient avec anémie traitée par transfusion : choix du DP (8 occurences)').click();
await expect.soft(page.getByText('Patient avec anémie traitée par transfusion : choix du DP', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Source : Agora, sujet N°')).toBeVisible();
await page.getByRole('link', { name: '53310' }).click();
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('link', { name: '53310' }).click()
]);
await newPage.waitForLoadState();
await expect(newPage).toHaveURL(/connect-pasrel\.atih\.sante\.fr\/cas\/login/);
// Recherche de Diags ou Actes
await page.getByText('Recherche de Diags ou Actes').click();
await expect.soft(page.getByText('Recherche de code')).toBeVisible();
await expect.soft(page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' })).toBeVisible();
await page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' }).fill('K8');
await expect.soft(page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' })).toBeVisible();
await page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' }).click();
await page.waitForTimeout(1000); // attendre le chargement des résultats
// changement d'onglet
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour UCR Argumentaire');
await page.getByText('Résumé cas clinique').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
await page.getByText('DIM Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('DIM Argumentaire');
await page.getByText('Contrôleur Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Contrôleur Argumentaire');
await page.getByText('Retour UCR Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour UCR Argumentaire');
await page.getByText('Retour ATIH Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour ATIH Argumentaire');
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByText('ARGUMENTAIRES OGC')).not.toBeVisible();
});
});
test.describe('b) Pointer les retours UCR', () => {
async function allerPointerLesRetoursUCR(page : Page) {
await page.getByText('UCR', { exact: true }).click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('UCR');
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Préparer l\'Envoi UCR');
await page.getByText('Pointer les retours UCR').click();
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Pointer les retours UCR');
}
async function allerVueDensemble(page : Page) {
await page.getByText('Vue d\'ensemble').click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('Vue d\'ensemble');
await page.getByText('Synthèse des indus').waitFor({ state: 'visible'});
}
test.beforeEach(async ({ page }) => {
await allerPointerLesRetoursUCR(page);
});
test('i) Ouvrir la fiche OGC', async ({ page }) => {
await page.locator('i.fa.fa-pencil').first().click();
await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
// Argumentaire
// DIM
await page.locator('a[is_id="0/MD"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/DIM\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// UCR
await page.locator('a[is_id="0/UCR"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour UCR/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// ATIH
await page.locator('a[is_id="0/ATIH"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour ATIH/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('ii) Cohérence des données UCR', async ({ page }) => {
// 14 UCR = Codage Etablissement
const ligneOGC14Pointer = page.locator('font', { hasText: /^14$/ }).locator('..').locator('..').locator('..');
const ligneOGC14VEnsemble = page.locator('span', { hasText: /^14$/ }).locator('..').locator('..');
await ligneOGC14Pointer.locator('div.l1.r1 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC14VEnsemble.locator('span[title^="Indique si l\'UCR à valider la demande de l\'établissement"] i')).toBeVisible();
await expect.soft(ligneOGC14VEnsemble.locator('span[title^="Indique si l\'UCR a validé le choix du contrôleur"] i')).not.toBeVisible();
// 14 UCR = codage concertation
await allerPointerLesRetoursUCR(page);
await ligneOGC14Pointer.locator('div.l2.r2 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC14VEnsemble.locator('span[title^="Indique si l\'UCR à valider la demande de l\'établissement"] i')).not.toBeVisible();
await expect.soft(ligneOGC14VEnsemble.locator('span[title^="Indique si l\'UCR a validé le choix du contrôleur"] i')).toBeVisible();
// 16 UCR = Codage concertation
const ligneOGC16Pointer = page.locator('font', { hasText: /^17$/ }).locator('..').locator('..').locator('..');
const ligneOGC16VEnsemble = page.locator('span', { hasText: /^17$/ }).locator('..').locator('..');
await allerPointerLesRetoursUCR(page);
await ligneOGC16Pointer.locator('div.l2.r2 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC16VEnsemble.locator('span[title^="Indique si l\'UCR à valider la demande de l\'établissement"] i')).not.toBeVisible();
await expect.soft(ligneOGC16VEnsemble.locator('span[title^="Indique si l\'UCR a validé le choix du contrôleur"] i')).toBeVisible();
// 16 UCR = codage Etablissement
await allerPointerLesRetoursUCR(page);
await ligneOGC16Pointer.locator('div.l1.r1 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC16VEnsemble.locator('span[title^="Indique si l\'UCR à valider la demande de l\'établissement"] i')).toBeVisible();
await expect.soft(ligneOGC16VEnsemble.locator('span[title^="Indique si l\'UCR a validé le choix du contrôleur"] i')).not.toBeVisible();
});
test('iii) Précocher UCR = Concertation', async ({ page }) => {
await page.getByRole('checkbox', { name: 'Précochez OUI Contrôleur' }).click();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(0)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(1)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(2)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(3)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(4)).toBeChecked();
});
});
});
test.describe('2- ATIH', () => {
test.beforeEach(async ({ page }, testInfo) => {
await page.getByText('ATIH', { exact: true }).click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('ATIH');
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Préparer l\'Envoi ATIH');
});
test.describe('a) Préparer l\'Envoi ATIH', () => {
test('i) Filtre', async ({ page }) => {
// Tour désélectionner
await page.getByText('Désélectionner tout').click();
await expect.soft(page.locator('div.l0.r0 input').first()).not.toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(1)).not.toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(2)).not.toBeChecked();
// Cocher les désaccords
await page.getByText('Cocher les dossiers en dé').click();
await expect.soft(page.locator('div.l0.r0 input').first()).toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(1)).toBeChecked();
await expect.soft(page.locator('div.l0.r0 input').nth(2)).toBeChecked();
await page.locator('div.l4.r4 span[title="Dossier en désaccord"]').first().waitFor({ state: 'visible' });
await expect.soft(page.locator('div.l4.r4').nth(1).locator('span').first()).toHaveAttribute('title', 'Dossier en désaccord');
await expect.soft(page.locator('div.l4.r4').nth(2).locator('span').first()).toHaveAttribute('title', 'Dossier en désaccord');
await expect.soft(page.locator('div.l4.r4').nth(3).locator('span').first()).toHaveAttribute('title', 'Dossier en désaccord');
// Télécharger le document UCR
const downloadPromise = page.waitForEvent('download');
await page.getByText('Générer le document pour ATIH').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('DocumentPourATIH.html');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('ii) Ouvrir la fiche OGC', async ({ page }) => {
await page.locator('div.l1.r1').nth(1).click();
await page.getByText('Fiche OGC').nth(1).waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
// Argumentaire
// DIM
await page.locator('a[is_id="0/MD"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/DIM\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// Concertation
await page.locator('a[is_id="0/CC"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// UCR
await page.locator('a[is_id="0/UCR"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour UCR/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// ATIH
await page.locator('a[is_id="0/ATIH"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour ATIH/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('iii) Justificatifs', async ({ page }) => {
// Tour désélectionner
await page.getByText('Désélectionner tout').click();
await page.waitForTimeout(1000);
await page.getByText('Voir ou ajouterJustifs').click(); // Trier
await page.locator('div.l2.r2 a').first().click();
await expect.soft(page.getByRole('heading', { name: 'Documents & Justificatifs OGC' })).toBeVisible();
await page.locator('i.fa.fa-folder').first().click();
await expect.soft(page.locator('ul.active li')).toBeVisible();
await page.locator('ul.active li').click();
// Version originale
await expect(page.getByRole('heading', { name: '.pdf' })).toBeVisible();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toHaveText('Version originale');
// Télecharger le justificatif original
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('.pdf');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Version modifiée
await page.getByText('Version modifiée').click();
await expect.soft(page.locator('nav ul.IS_hmenu li a.active')).toContainText('Version modifiée');
//Défiler entre les pages
await page.getByRole('cell', { name: 'Page 1' }).locator('a').click();
await page.waitForTimeout(1000); // attendre le chargement
if (await page.getByRole('cell', { name: 'Page 2' }).first().isVisible()) {
await page.getByRole('cell', { name: 'Page 2' }).first().click();
}
await expect.soft(page.getByRole('cell', { name: 'Page 2' })).toBeVisible();
// Retour à la page 1 avec la flèche gauche
await page.getByTitle('Page précédente').click();
await expect.soft(page.getByRole('cell', { name: 'Page 1' })).toBeVisible();
// Télecharger le justificatif modifié
const downloadPromiseModif = page.waitForEvent('download');
await page.getByTitle('Télécharger la version').click();
const downloadModif = await downloadPromiseModif;
const suggestedNameModif = downloadModif.suggestedFilename();
expect.soft(suggestedNameModif).toContain('modif.pdf');
// Enregistrer le fichier
await downloadModif.saveAs('downloads/' + suggestedNameModif);
});
test('iv) Argumentaires', async ({ page }) => {
await page.locator('div.l3.r3 a').first().click();
await expect(page.getByText('ARGUMENTAIRES OGC')).toBeVisible();
// Télécharger les argumentaires
const downloadPromise = page.waitForEvent('download');
await page.getByText('Exporter les argumentaires').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('ExportArgu.html');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
// Memo
await page.getByText('Mémo').click();
await expect.soft(page.getByRole('heading', { name: 'Mémo', exact: true })).toBeVisible();
await page.locator('a.IS_icon.IS_FrameCloseButton').click();
// Recherche de saisines
await page.getByText('Recherche de saisines').click();
await expect.soft(page.getByRole('textbox', { name: 'Rechercher un code ou un terme' })).toBeVisible();
await expect.soft(page.getByText('Saisines : 0')).toBeVisible();
await expect.soft(page.getByText('Agora : 0')).toBeVisible();
await page.getByRole('textbox', { name: 'Rechercher un code ou un terme' }).fill('transfusion');
await page.getByTitle('Rechercher', { exact: true }).click();
await expect.soft(page.getByText('Saisines : 6')).toBeVisible();
await expect.soft(page.getByText('Agora : ')).toBeVisible();
await expect.soft(page.getByText('Transfusion sanguine en DAS')).toBeVisible();
await page.getByText('Transfusion sanguine en DAS').click();
await expect.soft(page.getByText('transfusion sanguine en DAS').nth(1)).toBeVisible();
await expect.soft(page.getByText('Un dossier concerne un')).toBeVisible();
// Agora
await page.getByText('Agora : ').click();
await expect.soft(page.getByText(' sujets trouvés sur Agora')).toBeVisible();
await expect.soft(page.locator('td[is_id="34/titre"]')).toBeVisible();
await page.getByText('Patient avec anémie traitée par transfusion : choix du DP (8 occurences)').click();
await expect.soft(page.getByText('Patient avec anémie traitée par transfusion : choix du DP', { exact: true })).toBeVisible();
await expect.soft(page.getByText('Source : Agora, sujet N°')).toBeVisible();
await page.getByRole('link', { name: '53310' }).click();
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('link', { name: '53310' }).click()
]);
await newPage.waitForLoadState();
await expect(newPage).toHaveURL(/connect-pasrel\.atih\.sante\.fr\/cas\/login/);
// Recherche de Diags ou Actes
await page.getByText('Recherche de Diags ou Actes').click();
await expect.soft(page.getByText('Recherche de code')).toBeVisible();
await expect.soft(page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' })).toBeVisible();
await page.getByRole('combobox', { name: 'Saisir un code ou un mot clé' }).fill('K8');
await expect.soft(page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' })).toBeVisible();
await page.getByRole('option', { name: 'K803 - CALCUL DES CANAUX BIL. AVEC ANGIOCHOLITE' }).click();
await page.waitForTimeout(1000); // attendre le chargement des résultats
// changement d'onglet
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour ATIH Argumentaire');
await page.getByText('Résumé cas clinique').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
await page.getByText('DIM Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('DIM Argumentaire');
await page.getByText('Contrôleur Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Contrôleur Argumentaire');
await page.getByText('Retour UCR Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour UCR Argumentaire');
await page.getByText('Retour ATIH Argumentaire').click();
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Retour ATIH Argumentaire');
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect(page.getByText('ARGUMENTAIRES OGC')).not.toBeVisible();
});
});
test.describe('b) Pointer les retours ATIH', () => {
async function allerPointerLesRetoursATIH(page : Page) {
await page.getByText('ATIH', { exact: true }).click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('ATIH');
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Préparer l\'Envoi ATIH');
await page.getByText('Pointer les retours ATIH').click();
await expect.soft(page.locator('a.IS_Tab_WithCloseButton.active').last()).toHaveText('Pointer les retours ATIH');
}
async function allerVueDensemble(page : Page) {
await page.getByText('Vue d\'ensemble').click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('Vue d\'ensemble');
await page.getByText('Synthèse des indus').waitFor({ state: 'visible'});
}
test.beforeEach(async ({ page }) => {
await allerPointerLesRetoursATIH(page);
});
test('i) Ouvrir la fiche OGC', async ({ page }) => {
await page.locator('i.fa.fa-pencil').first().click();
await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
await expect.soft(page.getByText('Label inaccessible')).not.toBeVisible(); // vérifier que les labels d'accessibilité ne sont pas présents sur les icônes ATIH
await expect.soft(page.getByText('Aucun DP / DR ou IGC pour ce RUM')).not.toBeVisible(); // vérifier que les données du séjour sont présentes et que ce n'est pas une fiche générique pour les séjours sans DP/DR ou IGC
// Argumentaire
// DIM
await page.locator('a[is_id="0/MD"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/DIM\s*ARGUMENTAIRE/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// Concertation
await page.locator('a[is_id="0/CC"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText('Résumé cas clinique');
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// UCR
await page.locator('a[is_id="0/UCR"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour UCR/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
// ATIH
await page.locator('a[is_id="0/ATIH"] i.fa.fa-Commenting').click();
await page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' }).waitFor({ state: 'visible' });
await expect.soft(page.locator('ul.IS_hmenu li a.active')).toHaveText(/Retour ATIH/i);
// Quitter
//await page.getByText('Quitter La page Argumentaires').click();
await page.locator('a.IS_icon.IS_FrameCloseButton').last().click();
await expect.soft(page.getByRole('heading', { name: 'Saisie et visualisation des argumentaires' })).not.toBeVisible();
});
test('ii) Cohérence des données ATIH', async ({ page }) => {
// 14 ATIH = OUI ETAB
const ligneOGC14Pointer = page.locator('font', { hasText: /^14$/ }).locator('..').locator('..').locator('..');
const ligneOGC14VEnsemble = page.locator('span', { hasText: /^14$/ }).locator('..').locator('..');
await ligneOGC14Pointer.locator('div.l1.r1 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC14VEnsemble.locator('div.l8.r8 span i')).toBeVisible();
await expect.soft(ligneOGC14VEnsemble.locator('div.l9.r9 span i')).not.toBeVisible();
// 14 ATIH = OUI CC
await allerPointerLesRetoursATIH(page);
await ligneOGC14Pointer.locator('div.l2.r2 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC14VEnsemble.locator('div.l8.r8 span i')).not.toBeVisible();
await expect.soft(ligneOGC14VEnsemble.locator('div.l9.r9 span i')).toBeVisible();
// 16 ATIH = OUI CC
const ligneOGC16Pointer = page.locator('font', { hasText: /^17$/ }).locator('..').locator('..').locator('..');
const ligneOGC16VEnsemble = page.locator('span', { hasText: /^17$/ }).locator('..').locator('..');
await allerPointerLesRetoursATIH(page);
await ligneOGC16Pointer.locator('div.l2.r2 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC16VEnsemble.locator('div.l8.r8 span i')).not.toBeVisible();
await expect.soft(ligneOGC16VEnsemble.locator('div.l9.r9 span i')).toBeVisible();
// 16 ATIH = codage Etablissement
await allerPointerLesRetoursATIH(page);
await ligneOGC16Pointer.locator('div.l1.r1 input').click();
await page.waitForTimeout(5000); // attendre le traitement
await allerVueDensemble(page);
await expect.soft(ligneOGC16VEnsemble.locator('div.l8.r8 span i')).toBeVisible();
await expect.soft(ligneOGC16VEnsemble.locator('div.l9.r9 span i')).not.toBeVisible();
});
test('iii) Précocher ATIH = Concertation', async ({ page }) => {
await page.getByText('Précocher ATIH = Concertation').click();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(0)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(1)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(2)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(3)).toBeChecked();
await expect.soft(page.locator('font').locator('..').locator('..').locator('..').locator('div.l2.r2 input').nth(4)).toBeChecked();
});
});
});
test.describe('3- Caisses', () => {
test.beforeEach(async ({ page }, testInfo) => {
await page.locator('a').filter({ hasText: 'Caisses' }).click();
await expect.soft(page.locator('a.active').nth(1)).toHaveText('Caisses');
await page.getByText('Synthèse des indus').waitFor({ state: 'visible'});
//await expect.soft(page.getByText('Montant dû à la CPAM')).toBeVisible();
await expect.soft(page.getByText('Montant à récupérer de la CPAM')).toBeVisible();
await expect.soft(page.getByText('Montant Contesté')).toBeVisible();
});
// test('a) Ouvrir la fiche OGC', async ({ page }) => {
// await page.locator('div.l0.r0').nth(1).click();
// await page.getByText('Fiche OGC').waitFor({ state: 'visible' });
//});
test('b) Export', async({page}) => {
await page.locator('a[title="Exporter sous excel les données du tableau"] i').click();
await page.waitForTimeout(2000); // attendre le téléchargement du fichier
const downloadPromise = page.waitForEvent('download');
await page.getByTitle('Exporter sous excel les données du tableau').click();
const download = await downloadPromise;
const suggestedName = download.suggestedFilename();
expect.soft(suggestedName).toContain('Notifications');
expect.soft(suggestedName).toContain('.xlsx');
// Enregistrer le fichier
await download.saveAs('downloads/' + suggestedName);
});
test('c) Cohérence des montants', async({page}) => {
const montantRecupcheck = page.locator('font', { hasText: /^8$/ }).locator('..').locator('..').locator('..').locator('div.l5.r5 label input');
const montantContestecheck = page.locator('font', { hasText: /^8$/ }).locator('..').locator('..').locator('..').locator('div.l6.r6 label input');
const montantDuValeur = page.locator('font', { hasText: /^8$/ }).locator('..').locator('..').locator('..').locator('div.l8.r8 span font');
const montantContesteValeur = page.locator('font', { hasText: /^8$/ }).locator('..').locator('..').locator('..').locator('div.l7.r7 span font');
// Cocher montant à récupérer
await montantRecupcheck.click();
await page.waitForTimeout(5000); // attendre le traitement
await expect.soft(montantDuValeur).toBeVisible();
await expect.soft(montantContesteValeur).not.toBeVisible();
// Cocher montant contesté
await montantContestecheck.click();
await page.waitForTimeout(5000); // attendre le traitement
await expect.soft(montantContesteValeur).toBeVisible();
await expect.soft(montantDuValeur).not.toBeVisible();
// Décocher les deux
await montantContestecheck.click();
await page.waitForTimeout(5000); // attendre le traitement
await expect.soft(montantDuValeur).not.toBeVisible();
await expect.soft(montantContesteValeur).not.toBeVisible();
});
});
});*/
});