From b12ff52c935b9ab90d9080e8d7a4717297396bf4 Mon Sep 17 00:00:00 2001 From: szymon-kellton <130459593+szymon-kellton@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:01:27 +0200 Subject: [PATCH] Fixed date problem in test_payment_plan_happy_path (#4042) --- .../selenium_tests/payment_module/test_payment_module.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/selenium_tests/payment_module/test_payment_module.py b/backend/selenium_tests/payment_module/test_payment_module.py index a9a6cf6046..1137d5a264 100644 --- a/backend/selenium_tests/payment_module/test_payment_module.py +++ b/backend/selenium_tests/payment_module/test_payment_module.py @@ -1,6 +1,6 @@ import os import zipfile -from datetime import datetime +from datetime import datetime, timedelta from time import sleep import openpyxl @@ -112,7 +112,7 @@ def clear_downloaded_files() -> None: @pytest.fixture def create_payment_plan(create_targeting: None) -> PaymentPlan: - tp = TargetPopulation.objects.first() + tp = TargetPopulation.objects.get(program__name="Test Program") payment_plan = PaymentPlan.objects.update_or_create( business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp, @@ -244,7 +244,7 @@ def test_payment_plan_happy_path( pageNewPaymentPlan.select_listbox_element(targeting.name).click() pageNewPaymentPlan.getInputStartDate().click() pageNewPaymentPlan.getInputStartDate().send_keys( - FormatTime(time=program.start_date + relativedelta(day=12)).numerically_formatted_date + FormatTime(time=program.start_date + timedelta(days=12)).numerically_formatted_date ) pageNewPaymentPlan.getInputEndDate().click() pageNewPaymentPlan.getInputEndDate().send_keys(FormatTime(time=program.end_date).numerically_formatted_date) @@ -260,7 +260,7 @@ def test_payment_plan_happy_path( assert "Test Program" in pagePaymentModuleDetails.getLabelProgramme().text assert "CZK" in pagePaymentModuleDetails.getLabelCurrency().text assert ( - FormatTime(time=program.start_date + relativedelta(day=12)).date_in_text_format + FormatTime(time=program.start_date + timedelta(days=12)).date_in_text_format in pagePaymentModuleDetails.getLabelStartDate().text ) assert FormatTime(time=program.end_date).date_in_text_format in pagePaymentModuleDetails.getLabelEndDate().text