From 805392c0d3446d23530f2a841288a4c5bc243199 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Fri, 20 Sep 2024 14:23:04 +0200 Subject: [PATCH 1/2] :test_tube: [#372] Test zaken visible in review page --- .../e2e/features/test_feature_list_review.py | 45 ++++++++++++++++++- .../openarchiefbeheer/utils/tests/gherkin.py | 6 +++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/backend/src/openarchiefbeheer/destruction/tests/e2e/features/test_feature_list_review.py b/backend/src/openarchiefbeheer/destruction/tests/e2e/features/test_feature_list_review.py index 2bd5fb4d..b5818f9c 100644 --- a/backend/src/openarchiefbeheer/destruction/tests/e2e/features/test_feature_list_review.py +++ b/backend/src/openarchiefbeheer/destruction/tests/e2e/features/test_feature_list_review.py @@ -4,12 +4,21 @@ from asgiref.sync import sync_to_async from openarchiefbeheer.accounts.tests.factories import UserFactory -from openarchiefbeheer.destruction.constants import ListRole, ListStatus +from openarchiefbeheer.destruction.constants import ( + ListRole, + ListStatus, + ReviewDecisionChoices, +) from openarchiefbeheer.utils.tests.e2e import browser_page from openarchiefbeheer.utils.tests.gherkin import GherkinLikeTestCase from openarchiefbeheer.zaken.tests.factories import ZaakFactory -from ...factories import DestructionListFactory, DestructionListItemFactory +from ...factories import ( + DestructionListFactory, + DestructionListItemFactory, + DestructionListItemReviewFactory, + DestructionListReviewFactory, +) @tag("e2e") @@ -84,6 +93,38 @@ async def test_scenario_reviewer_rejects_list(self): await self.then.page_should_contain_text(page, "Destruction list to review") await self.then.list_should_have_status(page, list, ListStatus.changes_requested) + @tag("gh-372") + async def test_scenario_reviewer_reviews_second_time(self): + @sync_to_async + def create_data(): + record_manager = UserFactory.create(role__can_start_destruction=True) + reviewer = UserFactory.create(username="Beoordelaar", password="ANic3Password", role__can_review_destruction=True) + + zaken = ZaakFactory.create_batch(2) + + list = DestructionListFactory.create( + author=record_manager, + assignee=reviewer, + status=ListStatus.ready_to_review, + uuid="00000000-0000-0000-0000-000000000000", + name="Destruction list to review", + ) + item = DestructionListItemFactory.create(destruction_list=list, zaak=zaken[0]) + DestructionListItemFactory.create(destruction_list=list, zaak=zaken[1]) + + review = DestructionListReviewFactory.create(destruction_list=list, author=reviewer, decision=ReviewDecisionChoices.rejected) + DestructionListItemReviewFactory.create(destruction_list=list, destruction_list_item=item, review=review) + + async with browser_page() as page: + await self.given.data_exists(create_data) + await self.when.reviewer_logs_in(page) + await self.then.path_should_be(page, "/destruction-lists") + + await self.when.user_clicks_button(page, "Destruction list to review") + await self.then.path_should_be(page, "/destruction-lists/00000000-0000-0000-0000-000000000000/review") + await self.then.page_should_contain_text(page, "Accorderen") + await self.then.this_number_of_zaken_should_be_visible(page, 2) + async def test_scenario_archivist_approves_list(self): async with browser_page() as page: record_manager = await self.given.record_manager_exists() diff --git a/backend/src/openarchiefbeheer/utils/tests/gherkin.py b/backend/src/openarchiefbeheer/utils/tests/gherkin.py index d5098230..c138a7de 100644 --- a/backend/src/openarchiefbeheer/utils/tests/gherkin.py +++ b/backend/src/openarchiefbeheer/utils/tests/gherkin.py @@ -459,3 +459,9 @@ async def zaaktype_filters_are(self, page, expected_filters): labels = dropdown[0].rstrip("\n").split("\n") self.testcase.assertEqual(labels, expected_filters) + + async def this_number_of_zaken_should_be_visible(self, page, number): + locator = page.get_by_role("grid") + rows = await locator.locator("tbody").locator("tr").all() + + self.testcase.assertEqual(len(rows), number) From 39b8a4dd45d758e0de92d50ca5c99eed41e7fedc Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Fri, 20 Sep 2024 14:23:34 +0200 Subject: [PATCH 2/2] :bug: [#372] Show all zaken in review page --- .../destructionlist/review/DestructionListReview.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/frontend/src/pages/destructionlist/review/DestructionListReview.tsx b/frontend/src/pages/destructionlist/review/DestructionListReview.tsx index 6e533f00..28406f2e 100644 --- a/frontend/src/pages/destructionlist/review/DestructionListReview.tsx +++ b/frontend/src/pages/destructionlist/review/DestructionListReview.tsx @@ -44,14 +44,7 @@ export function DestructionListReviewPage() { // The object list of the current page with review actions appended. const objectList = useMemo(() => { - const zakenOrReviewItems = - reviewItems && reviewItems.length ? reviewItems : paginatedZaken.results; - - const objects: Zaak[] = zakenOrReviewItems.map((zori) => - "zaak" in zori ? zori.zaak : zori, - ); - - return objects.map((zaak) => { + return paginatedZaken.results.map((zaak) => { const badge = getReviewBadgeForZaak(zaak); const actions = getActionsToolbarForZaak(zaak); return { ...zaak, Beoordeling: badge, Acties: actions };