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

[#372] Reviewer doesnt see all zaken when reviewing for the 2nd time #375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions backend/src/openarchiefbeheer/utils/tests/gherkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Loading