Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-kellton committed Jul 12, 2024
1 parent 0294140 commit d1d0884
Showing 1 changed file with 37 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,29 @@ def grievances() -> [GrievanceTicket]:


def generate_grievance(
unicef_id: str = "GRV-0000001",
status: int = GrievanceTicket.STATUS_NEW,
category: int = GrievanceTicket.CATEGORY_REFERRAL,
created_by: User | None = None,
assigned_to: User | None = None,
business_area: BusinessArea | None = None,
priority: int = 1,
urgency: int = 1,
household_unicef_id: str = "HH-20-0000.0001",
updated_at: str = "2023-09-27T11:26:33.846Z",
created_at: str = "2022-04-30T09:54:07.827000",
unicef_id: str = "GRV-0000001",
status: int = GrievanceTicket.STATUS_NEW,
category: int = GrievanceTicket.CATEGORY_REFERRAL,
created_by: User | None = None,
assigned_to: User | None = None,
business_area: BusinessArea | None = None,
priority: int = 1,
urgency: int = 1,
household_unicef_id: str = "HH-20-0000.0001",
updated_at: str = "2023-09-27T11:26:33.846Z",
created_at: str = "2022-04-30T09:54:07.827000",
) -> GrievanceTicket:
created_by = User.objects.first() if created_by is None else created_by
assigned_to = User.objects.first() if assigned_to is None else assigned_to
business_area = BusinessArea.objects.filter(slug="afghanistan").first() if business_area is None else business_area
from hct_mis_api.apps.grievance.fixtures import GrievanceTicketFactory
GrievanceTicketFactory(
updated_at=updated_at,
assigned_to=assigned_to,
business_area=business_area,
created_by=created_by,
category=category,
)
return GrievanceTicket.objects.create(
**{
"business_area": business_area,
Expand All @@ -117,10 +125,10 @@ def generate_grievance(
@pytest.mark.usefixtures("login")
class TestSmokeGrievanceDashboard:
def test_smoke_grievance_dashboard(
self,
active_program: Program,
add_grievances: None,
pageGrievanceDashboard: GrievanceDashboard,
self,
active_program: Program,
add_grievances: None,
pageGrievanceDashboard: GrievanceDashboard,
) -> None:
pageGrievanceDashboard.getNavGrievance().click()
pageGrievanceDashboard.getNavGrievanceDashboard().click()
Expand All @@ -134,21 +142,21 @@ def test_smoke_grievance_dashboard(
assert "25" in pageGrievanceDashboard.getLabelizedFieldContainerTotalNumberOfClosedTicketsUserGenerated().text
assert "421.25 days" in pageGrievanceDashboard.getTicketsAverageResolutionTopNumber().text
assert (
"515 days"
in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionSystemGenerated().text
"515 days"
in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionSystemGenerated().text
)
assert (
"365 days" in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionUserGenerated().text
"365 days" in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionUserGenerated().text
)
GrievanceTicket._meta.get_field("updated_at").auto_now = True

def test_grievance_dashboard_happy_path(
self,
active_program: Program,
grievances: [GrievanceTicket],
pageGrievanceDashboard: GrievanceDashboard,
pageGrievanceTickets: GrievanceTickets,
pageGrievanceDetailsPage: GrievanceDetailsPage,
self,
active_program: Program,
grievances: [GrievanceTicket],
pageGrievanceDashboard: GrievanceDashboard,
pageGrievanceTickets: GrievanceTickets,
pageGrievanceDetailsPage: GrievanceDetailsPage,
) -> None:
pageGrievanceTickets.getNavGrievance().click()
pageGrievanceDashboard.getNavGrievanceDashboard().click()
Expand All @@ -161,13 +169,17 @@ def test_grievance_dashboard_happy_path(
assert "0" in pageGrievanceDashboard.getLabelizedFieldContainerTotalNumberOfClosedTicketsUserGenerated().text
assert "0 days" in pageGrievanceDashboard.getTicketsAverageResolutionTopNumber().text
assert (
"0 days" in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionSystemGenerated().text
"0 days" in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionSystemGenerated().text
)
assert "0 days" in pageGrievanceDashboard.getLabelizedFieldContainerTicketsAverageResolutionUserGenerated().text

pageGrievanceTickets.getNavGrievance().click()
pageGrievanceTickets.getTicketListRow()[0].click()
pageGrievanceDetailsPage.screenshot("1")
pageGrievanceDetailsPage.getButtonAssignToMe().click()
pageGrievanceDetailsPage.screenshot("2")
pageGrievanceDetailsPage.getButtonAssignToMe().click()
pageGrievanceDetailsPage.screenshot("3")
pageGrievanceDetailsPage.getButtonSetInProgress().click()
pageGrievanceDetailsPage.getButtonCloseTicket().click()
pageGrievanceTickets.getButtonConfirm().click()
Expand Down

0 comments on commit d1d0884

Please sign in to comment.