Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(dashboard): après avoir navigué dans différentes tabs d'un CR, quand on clique sur Retour, ça ne marchait pas - désormais on retourne dans la liste des CR #1644

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/
);
});
Loading