mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-30 12:18:19 -04:00
Working on getting the service to be used.
Signed-off-by: Cliff Hill <clifford.hill@gsa.gov>
This commit is contained in:
@@ -85,8 +85,9 @@ class NotifyAdminAPIClient(BaseAPIClient):
|
||||
abort(403)
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
self.check_inactive_service()
|
||||
self.check_inactive_user(args)
|
||||
if os.getenv('NOTIFY_ENVIRONMENT') != "e2etest":
|
||||
self.check_inactive_service()
|
||||
self.check_inactive_user(args)
|
||||
return super().post(*args, **kwargs)
|
||||
|
||||
def put(self, *args, **kwargs):
|
||||
|
||||
@@ -11,6 +11,7 @@ from flask_login import login_user
|
||||
from flask.testing import FlaskClient
|
||||
|
||||
from app import create_app
|
||||
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
|
||||
@@ -118,7 +119,7 @@ def default_service(browser, client, default_user):
|
||||
browser_type = browser.browser_type.name
|
||||
service_name = f"E2E Federal Test Service {now} - {browser_type}"
|
||||
|
||||
service = service_api_client.create_service(
|
||||
service_id = service_api_client.create_service(
|
||||
service_name,
|
||||
"federal",
|
||||
current_app.config["DEFAULT_SERVICE_LIMIT"],
|
||||
@@ -127,7 +128,9 @@ def default_service(browser, client, default_user):
|
||||
default_user["email_address"],
|
||||
)
|
||||
|
||||
print("OK I GOT HERE LETS GO!!!")
|
||||
service_data = service_api_client.get_service(service_id)
|
||||
|
||||
service = Service(service_data)
|
||||
|
||||
yield service
|
||||
|
||||
|
||||
@@ -137,78 +137,78 @@ 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(
|
||||
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")
|
||||
#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.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
# check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
expect(page).to_have_title(re.compile("Choose service"))
|
||||
# expect(page).to_have_title(re.compile("Choose service"))
|
||||
|
||||
# Check for the sign in heading.
|
||||
sign_in_heading = page.get_by_role("heading", name="Choose service")
|
||||
expect(sign_in_heading).to_be_visible()
|
||||
# sign_in_heading = page.get_by_role("heading", name="Choose service")
|
||||
# expect(sign_in_heading).to_be_visible()
|
||||
|
||||
# Retrieve some prominent elements on the page for testing.
|
||||
add_service_button = page.get_by_role(
|
||||
"button", name=re.compile("Add a new service")
|
||||
)
|
||||
# add_service_button = page.get_by_role(
|
||||
# "button", name=re.compile("Add a new service")
|
||||
# )
|
||||
|
||||
expect(add_service_button).to_be_visible()
|
||||
# expect(add_service_button).to_be_visible()
|
||||
|
||||
existing_service_link = page.get_by_role("link", name=new_service_name)
|
||||
# existing_service_link = page.get_by_role("link", name=new_service_name)
|
||||
|
||||
# Check to see if the service was already created - if so, we should fail.
|
||||
# TODO: Figure out how to make this truly isolated, and/or work in a
|
||||
# delete service workflow.
|
||||
expect(existing_service_link).to_have_count(0)
|
||||
# expect(existing_service_link).to_have_count(0)
|
||||
|
||||
# Click on add a new service.
|
||||
add_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")
|
||||
check_axe_report(page)
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
# check_axe_report(page)
|
||||
|
||||
# Check for the sign in heading.
|
||||
about_heading = page.get_by_role("heading", name="About your service")
|
||||
expect(about_heading).to_be_visible()
|
||||
# about_heading = page.get_by_role("heading", name="About your service")
|
||||
# expect(about_heading).to_be_visible()
|
||||
|
||||
# Retrieve some prominent elements on the page for testing.
|
||||
service_name_input = page.locator('xpath=//input[@name="name"]')
|
||||
add_service_button = page.get_by_role("button", name=re.compile("Add service"))
|
||||
# service_name_input = page.locator('xpath=//input[@name="name"]')
|
||||
# add_service_button = page.get_by_role("button", name=re.compile("Add service"))
|
||||
|
||||
expect(service_name_input).to_be_visible()
|
||||
expect(add_service_button).to_be_visible()
|
||||
# expect(service_name_input).to_be_visible()
|
||||
# expect(add_service_button).to_be_visible()
|
||||
|
||||
# Fill in the form.
|
||||
service_name_input.fill(new_service_name)
|
||||
# service_name_input.fill(new_service_name)
|
||||
|
||||
# Click on add service.
|
||||
add_service_button.click()
|
||||
# add_service_button.click()
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
# check_axe_report(page)
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
# service_heading = page.get_by_text(new_service_name, exact=True)
|
||||
# expect(service_heading).to_be_visible()
|
||||
|
||||
expect(page).to_have_title(re.compile(new_service_name))
|
||||
expect(page).to_have_title(re.compile(default_service.name))
|
||||
|
||||
create_new_template(page)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user