From 1a27ec128f0eba084334a6ae837e105b413f3150 Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 11 Jul 2024 09:08:43 +0200 Subject: [PATCH 1/5] Problem with deadlock - test skiped: test_targeting_parametrized_rules_filters_and_or --- backend/selenium_tests/targeting/test_targeting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/selenium_tests/targeting/test_targeting.py b/backend/selenium_tests/targeting/test_targeting.py index 0a0b4272a2..f1750ff4c1 100644 --- a/backend/selenium_tests/targeting/test_targeting.py +++ b/backend/selenium_tests/targeting/test_targeting.py @@ -732,6 +732,7 @@ def test_targeting_parametrized_rules_filters( pageTargetingCreate.clickButtonTargetPopulationCreate() assert "Females Age 0 - 5: 11" in pageTargetingCreate.getCriteriaContainer().text + @pytest.mark.skip("Problem with deadlock during test - 202318") def test_targeting_parametrized_rules_filters_and_or( self, create_programs: None, From 20dc91d73fd4107d51ab820187b691dc12df901a Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 11 Jul 2024 10:12:02 +0200 Subject: [PATCH 2/5] Added xfail to test_targeting_parametrized_rules_filters_and_or --- .../targeting/test_targeting.py | 290 +++++++++--------- 1 file changed, 146 insertions(+), 144 deletions(-) diff --git a/backend/selenium_tests/targeting/test_targeting.py b/backend/selenium_tests/targeting/test_targeting.py index f1750ff4c1..e5c762b758 100644 --- a/backend/selenium_tests/targeting/test_targeting.py +++ b/backend/selenium_tests/targeting/test_targeting.py @@ -81,7 +81,7 @@ def household_refugee() -> Household: def get_program_with_dct_type_and_name( - name: str, dct_type: str = DataCollectingType.Type.STANDARD, status: str = Program.ACTIVE + name: str, dct_type: str = DataCollectingType.Type.STANDARD, status: str = Program.ACTIVE ) -> Program: BusinessArea.objects.filter(slug="afghanistan").update(is_payment_plan_applicable=True) dct = DataCollectingTypeFactory(type=dct_type) @@ -150,7 +150,8 @@ def test_smoke_targeting_page(self, create_programs: None, add_targeting: None, assert "Use IDs" in pageTargeting.getCreateUseIDs().text def test_smoke_targeting_create_use_filters( - self, create_programs: None, add_targeting: None, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate + self, create_programs: None, add_targeting: None, pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -165,7 +166,8 @@ def test_smoke_targeting_create_use_filters( pageTargetingCreate.getAutocompleteTargetCriteriaOption().click() def test_smoke_targeting_create_use_ids( - self, create_programs: None, add_targeting: None, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate + self, create_programs: None, add_targeting: None, pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -180,11 +182,11 @@ def test_smoke_targeting_create_use_ids( pageTargetingCreate.getInputIndividualids() def test_smoke_targeting_details_page( - self, - create_programs: None, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, + self, + create_programs: None, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -227,13 +229,13 @@ def test_smoke_targeting_details_page( @pytest.mark.usefixtures("login") class TestCreateTargeting: def test_create_targeting_for_people( - self, - sw_program: Program, - household_with_disability: Household, - household_without_disabilities: Household, - pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate, - pageTargetingDetails: TargetingDetails, + self, + sw_program: Program, + household_with_disability: Household, + household_without_disabilities: Household, + pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.navigate_to_page("afghanistan", sw_program.id) pageTargeting.getButtonCreateNew().click() @@ -259,20 +261,20 @@ def test_create_targeting_for_people( assert pageTargetingDetails.getCriteriaContainer().text == disability_expected_criteria_text assert Household.objects.count() == 2 assert ( - pageTargetingDetails.getHouseholdTableCell(1, 1).text - == household_with_disability.individuals.first().unicef_id + pageTargetingDetails.getHouseholdTableCell(1, 1).text + == household_with_disability.individuals.first().unicef_id ) assert len(pageTargetingDetails.getPeopleTableRows()) == 1 def test_create_targeting_for_normal_program( - self, - non_sw_program: Program, - household_with_disability: Household, - household_without_disabilities: Household, - household_refugee: Household, - pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate, - pageTargetingDetails: TargetingDetails, + self, + non_sw_program: Program, + household_with_disability: Household, + household_without_disabilities: Household, + household_refugee: Household, + pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.navigate_to_page("afghanistan", non_sw_program.id) pageTargeting.getButtonCreateNew().click() @@ -307,13 +309,13 @@ def test_create_targeting_for_normal_program( @pytest.mark.usefixtures("login") class TestTargeting: def test_targeting_create_use_ids_hh( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -328,23 +330,23 @@ def test_targeting_create_use_ids_hh( name=f"Target Population for {household_with_disability.unicef_id}" ) assert ( - "1" - == str(target_population.total_individuals_count) - == pageTargetingDetails.getLabelTargetedIndividuals().text + "1" + == str(target_population.total_individuals_count) + == pageTargetingDetails.getLabelTargetedIndividuals().text ) assert ( - str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text + str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text ) assert str(target_population.status) in pageTargetingDetails.getLabelStatus().text def test_targeting_create_use_ids_individual( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -357,23 +359,23 @@ def test_targeting_create_use_ids_individual( pageTargetingCreate.clickButtonTargetPopulationCreate() target_population = TargetPopulation.objects.get(name="Target Population for IND-88-0000.0002") assert ( - "4" - == str(target_population.total_individuals_count) - == pageTargetingDetails.getLabelTargetedIndividuals().text + "4" + == str(target_population.total_individuals_count) + == pageTargetingDetails.getLabelTargetedIndividuals().text ) assert ( - str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text + str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text ) assert str(target_population.status) in pageTargetingDetails.getLabelStatus().text pageTargetingDetails.getButtonRebuild().click() def test_targeting_rebuild( - self, - create_programs: None, - create_targeting: TargetPopulation, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + create_targeting: TargetPopulation, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -384,14 +386,14 @@ def test_targeting_rebuild( pageTargetingDetails.disappearStatusContainer() def test_targeting_mark_ready( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - filters: Filters, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + filters: Filters, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -406,12 +408,12 @@ def test_targeting_mark_ready( pageTargetingDetails.waitForLabelStatus("READY") def test_copy_targeting( - self, - create_programs: None, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") pageTargeting.selectGlobalProgramFilter(program.name).click() @@ -429,13 +431,13 @@ def test_copy_targeting( assert "8" in pageTargetingDetails.getLabelTargetedIndividuals().text def test_edit_targeting( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -455,12 +457,12 @@ def test_edit_targeting( assert "9" in pageTargetingDetails.getCriteriaContainer().text def test_delete_targeting( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -479,11 +481,11 @@ def test_delete_targeting( assert "Test NEW TP" in new_list[0].text def test_targeting_different_program_statuses( - self, - create_programs: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.status = Program.DRAFT @@ -522,14 +524,14 @@ def test_targeting_different_program_statuses( ], ) def test_exclude_households_with_active_adjudication_ticket( - self, - test_data: dict, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + test_data: dict, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.data_collecting_type.type = test_data["type"] @@ -552,10 +554,10 @@ def test_exclude_households_with_active_adjudication_ticket( By.CSS_SELECTOR, pageTargetingDetails.iconSelected ) assert ( - test_data["text"] - in pageTargetingDetails.getCheckboxExcludePeopleIfActiveAdjudicationTicket() - .find_element(By.XPATH, "./..") - .text + test_data["text"] + in pageTargetingDetails.getCheckboxExcludePeopleIfActiveAdjudicationTicket() + .find_element(By.XPATH, "./..") + .text ) elif test_data["type"] == "STANDARD": pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() @@ -563,10 +565,10 @@ def test_exclude_households_with_active_adjudication_ticket( By.CSS_SELECTOR, pageTargetingDetails.iconSelected ) assert ( - test_data["text"] - in pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() - .find_element(By.XPATH, "./..") - .text + test_data["text"] + in pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() + .find_element(By.XPATH, "./..") + .text ) @pytest.mark.parametrize( @@ -589,14 +591,14 @@ def test_exclude_households_with_active_adjudication_ticket( ], ) def test_exclude_households_with_sanction_screen_flag( - self, - test_data: dict, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + test_data: dict, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.data_collecting_type.type = test_data["type"] @@ -624,9 +626,9 @@ def test_exclude_households_with_sanction_screen_flag( ) def test_targeting_info_button( - self, - create_programs: None, - pageTargeting: Targeting, + self, + create_programs: None, + pageTargeting: Targeting, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -635,12 +637,12 @@ def test_targeting_info_button( pageTargeting.getTabTargetingDiagram().click() def test_targeting_filters( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - filters: Filters, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + filters: Filters, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -666,11 +668,11 @@ def test_targeting_filters( filters.getButtonFiltersClear().click() def test_targeting_and_labels( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -706,13 +708,13 @@ def test_targeting_and_labels( assert "est NEW TP" in pageTargeting.chooseTargetPopulations(0).text def test_targeting_parametrized_rules_filters( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -732,15 +734,15 @@ def test_targeting_parametrized_rules_filters( pageTargetingCreate.clickButtonTargetPopulationCreate() assert "Females Age 0 - 5: 11" in pageTargetingCreate.getCriteriaContainer().text - @pytest.mark.skip("Problem with deadlock during test - 202318") + @pytest.mark.xfail(reason="Problem with deadlock during test - 202318") def test_targeting_parametrized_rules_filters_and_or( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -766,8 +768,8 @@ def test_targeting_parametrized_rules_filters_and_or( assert "Females Age 0 - 5: 1" in pageTargetingCreate.getCriteriaContainer().text assert "Village: Testtown" in pageTargetingCreate.getCriteriaContainer().text assert ( - "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" - in pageTargetingCreate.getCriteriaContainer().text + "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" + in pageTargetingCreate.getCriteriaContainer().text ) pageTargetingCreate.getButtonEdit().click() pageTargetingCreate.getTargetingCriteriaAutoCompleteIndividual() @@ -785,10 +787,10 @@ def test_targeting_parametrized_rules_filters_and_or( assert "Females Age 0 - 5: 1" in pageTargetingCreate.getCriteriaContainer().text assert "Village: Testtown" in pageTargetingCreate.getCriteriaContainer().text assert ( - "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" - in pageTargetingCreate.getCriteriaContainer().text + "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" + in pageTargetingCreate.getCriteriaContainer().text ) assert ( - "Males age 0 - 5 with disability: 1 -10" - in pageTargetingCreate.get_elements(pageTargetingCreate.criteriaContainer)[1].text + "Males age 0 - 5 with disability: 1 -10" + in pageTargetingCreate.get_elements(pageTargetingCreate.criteriaContainer)[1].text ) From 41f0ebd2b001f19fc2f9210593736a03a8e23fa5 Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 11 Jul 2024 10:14:59 +0200 Subject: [PATCH 3/5] Black --- .../targeting/test_targeting.py | 288 +++++++++--------- 1 file changed, 143 insertions(+), 145 deletions(-) diff --git a/backend/selenium_tests/targeting/test_targeting.py b/backend/selenium_tests/targeting/test_targeting.py index e5c762b758..ff8d30b6c9 100644 --- a/backend/selenium_tests/targeting/test_targeting.py +++ b/backend/selenium_tests/targeting/test_targeting.py @@ -81,7 +81,7 @@ def household_refugee() -> Household: def get_program_with_dct_type_and_name( - name: str, dct_type: str = DataCollectingType.Type.STANDARD, status: str = Program.ACTIVE + name: str, dct_type: str = DataCollectingType.Type.STANDARD, status: str = Program.ACTIVE ) -> Program: BusinessArea.objects.filter(slug="afghanistan").update(is_payment_plan_applicable=True) dct = DataCollectingTypeFactory(type=dct_type) @@ -150,8 +150,7 @@ def test_smoke_targeting_page(self, create_programs: None, add_targeting: None, assert "Use IDs" in pageTargeting.getCreateUseIDs().text def test_smoke_targeting_create_use_filters( - self, create_programs: None, add_targeting: None, pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate + self, create_programs: None, add_targeting: None, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -166,8 +165,7 @@ def test_smoke_targeting_create_use_filters( pageTargetingCreate.getAutocompleteTargetCriteriaOption().click() def test_smoke_targeting_create_use_ids( - self, create_programs: None, add_targeting: None, pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate + self, create_programs: None, add_targeting: None, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -182,11 +180,11 @@ def test_smoke_targeting_create_use_ids( pageTargetingCreate.getInputIndividualids() def test_smoke_targeting_details_page( - self, - create_programs: None, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, + self, + create_programs: None, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -229,13 +227,13 @@ def test_smoke_targeting_details_page( @pytest.mark.usefixtures("login") class TestCreateTargeting: def test_create_targeting_for_people( - self, - sw_program: Program, - household_with_disability: Household, - household_without_disabilities: Household, - pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate, - pageTargetingDetails: TargetingDetails, + self, + sw_program: Program, + household_with_disability: Household, + household_without_disabilities: Household, + pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.navigate_to_page("afghanistan", sw_program.id) pageTargeting.getButtonCreateNew().click() @@ -261,20 +259,20 @@ def test_create_targeting_for_people( assert pageTargetingDetails.getCriteriaContainer().text == disability_expected_criteria_text assert Household.objects.count() == 2 assert ( - pageTargetingDetails.getHouseholdTableCell(1, 1).text - == household_with_disability.individuals.first().unicef_id + pageTargetingDetails.getHouseholdTableCell(1, 1).text + == household_with_disability.individuals.first().unicef_id ) assert len(pageTargetingDetails.getPeopleTableRows()) == 1 def test_create_targeting_for_normal_program( - self, - non_sw_program: Program, - household_with_disability: Household, - household_without_disabilities: Household, - household_refugee: Household, - pageTargeting: Targeting, - pageTargetingCreate: TargetingCreate, - pageTargetingDetails: TargetingDetails, + self, + non_sw_program: Program, + household_with_disability: Household, + household_without_disabilities: Household, + household_refugee: Household, + pageTargeting: Targeting, + pageTargetingCreate: TargetingCreate, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.navigate_to_page("afghanistan", non_sw_program.id) pageTargeting.getButtonCreateNew().click() @@ -309,13 +307,13 @@ def test_create_targeting_for_normal_program( @pytest.mark.usefixtures("login") class TestTargeting: def test_targeting_create_use_ids_hh( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -330,23 +328,23 @@ def test_targeting_create_use_ids_hh( name=f"Target Population for {household_with_disability.unicef_id}" ) assert ( - "1" - == str(target_population.total_individuals_count) - == pageTargetingDetails.getLabelTargetedIndividuals().text + "1" + == str(target_population.total_individuals_count) + == pageTargetingDetails.getLabelTargetedIndividuals().text ) assert ( - str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text + str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text ) assert str(target_population.status) in pageTargetingDetails.getLabelStatus().text def test_targeting_create_use_ids_individual( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -359,23 +357,23 @@ def test_targeting_create_use_ids_individual( pageTargetingCreate.clickButtonTargetPopulationCreate() target_population = TargetPopulation.objects.get(name="Target Population for IND-88-0000.0002") assert ( - "4" - == str(target_population.total_individuals_count) - == pageTargetingDetails.getLabelTargetedIndividuals().text + "4" + == str(target_population.total_individuals_count) + == pageTargetingDetails.getLabelTargetedIndividuals().text ) assert ( - str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text + str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text ) assert str(target_population.status) in pageTargetingDetails.getLabelStatus().text pageTargetingDetails.getButtonRebuild().click() def test_targeting_rebuild( - self, - create_programs: None, - create_targeting: TargetPopulation, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + create_targeting: TargetPopulation, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -386,14 +384,14 @@ def test_targeting_rebuild( pageTargetingDetails.disappearStatusContainer() def test_targeting_mark_ready( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - filters: Filters, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + filters: Filters, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -408,12 +406,12 @@ def test_targeting_mark_ready( pageTargetingDetails.waitForLabelStatus("READY") def test_copy_targeting( - self, - create_programs: None, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") pageTargeting.selectGlobalProgramFilter(program.name).click() @@ -431,13 +429,13 @@ def test_copy_targeting( assert "8" in pageTargetingDetails.getLabelTargetedIndividuals().text def test_edit_targeting( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -457,12 +455,12 @@ def test_edit_targeting( assert "9" in pageTargetingDetails.getCriteriaContainer().text def test_delete_targeting( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -481,11 +479,11 @@ def test_delete_targeting( assert "Test NEW TP" in new_list[0].text def test_targeting_different_program_statuses( - self, - create_programs: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.status = Program.DRAFT @@ -524,14 +522,14 @@ def test_targeting_different_program_statuses( ], ) def test_exclude_households_with_active_adjudication_ticket( - self, - test_data: dict, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + test_data: dict, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.data_collecting_type.type = test_data["type"] @@ -554,10 +552,10 @@ def test_exclude_households_with_active_adjudication_ticket( By.CSS_SELECTOR, pageTargetingDetails.iconSelected ) assert ( - test_data["text"] - in pageTargetingDetails.getCheckboxExcludePeopleIfActiveAdjudicationTicket() - .find_element(By.XPATH, "./..") - .text + test_data["text"] + in pageTargetingDetails.getCheckboxExcludePeopleIfActiveAdjudicationTicket() + .find_element(By.XPATH, "./..") + .text ) elif test_data["type"] == "STANDARD": pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() @@ -565,10 +563,10 @@ def test_exclude_households_with_active_adjudication_ticket( By.CSS_SELECTOR, pageTargetingDetails.iconSelected ) assert ( - test_data["text"] - in pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() - .find_element(By.XPATH, "./..") - .text + test_data["text"] + in pageTargetingDetails.getCheckboxExcludeIfActiveAdjudicationTicket() + .find_element(By.XPATH, "./..") + .text ) @pytest.mark.parametrize( @@ -591,14 +589,14 @@ def test_exclude_households_with_active_adjudication_ticket( ], ) def test_exclude_households_with_sanction_screen_flag( - self, - test_data: dict, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + test_data: dict, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: program = Program.objects.get(name="Test Programm") program.data_collecting_type.type = test_data["type"] @@ -626,9 +624,9 @@ def test_exclude_households_with_sanction_screen_flag( ) def test_targeting_info_button( - self, - create_programs: None, - pageTargeting: Targeting, + self, + create_programs: None, + pageTargeting: Targeting, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -637,12 +635,12 @@ def test_targeting_info_button( pageTargeting.getTabTargetingDiagram().click() def test_targeting_filters( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - filters: Filters, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + filters: Filters, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -668,11 +666,11 @@ def test_targeting_filters( filters.getButtonFiltersClear().click() def test_targeting_and_labels( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -708,13 +706,13 @@ def test_targeting_and_labels( assert "est NEW TP" in pageTargeting.chooseTargetPopulations(0).text def test_targeting_parametrized_rules_filters( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -736,13 +734,13 @@ def test_targeting_parametrized_rules_filters( @pytest.mark.xfail(reason="Problem with deadlock during test - 202318") def test_targeting_parametrized_rules_filters_and_or( - self, - create_programs: None, - household_with_disability: Household, - add_targeting: None, - pageTargeting: Targeting, - pageTargetingDetails: TargetingDetails, - pageTargetingCreate: TargetingCreate, + self, + create_programs: None, + household_with_disability: Household, + add_targeting: None, + pageTargeting: Targeting, + pageTargetingDetails: TargetingDetails, + pageTargetingCreate: TargetingCreate, ) -> None: pageTargeting.selectGlobalProgramFilter("Test Programm").click() pageTargeting.getNavTargeting().click() @@ -768,8 +766,8 @@ def test_targeting_parametrized_rules_filters_and_or( assert "Females Age 0 - 5: 1" in pageTargetingCreate.getCriteriaContainer().text assert "Village: Testtown" in pageTargetingCreate.getCriteriaContainer().text assert ( - "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" - in pageTargetingCreate.getCriteriaContainer().text + "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" + in pageTargetingCreate.getCriteriaContainer().text ) pageTargetingCreate.getButtonEdit().click() pageTargetingCreate.getTargetingCriteriaAutoCompleteIndividual() @@ -787,10 +785,10 @@ def test_targeting_parametrized_rules_filters_and_or( assert "Females Age 0 - 5: 1" in pageTargetingCreate.getCriteriaContainer().text assert "Village: Testtown" in pageTargetingCreate.getCriteriaContainer().text assert ( - "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" - in pageTargetingCreate.getCriteriaContainer().text + "Does the Individual have disability?: Difficulty hearing (even if using a hearing aid), Difficulty seeing (even if wearing glasses)" + in pageTargetingCreate.getCriteriaContainer().text ) assert ( - "Males age 0 - 5 with disability: 1 -10" - in pageTargetingCreate.get_elements(pageTargetingCreate.criteriaContainer)[1].text + "Males age 0 - 5 with disability: 1 -10" + in pageTargetingCreate.get_elements(pageTargetingCreate.criteriaContainer)[1].text ) From 29712b31960db68e439ff863b660c9ddfbb7457d Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 11 Jul 2024 11:35:11 +0200 Subject: [PATCH 4/5] XFAIL test_targeting_rebuild --- backend/selenium_tests/targeting/test_targeting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/selenium_tests/targeting/test_targeting.py b/backend/selenium_tests/targeting/test_targeting.py index ff8d30b6c9..3520176556 100644 --- a/backend/selenium_tests/targeting/test_targeting.py +++ b/backend/selenium_tests/targeting/test_targeting.py @@ -367,6 +367,7 @@ def test_targeting_create_use_ids_individual( assert str(target_population.status) in pageTargetingDetails.getLabelStatus().text pageTargetingDetails.getButtonRebuild().click() + @pytest.mark.xfail(reason="Problem with deadlock during test - 202318") def test_targeting_rebuild( self, create_programs: None, From b3ea01fed80f4f52aaf72d3c0281f854bc14e7ed Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 11 Jul 2024 12:35:10 +0200 Subject: [PATCH 5/5] XFAIL test_targeting_different_program_statuses --- backend/selenium_tests/targeting/test_targeting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/selenium_tests/targeting/test_targeting.py b/backend/selenium_tests/targeting/test_targeting.py index 3520176556..3fb08cebe6 100644 --- a/backend/selenium_tests/targeting/test_targeting.py +++ b/backend/selenium_tests/targeting/test_targeting.py @@ -479,6 +479,7 @@ def test_delete_targeting( assert 1 == len(new_list) assert "Test NEW TP" in new_list[0].text + @pytest.mark.xfail(reason="Problem with deadlock during test - 202318") def test_targeting_different_program_statuses( self, create_programs: None,