mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 09:59:59 -04:00
try to pass message back in 'next' field
This commit is contained in:
@@ -139,13 +139,21 @@ def verify_email(user, redirect_url):
|
||||
|
||||
|
||||
def _handle_e2e_tests(redirect_url):
|
||||
current_app.logger.warning("E2E TESTS ARE ENABLED.")
|
||||
current_app.logger.warning(
|
||||
"If you are getting a 404 on signin, comment out E2E vars in .env file!"
|
||||
)
|
||||
user = user_api_client.get_user_by_email(os.getenv("NOTIFY_E2E_TEST_EMAIL"))
|
||||
activate_user(user["id"])
|
||||
return redirect(url_for("main.show_accounts_or_dashboard", next=os.getenv("NOTIFY_E2E_TEST_EMAIL")))
|
||||
try:
|
||||
current_app.logger.warning("E2E TESTS ARE ENABLED.")
|
||||
current_app.logger.warning(
|
||||
"If you are getting a 404 on signin, comment out E2E vars in .env file!"
|
||||
)
|
||||
user = user_api_client.get_user_by_email(os.getenv("NOTIFY_E2E_TEST_EMAIL"))
|
||||
activate_user(user["id"])
|
||||
return redirect(
|
||||
url_for(
|
||||
"main.show_accounts_or_dashboard",
|
||||
next=os.getenv("NOTIFY_E2E_TEST_EMAIL"),
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
return redirect(url_for("main.show_accounts_or_dashboard", next=f"{e}"))
|
||||
|
||||
# return redirect(url_for("main.show_accounts_or_dashboard", next=redirect_url))
|
||||
|
||||
@@ -159,7 +167,7 @@ def sign_in():
|
||||
# and don't proceed further with login
|
||||
redirect_url = request.args.get("next")
|
||||
|
||||
#if os.getenv("NOTIFY_E2E_TEST_EMAIL"):
|
||||
# if os.getenv("NOTIFY_E2E_TEST_EMAIL"):
|
||||
return _handle_e2e_tests(None)
|
||||
|
||||
email_verify_template = _do_login_dot_gov()
|
||||
@@ -170,7 +178,6 @@ def sign_in():
|
||||
):
|
||||
return email_verify_template
|
||||
|
||||
|
||||
if current_user and current_user.is_authenticated:
|
||||
if redirect_url and is_safe_redirect_url(redirect_url):
|
||||
return redirect(redirect_url)
|
||||
|
||||
@@ -12,10 +12,10 @@ def login_for_end_to_end_testing(browser):
|
||||
page = context.new_page()
|
||||
page.goto(f"{E2E_TEST_URI}/sign-in")
|
||||
|
||||
#sign_in_button = page.get_by_role("link", name="Sign in")
|
||||
# sign_in_button = page.get_by_role("link", name="Sign in")
|
||||
|
||||
# Test trying to sign in.
|
||||
#sign_in_button.click()
|
||||
# sign_in_button.click()
|
||||
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
@@ -63,7 +63,6 @@ def authenticated_page(end_to_end_context):
|
||||
page = end_to_end_context.new_page()
|
||||
page.goto(f"{E2E_TEST_URI}/sign-in")
|
||||
|
||||
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ from playwright.sync_api import expect
|
||||
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
|
||||
|
||||
|
||||
|
||||
def create_new_template(page):
|
||||
|
||||
current_service_link = page.get_by_text("Current service")
|
||||
@@ -96,8 +95,7 @@ def test_create_new_template(end_to_end_context):
|
||||
x = page.goto(f"{E2E_TEST_URI}/sign-in")
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
print(f"WTF is x? {x}")
|
||||
print(f"PAGE ON ENTER TEST_CREATE_NEW_TEMPLATE AFTER SIGNING IN IS {page.content()}")
|
||||
print(f"PAGE ON ENTER TEST_CREATE_NEW_TEMPLATE AFTER SIGNING IN IS {page}")
|
||||
|
||||
current_date_time = datetime.datetime.now()
|
||||
new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
|
||||
@@ -108,7 +106,6 @@ def test_create_new_template(end_to_end_context):
|
||||
print(f"GOING TO {E2E_TEST_URI}/accounts")
|
||||
page.goto(f"{E2E_TEST_URI}/accounts")
|
||||
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
print(page)
|
||||
|
||||
Reference in New Issue
Block a user