-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selenium - filters smoke tests (#3861)
* Filters init * Mapping filters * add data cy filters reporting * add unique data-cy to date picker filter * fix if no label * Test * Test filters - all_programs * Test filters - program selected * Test filters - program selected * Test filters - program selected * Test filters - program selected * add data cy for users fliters * remove default data cy for search text field * Test filters - program selected * Fix for drawer tests and feedback tests * Black * Black * Fix frontend tests --------- Co-authored-by: Maciej Szewczyk <[email protected]>
- Loading branch information
1 parent
f55879e
commit b8fbb3c
Showing
21 changed files
with
530 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
from django.conf import settings | ||
from django.core.management import call_command | ||
|
||
import pytest | ||
from page_object.filters import Filters | ||
|
||
pytestmark = pytest.mark.django_db(transaction=True) | ||
|
||
|
||
@pytest.fixture | ||
def create_programs() -> None: | ||
call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/core/fixtures/data-selenium.json") | ||
call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/program/fixtures/data-cypress.json") | ||
return | ||
|
||
|
||
@pytest.mark.usefixtures("login") | ||
class TestSmokeFilters: | ||
def test_filters_all_programs(self, create_programs: None, filters: Filters) -> None: | ||
all_programs = { | ||
"Country Dashboard": [filters.globalProgramFilter, filters.globalProgramFilterContainer], | ||
"Programs": [ | ||
filters.filtersDataCollectingType, | ||
filters.filtersBudgetMax, | ||
filters.filtersBudgetMin, | ||
filters.filtersNumberOfHouseholdsMin, | ||
filters.filtersNumberOfHouseholdsMax, | ||
filters.filtersSector, | ||
filters.filtersStartDate, | ||
filters.filtersEndDate, | ||
filters.filtersStatus, | ||
filters.filtersSearch, | ||
], | ||
"Grievance": [ | ||
filters.filtersSearch, | ||
filters.selectFilter, | ||
filters.filtersDocumentType, | ||
filters.filtersDocumentNumber, | ||
filters.filtersProgram, | ||
filters.programmeInput, | ||
filters.selectFilter, | ||
filters.filtersStatus, | ||
filters.filtersFsp, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
filters.selectFilter, | ||
filters.filtersCategory, | ||
filters.filtersAdminLevel, | ||
filters.filtersAssignee, | ||
filters.assignedToInput, | ||
filters.filtersCreatedByAutocomplete, | ||
filters.filtersRegistrationDataImport, | ||
filters.filtersPreferredLanguage, | ||
filters.filtersPriority, | ||
filters.filtersUrgency, | ||
filters.filtersActiveTickets, | ||
filters.filtersProgramState, | ||
], | ||
"Feedback": [ | ||
filters.filtersSearch, | ||
filters.filtersProgram, | ||
filters.programmeInput, | ||
filters.selectFilter, | ||
filters.filtersIssueType, | ||
filters.filtersCreatedByAutocomplete, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
filters.selectFilter, | ||
filters.filtersProgramState, | ||
], | ||
"Reporting": [ | ||
filters.reportOnlyMyFilter, | ||
filters.reportStatusFilter, | ||
filters.reportCreatedToFilter, | ||
filters.reportCreatedFromFilter, | ||
filters.reportTypeFilter, | ||
], | ||
"Activity Log": [ | ||
filters.filtersResidenceStatus, | ||
filters.filtersSearch, | ||
filters.userInput, | ||
filters.selectFilter, | ||
], | ||
} | ||
|
||
for nav_menu in all_programs: | ||
if nav_menu == "Feedback": | ||
filters.wait_for('[data-cy="nav-Grievance"]').click() | ||
filters.wait_for(f'[data-cy="nav-{nav_menu}"]').click() | ||
for locator in all_programs[nav_menu]: | ||
try: | ||
filters.wait_for(locator, timeout=20) | ||
except BaseException: | ||
raise Exception(f"Element {locator} not found on the {nav_menu} page.") | ||
|
||
def test_filters_selected_program(self, create_programs: None, filters: Filters) -> None: | ||
filters.selectGlobalProgramFilter("Test Programm").click() | ||
|
||
programs = { | ||
"Registration Data Import": [ | ||
filters.filterSearch, | ||
filters.importedByInput, | ||
filters.selectFilter, | ||
filters.filterStatus, | ||
filters.filterSizeMin, | ||
filters.filterSizeMax, | ||
filters.filterImportDateRangeMin, | ||
filters.filterImportDateRangeMax, | ||
], | ||
"Program Population": [ | ||
filters.selectFilter, | ||
filters.filtersDocumentType, | ||
filters.filtersDocumentNumber, | ||
filters.selectFilter, | ||
filters.hhFiltersResidenceStatus, | ||
filters.hhFiltersAdmin2, | ||
filters.hhFiltersHouseholdSizeFrom, | ||
filters.hhFiltersHouseholdSizeTo, | ||
filters.selectFilter, | ||
filters.hhFiltersOrderBy, | ||
filters.selectFilter, | ||
filters.hhFiltersStatus, | ||
], | ||
"Individuals": [ | ||
filters.indFiltersSearch, | ||
filters.selectFilter, | ||
filters.filtersDocumentType, | ||
filters.filtersDocumentNumber, | ||
filters.selectFilter, | ||
filters.indFiltersGender, | ||
filters.indFiltersAgeFrom, | ||
filters.indFiltersAgeTo, | ||
filters.selectFilter, | ||
filters.indFiltersFlags, | ||
filters.selectFilter, | ||
filters.indFiltersOrderBy, | ||
filters.selectFilter, | ||
filters.indFiltersStatus, | ||
filters.indFiltersRegDateFrom, | ||
filters.indFiltersRegDateTo, | ||
], | ||
"Targeting": [ | ||
filters.filtersSearch, | ||
filters.selectFilter, | ||
filters.filtersStatus, | ||
filters.filtersTotalHouseholdsCountMin, | ||
filters.filtersTotalHouseholdsCountMax, | ||
filters.datePickerFilterFrom, | ||
filters.datePickerFilterTo, | ||
], | ||
"Payment Module": [ | ||
filters.selectFilter, | ||
filters.filtersTotalEntitledQuantityFrom, | ||
filters.filtersTotalEntitledQuantityTo, | ||
filters.datePickerFilterFrom, | ||
filters.datePickerFilterTo, | ||
], | ||
"Payment Verification": [ | ||
filters.filterSearch, | ||
filters.selectFilter, | ||
filters.filterStatus, | ||
filters.filterFsp, | ||
filters.selectFilter, | ||
filters.filterModality, | ||
filters.filterStartDate, | ||
filters.filterEndDate, | ||
], | ||
"Grievance": [ | ||
filters.filtersSearch, | ||
filters.selectFilter, | ||
filters.filtersDocumentType, | ||
filters.filtersDocumentNumber, | ||
filters.selectFilter, | ||
filters.filtersStatus, | ||
filters.filtersFsp, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
filters.selectFilter, | ||
filters.filtersCategory, | ||
filters.filtersAdminLevel, | ||
filters.filtersAssignee, | ||
filters.assignedToInput, | ||
filters.filtersCreatedByAutocomplete, | ||
filters.filtersRegistrationDataImport, | ||
filters.filtersPreferredLanguage, | ||
filters.filtersPriority, | ||
filters.filtersUrgency, | ||
filters.filtersActiveTickets, | ||
], | ||
"Feedback": [ | ||
filters.filtersSearch, | ||
filters.selectFilter, | ||
filters.filtersIssueType, | ||
filters.filtersCreatedByAutocomplete, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
], | ||
"Accountability": [ | ||
filters.filtersTargetPopulationAutocomplete, | ||
filters.targetPopulationInput, | ||
filters.createdByInput, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
], | ||
"Surveys": [ | ||
filters.filtersSearch, | ||
filters.filtersTargetPopulationAutocomplete, | ||
filters.targetPopulationInput, | ||
filters.createdByInput, | ||
filters.filtersCreationDateFrom, | ||
filters.filtersCreationDateTo, | ||
], | ||
"Programme Users": [], | ||
"Program Log": [ | ||
filters.filtersSearch, | ||
filters.selectFilter, | ||
filters.filtersResidenceStatus, | ||
filters.userInput, | ||
], | ||
} | ||
|
||
for nav_menu in programs: | ||
if nav_menu == "Feedback": | ||
filters.wait_for('[data-cy="nav-Grievance"]').click() | ||
if nav_menu == "Individuals": | ||
filters.wait_for('[data-cy="nav-Program Population"]').click() | ||
if nav_menu == "Surveys": | ||
filters.wait_for('[data-cy="nav-Accountability"]').click() | ||
filters.wait_for(f'[data-cy="nav-{nav_menu}"]').click() | ||
for locator in programs[nav_menu]: | ||
try: | ||
filters.wait_for(locator, timeout=20) | ||
except BaseException: | ||
raise Exception(f"Element {locator} not found on the {nav_menu} page.") |
Oops, something went wrong.