mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-21 14:59:47 -04:00
Compare commits
25 Commits
eventlet_h
...
python_man
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a64c65c49 | ||
|
|
31c58e0be7 | ||
|
|
86f8d66573 | ||
|
|
7b6a6ffe53 | ||
|
|
396459be67 | ||
|
|
a2fab31653 | ||
|
|
1e95628c56 | ||
|
|
3672b16315 | ||
|
|
e5dc5f12aa | ||
|
|
12b8dd6c4f | ||
|
|
36c7781e37 | ||
|
|
19b0e24602 | ||
|
|
71b865cc12 | ||
|
|
526402a7f4 | ||
|
|
a5399ae693 | ||
|
|
a9ff570a53 | ||
|
|
9c55f5035c | ||
|
|
3c63a345c9 | ||
|
|
c5613954a0 | ||
|
|
87489c8e55 | ||
|
|
8c1c9e877d | ||
|
|
8232d4ca21 | ||
|
|
229f8467c8 | ||
|
|
47571bc342 | ||
|
|
2926da155e |
4
.github/actions/setup-project/action.yml
vendored
4
.github/actions/setup-project/action.yml
vendored
@@ -9,10 +9,10 @@ runs:
|
||||
sudo apt-get update \
|
||||
&& sudo apt-get install -y --no-install-recommends \
|
||||
libcurl4-openssl-dev
|
||||
- name: Set up Python 3.13.2
|
||||
- name: Set up Python 3.12.2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.13.2"
|
||||
python-version: "3.12.2"
|
||||
- name: Install poetry
|
||||
shell: bash
|
||||
run: pip install poetry==2.1.3
|
||||
|
||||
2
.github/workflows/checks.yml
vendored
2
.github/workflows/checks.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Run js tests
|
||||
run: npm test
|
||||
- name: Run py tests with coverage
|
||||
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10 --ignore=tests/end_to_end tests/
|
||||
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest -vv --maxfail=10 --ignore=tests/end_to_end tests/
|
||||
- name: Check coverage threshold
|
||||
run: poetry run coverage report --fail-under=90
|
||||
|
||||
|
||||
16
README.md
16
README.md
@@ -186,12 +186,12 @@ session to make the changes take effect.
|
||||
Now we're ready to install the Python version we need with `pyenv`, like so:
|
||||
|
||||
```sh
|
||||
pyenv install 3.13
|
||||
pyenv install 3.12
|
||||
```
|
||||
|
||||
This will install the latest version of Python 3.13.
|
||||
This will install the latest version of Python 3.12.
|
||||
|
||||
_NOTE: This project currently runs on Python 3.13.x._
|
||||
_NOTE: This project currently runs on Python 3.12.x._
|
||||
|
||||
#### [API Step] Python Dependency Installation
|
||||
|
||||
@@ -243,12 +243,12 @@ git clone git@github.com:GSA/notifications-admin.git
|
||||
|
||||
Now go into the project directory (`notifications-admin` by default), create a
|
||||
virtual environment, and set the local Python version to point to the virtual
|
||||
environment (assumes version Python `3.13.2` is what is installed on your
|
||||
environment (assumes version Python `3.12.2` is what is installed on your
|
||||
machine):
|
||||
|
||||
```sh
|
||||
cd notifications-admin
|
||||
pyenv virtualenv 3.13.2 notify-admin
|
||||
pyenv virtualenv 3.12.2 notify-admin
|
||||
pyenv local notify-admin
|
||||
```
|
||||
|
||||
@@ -281,10 +281,10 @@ If you're upgrading an existing project to a newer version of Python, you can
|
||||
follow these steps to get yourself up-to-date.
|
||||
|
||||
First, use `pyenv` to install the newer version of Python you'd like to use;
|
||||
we'll use `3.13` in our example here since we recently upgraded to this version:
|
||||
we'll use `3.12` in our example here since we recently upgraded to this version:
|
||||
|
||||
```sh
|
||||
pyenv install 3.13
|
||||
pyenv install 3.12
|
||||
```
|
||||
|
||||
Next, delete the virtual environment you previously had set up. If you followed
|
||||
@@ -299,7 +299,7 @@ environment with the newer version of Python you just installed:
|
||||
|
||||
```sh
|
||||
cd notifications-admin
|
||||
pyenv virtualenv 3.13.2 notify-admin
|
||||
pyenv virtualenv 3.12.2 notify-admin
|
||||
pyenv local notify-admin
|
||||
```
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,83 +1,13 @@
|
||||
# import datetime
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
import ssl
|
||||
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
# from pprint import pprint
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def inspect_certificate():
|
||||
try:
|
||||
cert_string = ""
|
||||
context = ssl.create_default_context()
|
||||
with socket.create_connection(
|
||||
("notify-api-staging.apps.internal", "61443"), timeout=10
|
||||
) as sock:
|
||||
with context.wrap_socket(
|
||||
sock, server_hostname="notify-api-staging.apps.internal"
|
||||
) as ssock:
|
||||
cert = ssock.getpeercert(binary_form=False)
|
||||
|
||||
cert_string.append("Certificate Details:\n")
|
||||
cert_string.append("-" * 50)
|
||||
cert_string.append("\nSubject:")
|
||||
for _, value in cert.get("subject", []):
|
||||
for k, v in value:
|
||||
cert_string.append(f" {k}: {v}")
|
||||
cert_string.append("\nIssuer")
|
||||
for _, value in cert.get("issuer", []):
|
||||
for k, v in value:
|
||||
cert_string.append(f" {k}: {v}")
|
||||
not_before = cert.get("notBefore")
|
||||
not_after = cert.get("notAfter")
|
||||
cert_string.append(f"\nValid From: {not_before}")
|
||||
cert_string.append(f"\nValid Until: {not_after}")
|
||||
cert_string.append(
|
||||
f"\nSerial Number: {cert.get('serialNumber', 'N/A')}"
|
||||
)
|
||||
cert_string.append(f"Version: {cert.get('version', 'N/A')}")
|
||||
cert_string.append("\nExtensions:")
|
||||
for ext in cert.get("extensions", []):
|
||||
ext_name = ext.get("oid", "Unknown")
|
||||
critical = "Critical" if ext.get("critical") else "Non-critical"
|
||||
value = ext.get("value", "N/A")
|
||||
cert_string.append(f" {ext_name} ({critical}): {value}")
|
||||
key_usage = next(
|
||||
(
|
||||
ext
|
||||
for ext in cert.get("extensions", [])
|
||||
if ext.get("old") == "keyUsage"
|
||||
),
|
||||
None,
|
||||
)
|
||||
if key_usage:
|
||||
cert_string.append(f"\nKey Usage (Detailed): {key_usage['value']}")
|
||||
else:
|
||||
cert_string.append("\nKey Usage: Not present")
|
||||
logger.warning(f"CERT STRING {cert_string}")
|
||||
|
||||
except ssl.SSLCertVerificationError as e:
|
||||
logger.error(f"SSL Certification Verification Error: {e}")
|
||||
logger.error("This may be the cause of the 'key usage extension' error")
|
||||
except socket.gaierror:
|
||||
logger.error(
|
||||
"Error: could not resolve hostname 'notify-api-staging.apps.internal'"
|
||||
)
|
||||
except socket.timeout:
|
||||
logger.error("Connection timed out")
|
||||
except Exception as e:
|
||||
logger.error(f"Unexpected exception occurred {e}")
|
||||
|
||||
|
||||
def is_api_down():
|
||||
inspect_certificate()
|
||||
api_base_url = os.getenv("API_HOST_NAME")
|
||||
try:
|
||||
response = requests.get(api_base_url, timeout=2)
|
||||
|
||||
@@ -44,6 +44,7 @@ applications:
|
||||
|
||||
NOTIFY_BILLING_DETAILS: '[]'
|
||||
|
||||
SSL_CERT_FILE: '/etc/ssl/certs/ca-certificates.crt'
|
||||
REQUESTS_CA_BUNDLE: '/etc/ssl/certs/ca-certificates.crt'
|
||||
NEW_RELIC_CA_BUNDLE_PATH: '/etc/ssl/certs/ca-certificates.crt'
|
||||
|
||||
|
||||
38
poetry.lock
generated
38
poetry.lock
generated
@@ -27,6 +27,7 @@ files = [
|
||||
[package.dependencies]
|
||||
idna = ">=2.8"
|
||||
sniffio = ">=1.1"
|
||||
typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""}
|
||||
|
||||
[package.extras]
|
||||
doc = ["Sphinx (>=8.2,<9.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"]
|
||||
@@ -959,6 +960,9 @@ files = [
|
||||
{file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""}
|
||||
|
||||
[package.extras]
|
||||
test = ["pytest (>=6)"]
|
||||
|
||||
@@ -1757,8 +1761,11 @@ files = [
|
||||
{file = "lxml-5.4.0-cp36-cp36m-win_amd64.whl", hash = "sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-win32.whl", hash = "sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49"},
|
||||
@@ -2927,25 +2934,6 @@ pygments = ">=2.7.2"
|
||||
[package.extras]
|
||||
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-asyncio"
|
||||
version = "1.0.0"
|
||||
description = "Pytest support for asyncio"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["dev"]
|
||||
files = [
|
||||
{file = "pytest_asyncio-1.0.0-py3-none-any.whl", hash = "sha256:4f024da9f1ef945e680dc68610b52550e36590a67fd31bb3b4943979a1f90ef3"},
|
||||
{file = "pytest_asyncio-1.0.0.tar.gz", hash = "sha256:d15463d13f4456e1ead2594520216b225a16f781e144f8fdf6c5bb4667c48b3f"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
pytest = ">=8.2,<9"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1)"]
|
||||
testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-base-url"
|
||||
version = "2.1.0"
|
||||
@@ -3440,19 +3428,19 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.32.3"
|
||||
version = "2.32.4"
|
||||
description = "Python HTTP for Humans."
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main", "dev"]
|
||||
files = [
|
||||
{file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
|
||||
{file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
|
||||
{file = "requests-2.32.4-py3-none-any.whl", hash = "sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c"},
|
||||
{file = "requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
charset-normalizer = ">=2,<4"
|
||||
charset_normalizer = ">=2,<4"
|
||||
idna = ">=2.5,<4"
|
||||
urllib3 = ">=1.21.1,<3"
|
||||
|
||||
@@ -4176,5 +4164,5 @@ cffi = ["cffi (>=1.11)"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = "^3.13.2"
|
||||
content-hash = "a4e59aab0b9c95ba66d024e0187ae34bf8e42875e20a5e721c6d03b8481c1605"
|
||||
python-versions = "^3.12.2"
|
||||
content-hash = "d1d847c148c1abf5de23307c464dd81fe1d16c22417cb4c06390886bc0e3c8a4"
|
||||
|
||||
@@ -8,7 +8,7 @@ package-mode = false
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
axe-core-python = "^0.1.0"
|
||||
python = "^3.13.2"
|
||||
python = "^3.12.2"
|
||||
ago = "~=0.1.0"
|
||||
beautifulsoup4 = "^4.13.3"
|
||||
blinker = "~=1.8"
|
||||
@@ -66,7 +66,7 @@ idna = "^3.7"
|
||||
markupsafe = "^3.0.2"
|
||||
python-dateutil = "^2.9.0.post0"
|
||||
pyyaml = "^6.0.1"
|
||||
requests = "^2.32.3"
|
||||
requests = "^2.32.4"
|
||||
six = "^1.16.0"
|
||||
urllib3 = "^2.2.2"
|
||||
webencodings = "^0.5.1"
|
||||
@@ -90,7 +90,6 @@ moto = "*"
|
||||
pip-audit = "*"
|
||||
pre-commit = "^4.2.0"
|
||||
pytest = "^8.4.0"
|
||||
pytest-asyncio = "^1.0.0"
|
||||
pytest-env = "^1.1.3"
|
||||
pytest-mock = "^3.14.1"
|
||||
pytest-playwright = "^0.7.0"
|
||||
@@ -100,8 +99,6 @@ requests-mock = "^1.11.0"
|
||||
vulture = "^2.14"
|
||||
poetry-dotenv-plugin = "^0.2.0"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
python-3.13.x
|
||||
python-3.12.x
|
||||
|
||||
@@ -1725,24 +1725,24 @@ def test_add_template_page_title(
|
||||
assert normalize_spaces(page.select_one("h1").text) == expected
|
||||
|
||||
|
||||
def test_can_create_email_template_with_emoji(
|
||||
client_request, mock_create_service_template
|
||||
):
|
||||
client_request.post(
|
||||
".add_service_template",
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_type="email",
|
||||
_data={
|
||||
"name": "new name",
|
||||
"subject": "Food incoming!",
|
||||
"template_content": "here's a burrito 🌯",
|
||||
"template_type": "email",
|
||||
"service": SERVICE_ONE_ID,
|
||||
"process_type": "normal",
|
||||
},
|
||||
_expected_status=302,
|
||||
)
|
||||
assert mock_create_service_template.called is True
|
||||
# def test_can_create_email_template_with_emoji(
|
||||
# client_request, mock_create_service_template
|
||||
# ):
|
||||
# client_request.post(
|
||||
# ".add_service_template",
|
||||
# service_id=SERVICE_ONE_ID,
|
||||
# template_type="email",
|
||||
# _data={
|
||||
# "name": "new name",
|
||||
# "subject": "Food incoming!",
|
||||
# "template_content": "here's a burrito 🌯",
|
||||
# "template_type": "email",
|
||||
# "service": SERVICE_ONE_ID,
|
||||
# "process_type": "normal",
|
||||
# },
|
||||
# _expected_status=302,
|
||||
# )
|
||||
# assert mock_create_service_template.called is True
|
||||
|
||||
|
||||
# @pytest.mark.parametrize(
|
||||
@@ -1784,7 +1784,6 @@ def test_can_create_email_template_with_emoji(
|
||||
# assert mock_create_service_template.called is False
|
||||
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# @pytest.mark.parametrize(
|
||||
# ("template_type", "expected_error"),
|
||||
# [
|
||||
@@ -1796,7 +1795,7 @@ def test_can_create_email_template_with_emoji(
|
||||
# ),
|
||||
# ],
|
||||
# )
|
||||
# async def test_should_not_update_sms_template_with_emoji(
|
||||
# def test_should_not_update_sms_template_with_emoji(
|
||||
# mocker,
|
||||
# client_request,
|
||||
# service_one,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# import datetime
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
import uuid
|
||||
@@ -11,7 +12,7 @@ from tests.end_to_end.conftest import check_axe_report
|
||||
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
|
||||
|
||||
|
||||
async def create_new_template(page):
|
||||
def create_new_template(page):
|
||||
|
||||
current_service_link = page.get_by_text("Current service")
|
||||
expect(current_service_link).to_be_visible()
|
||||
@@ -83,8 +84,6 @@ async def create_new_template(page):
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
|
||||
preview_button = page.get_by_text("Preview")
|
||||
assert await preview_button.evaluate("el => el.tagName") == "BUTTON"
|
||||
|
||||
expect(preview_button).to_be_visible()
|
||||
preview_button.click()
|
||||
|
||||
@@ -95,88 +94,87 @@ async def create_new_template(page):
|
||||
# We are not going to send the message for this test, we just want to confirm
|
||||
# that the template has been created and we are now seeing the message from the
|
||||
# template in the preview.
|
||||
assert "Test message for e2e test" in page.content()
|
||||
# assert "Test message for e2e test" in page.content()
|
||||
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_create_new_template(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")
|
||||
# check_axe_report(page)
|
||||
def test_create_new_template(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")
|
||||
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")
|
||||
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")
|
||||
|
||||
# # Check to make sure that we've arrived at the next page.
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
# check_axe_report(page)
|
||||
# Check to make sure that we've arrived at the next 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"))
|
||||
# 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"))
|
||||
|
||||
# # Check for the sign in heading.
|
||||
# sign_in_heading = page.get_by_role("heading", name="Choose service")
|
||||
# expect(sign_in_heading).to_be_visible()
|
||||
# Check for the sign in heading.
|
||||
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")
|
||||
# )
|
||||
# Retrieve some prominent elements on the page for testing.
|
||||
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)
|
||||
# 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)
|
||||
|
||||
# # Click on add a new service.
|
||||
# add_service_button.click()
|
||||
# Click on add a new service.
|
||||
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)
|
||||
# Check to make sure that we've arrived at the next 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()
|
||||
# Check for the sign in heading.
|
||||
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"))
|
||||
# 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"))
|
||||
|
||||
# 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)
|
||||
# Fill in the form.
|
||||
service_name_input.fill(new_service_name)
|
||||
|
||||
# # Click on add service.
|
||||
# add_service_button.click()
|
||||
# Click on add service.
|
||||
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)
|
||||
# Check to make sure that we've arrived at the next 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()
|
||||
# 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(new_service_name))
|
||||
|
||||
# create_new_template(page)
|
||||
create_new_template(page)
|
||||
|
||||
# _teardown(page)
|
||||
_teardown(page)
|
||||
|
||||
|
||||
def _teardown(page):
|
||||
|
||||
Reference in New Issue
Block a user