End to end woes continue.

Signed-off-by: Cliff Hill <clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2025-05-12 12:43:12 -04:00
parent c22e216d79
commit eac8f8cddb
2 changed files with 26 additions and 13 deletions

View File

@@ -15,11 +15,13 @@ from app.models.service import Service
from app.models.user import User
from app.notify_client.service_api_client import service_api_client
from app.notify_client.user_api_client import user_api_client
from notifications_python_client.errors import HTTPError
from .. import TestClient
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
class TestClient(FlaskClient):
def login(self, user, mocker=None, service=None):
# Skipping authentication here and just log them in
@@ -112,7 +114,7 @@ def client(notify_admin_e2e, default_user):
# Need e2e service defined here?
@pytest.fixture
@pytest.fixture()
def default_service(browser, client, default_user):
current_date_time = datetime.datetime.now()
now = current_date_time.strftime("%m/%d/%Y %H:%M:%S")
@@ -120,21 +122,28 @@ def default_service(browser, client, default_user):
service_name = f"E2E Federal Test Service {now} - {browser_type}"
service_id = service_api_client.create_service(
service_name,
"federal",
current_app.config["DEFAULT_SERVICE_LIMIT"],
True,
default_user["id"],
default_user["email_address"],
service_name=service_name,
organization_type="federal",
message_limit=current_app.config["DEFAULT_SERVICE_LIMIT"],
restricted=True,
user_id=default_user["id"],
email_from=default_user["email_address"],
)
print("*" * 80)
print(service_id)
service_data = service_api_client.get_service(service_id)
service = Service(service_data)
yield service
from pprint import pprint
pprint(dir(service))
service_api_client.archive_service(service.id, None)
try:
yield service
finally:
service_api_client.archive_service(service.id, None)
@contextmanager

View File

@@ -137,16 +137,16 @@ def delete_template(page):
def test_campaign_manager_core_user_story(default_service, end_to_end_context):
create_user()
page = end_to_end_context.new_page()
#page.goto(f"{E2E_TEST_URI}/sign-in")
# page.goto(f"{E2E_TEST_URI}/sign-in")
# Wait for the next page to fully load.
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
current_date_time = datetime.datetime.now()
#new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
# new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
# now=current_date_time.strftime("%m/%d/%Y %H:%M:%S"),
# browser_type=page.context.browser.browser_type.name,
#)
# )
# page.goto(f"{E2E_TEST_URI}/accounts")
# Check to make sure that we've arrived at the next page.
@@ -176,7 +176,7 @@ def test_campaign_manager_core_user_story(default_service, end_to_end_context):
# expect(existing_service_link).to_have_count(0)
# Click on add a new service.
a# dd_service_button.click()
a # dd_service_button.click()
# Check to make sure that we've arrived at the next page.
# page.wait_for_load_state("domcontentloaded")
@@ -208,6 +208,10 @@ def test_campaign_manager_core_user_story(default_service, end_to_end_context):
# service_heading = page.get_by_text(new_service_name, exact=True)
# expect(service_heading).to_be_visible()
print("*" * 80)
print(default_service.name)
print("*" * 80)
expect(page).to_have_title(re.compile(default_service.name))
create_new_template(page)