Skip to content

Commit

Permalink
fix(dashboard): après avoir navigué dans différentes tabs d'un CR, qu…
Browse files Browse the repository at this point in the history
…and on clique sur Retour, ça ne marchait pas - désormais on retourne dans la liste des CR (#1644)
  • Loading branch information
arnaudambro authored Sep 8, 2023
1 parent 389f437 commit ebcc0b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions dashboard/src/scenes/report/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import SelectTeamMultiple from '../../components/SelectTeamMultiple';
import TagTeam from '../../components/TagTeam';
import ReceptionService from '../../components/ReceptionService';
import { useLocalStorage } from '../../services/useLocalStorage';
import useSearchParamState from '../../services/useSearchParamState';
import { arrayOfitemsGroupedByActionSelector, arrayOfitemsGroupedByConsultationSelector, personsObjectSelector } from '../../recoil/selectors';
import { treatmentsState } from '../../recoil/treatments';
import { medicalFileState } from '../../recoil/medicalFiles';
Expand Down Expand Up @@ -145,7 +144,13 @@ const View = () => {
const history = useHistory();
const location = useLocation();
const searchParams = new URLSearchParams(location.search);
const [activeTab, setActiveTab] = useSearchParamState('tab', ['restricted-access'].includes(user.role) ? 'reception' : 'resume');
const [activeTab, setActiveTab] = useState(['restricted-access'].includes(user.role) ? 'reception' : 'resume');
const searchParamTab = searchParams.get('tab');
useEffect(() => {
if (searchParamTab) {
setActiveTab(searchParamTab);
}
}, [searchParamTab]);

const { refresh } = useDataLoader();

Expand Down
2 changes: 1 addition & 1 deletion e2e/actions_comments_urgents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test("Create action with comments", async ({ page }) => {
await page.getByRole("button", { name: "Actions et commentaires urgents et vigilance" }).click();

await page.locator('[data-test-id="action avec commentaire"]').getByRole("cell", { name: "action avec commentaire" }).click();
await expect(page).toHaveURL(/http:\/\/localhost:8090\/report\/.*\?reportsTeam=%5B%22.*%22%5D&tab=comment-created&actionId=.*/);
await expect(page).toHaveURL(/http:\/\/localhost:8090\/report\/.*\?reportsTeam=%5B%22.*%22%5D&actionId=.*/);
await page.getByRole("button", { name: "Commentaires (1)" }).click();
await expect(page.getByRole("heading", { name: "Action: action avec commentaire (créée par User Admin Test - 7)" })).toBeVisible();
await page.getByRole("button", { name: "Fermer" }).first().click();
Expand Down
8 changes: 4 additions & 4 deletions e2e/consultations_test-navigate-to-consultation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test("test", async ({ page }) => {

await page.locator('[data-test-id="faite"]').getByText("faite").click();
await expect(page).toHaveURL(
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&tab=consultations-created&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
);

await page.getByRole("button", { name: "Fermer" }).first().click();
Expand All @@ -150,7 +150,7 @@ test("test", async ({ page }) => {

await page.locator('[data-test-id="consult abc"]').getByText("consult abc").click();
await expect(page).toHaveURL(
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&tab=consultations-created&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
);

await page.getByRole("button", { name: "Fermer" }).first().click();
Expand All @@ -161,11 +161,11 @@ test("test", async ({ page }) => {

await page.locator('[data-test-id="faite"]').getByText("faite").click();
await expect(page).toHaveURL(
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&tab=consultations&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&consultationId=[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
);

await page.getByRole("button", { name: "Fermer" }).first().click();
await expect(page).toHaveURL(
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D&tab=consultations/
/http:\/\/localhost:8090\/report\/[0-9]{4}-[0-9]{2}-[0-9]{2}\?reportsTeam=%5B%22[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}%22%5D/
);
});

0 comments on commit ebcc0b6

Please sign in to comment.