Skip to content

Commit

Permalink
Fixed live_server
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-kellton committed Apr 5, 2024
1 parent d9bc359 commit e5dd43c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
12 changes: 9 additions & 3 deletions backend/selenium_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
from hct_mis_api.apps.geo.models import Country


def pytest_addoption(parser) -> None: # type: ignore
parser.addoption("--mapping", action="store_true", default=False, help="Enable mapping mode")


def pytest_configure() -> None:
pytest.SELENIUM_PATH = os.path.dirname(__file__)
pytest.CSRF = ""
Expand Down Expand Up @@ -70,9 +74,11 @@ def driver() -> Chrome:


@pytest.fixture(autouse=True)
def browser(driver: Chrome) -> Chrome:
driver.live_server = LiveServer("localhost")
# driver.live_server = LiveServer("0.0.0.0:8080")
def browser(request: FixtureRequest, driver: Chrome) -> Chrome:
if request.config.getoption("--mapping"):
driver.live_server = LiveServer("0.0.0.0:8080")
else:
driver.live_server = LiveServer("localhost")
yield driver
driver.close()
pytest.CSRF = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.conf import settings
from django.core.management import call_command

import pytest
from page_object.programme_population.households import Households

from page_object.programme_population.households_details import HouseholdsDetails
from django.conf import settings
from django.core.management import call_command

pytestmark = pytest.mark.django_db(transaction=True)

Expand All @@ -23,7 +23,7 @@ def test_smoke_page_households(self, create_programs: None, pageHouseholds: Hous
pageHouseholds.getNavHouseholds().click()

def test_smoke_page_households_details(
self, create_programs: None, pageHouseholds: Households, pageHouseholdsDetails: HouseholdsDetails
self, create_programs: None, pageHouseholds: Households, pageHouseholdsDetails: HouseholdsDetails
) -> None:
pageHouseholds.selectGlobalProgramFilter("Test Programm").click()
pageHouseholds.getNavProgrammePopulation().click()
Expand Down
12 changes: 5 additions & 7 deletions backend/selenium_tests/programme_population/test_individuals.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pytest
from page_object.programme_population.individuals import Individuals
from django.conf import settings
from django.core.management import call_command

import pytest
from page_object.programme_population.individuals import Individuals

pytestmark = pytest.mark.django_db(transaction=True)


Expand All @@ -12,12 +13,14 @@ def create_programs() -> None:
call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/program/fixtures/data-cypress.json")
return


@pytest.fixture
def add_households() -> None:
call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/registration_data/fixtures/data-cypress.json")
call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/household/fixtures/data-cypress.json")
return


@pytest.mark.usefixtures("login")
class TestSmokeIndividuals:
def test_smoke_page_individuals(self, create_programs: None, pageIndividuals: Individuals) -> None:
Expand All @@ -29,8 +32,3 @@ def test_smoke_page_individuals_details(self, create_programs: None, pageIndivid
pageIndividuals.selectGlobalProgramFilter("Test Programm").click()
pageIndividuals.getNavProgrammePopulation().click()
pageIndividuals.getNavHouseholds().click()


class Test2:
def test_2(self, create_programs: None, add_households: None, pageIndividuals: Individuals) -> None:
input("enter")

0 comments on commit e5dd43c

Please sign in to comment.