diff --git a/Dockerfile b/Dockerfile index ca3600843..a5620d202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,5 @@ WORKDIR /code RUN python -m venv /tmp/venv RUN . /tmp/venv/bin/activate ENV PATH="/tmp/venv/bin:${PATH}" -RUN pip install --upgrade pip -RUN pip install --upgrade pip-tools -RUN pip install --upgrade setuptools -RUN pip install -r requirements/requirements.dev.txt --no-index --find-links ./vendor/ \ No newline at end of file +RUN pip install --upgrade pip pip-tools setuptools +RUN pip install -r requirements/requirements.dev.txt --no-index --find-links ./vendor/ diff --git a/Dockerfile.selenium b/Dockerfile.selenium index a7adb7d17..43c18404b 100755 --- a/Dockerfile.selenium +++ b/Dockerfile.selenium @@ -1,17 +1,18 @@ -FROM seleniarm/standalone-chromium +FROM selenium/standalone-chromium -ENV PYTHONUNBUFFERED 1 USER root -#RUN apt-get update ; apt-get install -yq git curl libpq-dev libffi-dev + RUN apt-get update ; apt-get install -yq python3 python3-venv RUN ln -s /usr/bin/python3 /usr/local/bin/python -RUN useradd -m -s /bin/bash DEV -USER DEV + +# switch to existing seluser from selenium docker +USER seluser + ADD . /code WORKDIR /code RUN python -m venv /tmp/venv RUN . /tmp/venv/bin/activate ENV PATH="/tmp/venv/bin:${PATH}" + RUN pip3 install --upgrade pip RUN pip3 install selenium pytest debugpy jsonschema python-dateutil - diff --git a/Dockerfiles/Dockerfile.selenium-jenkins-python311-plus-chromedriver b/Dockerfiles/Dockerfile.selenium-jenkins-python311-plus-chromedriver new file mode 100644 index 000000000..e69de29bb diff --git a/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium b/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium index 5b14b6c0a..bc4190958 100755 --- a/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium +++ b/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium @@ -99,7 +99,7 @@ pipeline { steps{ sh """ . venv/bin/activate - pytest ./apps/integration_tests/logging_tests.py::TestLoggings::test_auth_fhir_flows_logging + USE_NEW_PERM_SCREEN=true pytest ./apps/integration_tests/logging_tests.py::TestLoggings::test_auth_fhir_flows_logging """ } } @@ -134,7 +134,7 @@ pipeline { sh 'echo "RUN selenium tests - testclient based authorization flow tests and data flow tests"' sh """ . venv/bin/activate - pytest ./apps/integration_tests/selenium_tests.py + USE_NEW_PERM_SCREEN=true pytest ./apps/integration_tests/selenium_tests.py """ } } diff --git a/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium-chromium b/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium-chromium new file mode 100644 index 000000000..0a7ce0d1b --- /dev/null +++ b/Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium-chromium @@ -0,0 +1,151 @@ +pipeline { + agent { + kubernetes { + defaultContainer "bb2-cbc-build-selenium-python311-chromium" + yamlFile "Jenkinsfiles/cbc-pod-deployment-config-w-selenium-p311-chromium.yaml" + } + } + + environment { + DJANGO_LOG_JSON_FORMAT_PRETTY = true + DJANGO_SETTINGS_MODULE = "hhs_oauth_server.settings.logging_it" + OAUTHLIB_INSECURE_TRANSPORT = true + DJANGO_SECURE_SESSION = false + DJANGO_FHIR_CERTSTORE = "./certstore" + // use mock login - safer, faster + USE_MSLSX = true + DJANGO_MEDICARE_SLSX_REDIRECT_URI = "http://localhost:8000/mymedicare/sls-callback" + DJANGO_MEDICARE_SLSX_LOGIN_URI = "http://localhost:8080/sso/authorize?client_id=bb2api" + DJANGO_SLSX_HEALTH_CHECK_ENDPOINT = "http://localhost:8080/health" + DJANGO_SLSX_TOKEN_ENDPOINT = "http://localhost:8080/sso/session" + DJANGO_SLSX_SIGNOUT_ENDPOINT = "http://localhost:8080/sso/signout" + DJANGO_SLSX_USERINFO_ENDPOINT="http://localhost:8080/v1/users" + DJANGO_SLSX_CLIENT_ID = credentials("bb2-selenium-tests-slsx-client-id") + DJANGO_SLSX_CLIENT_SECRET = credentials("bb2-selenium-tests-slsx-client-secret") + DJANGO_USER_ID_ITERATIONS = credentials("bb2-integration-tests-bfd-iterations") + DJANGO_USER_ID_SALT = credentials("bb2-integration-tests-bfd-salt") + FHIR_CERT = credentials("bb2-integration-tests-bfd-cert") + FHIR_KEY = credentials("bb2-integration-tests-bfd-key") + FHIR_URL = "${params.FHIR_URL}" + HOSTNAME_URL = "http://localhost:8000" + } + + parameters { + string( + name: 'FHIR_URL', + defaultValue: "https://prod-sbx.bfd.cms.gov", + description: 'The default FHIR URL for the back end BFD service.' + ) + booleanParam( + name: 'RUN_SELENIUM_TESTS', + defaultValue: false, + description: 'Set to true, selenium tests will be run as part of integration tests' + ) + } + + stages { + stage("SETUP FHIR cert and key") { + steps { + writeFile(file: "${env.DJANGO_FHIR_CERTSTORE}/certstore/ca.cert.pem", text: readFile(env.FHIR_CERT)) + writeFile(file: "${env.DJANGO_FHIR_CERTSTORE}/certstore/ca.key.nocrypt.pem", text: readFile(env.FHIR_KEY)) + } + } + + stage("INSTALL Python Packages") { + steps { + sh """ + pip3 install --upgrade pip setuptools wheel + pip3 install -r requirements/requirements.dev.txt --no-index --find-links ./vendor/ + """ + } + } + + stage("CHECK Flake8 Python Lint/Style") { + steps{ + sh """ + flake8 + """ + } + } + + stage("START BB2 server in background") { + when { + expression { params.RUN_SELENIUM_TESTS == true } + } + steps{ + sh """ + mkdir ./docker-compose/tmp/ + (python3 ./dev-local/app.py&) && + python3 manage.py migrate && + python3 manage.py create_admin_groups && + python3 manage.py loaddata scopes.json && + python3 manage.py create_blue_button_scopes && + python3 manage.py create_test_user_and_application && + python3 manage.py create_user_identification_label_selection && + python3 manage.py create_test_feature_switches && + (if [ ! -d 'bluebutton-css' ] ; then git clone https://github.com/CMSgov/bluebutton-css.git ; else echo 'CSS already installed.' ; fi) && + echo 'starting bb2...' && + (export DJANGO_SETTINGS_MODULE=hhs_oauth_server.settings.logging_it && python3 manage.py runserver 0.0.0.0:8000 > ./docker-compose/tmp/bb2_email_to_stdout.log 2>&1 &) + """ + } + } + + stage("RUN logging integration tests") { + when { + expression { params.RUN_SELENIUM_TESTS == true } + } + steps{ + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + sh """ + USE_NEW_PERM_SCREEN=true ON_REMOTE_CI=true pytest -s ./apps/integration_tests/logging_tests.py::TestLoggings::test_auth_fhir_flows_logging + """ + } + sh """ + echo '======================' + cat ./docker-compose/tmp/bb2_email_to_stdout.log + echo '======================' + """ + } + } + + stage("RUN selenium user and apps management tests") { + when { + expression { params.RUN_SELENIUM_TESTS == true } + } + steps{ + sh 'echo "RUN selenium tests - user account and app management tests"' + sh """ + USE_NEW_PERM_SCREEN=true ON_REMOTE_CI=true pytest -s ./apps/integration_tests/selenium_accounts_tests.py::TestUserAndAppMgmt::testAccountAndAppMgmt + """ + } + } + + stage("RUN integration tests") { + steps{ + sh """ + python3 runtests.py --integration apps.integration_tests.integration_test_fhir_resources.IntegrationTestFhirApiResources + """ + } + } + + stage("RUN Django Unit Tests") { + steps{ + sh """ + python3 runtests.py + """ + } + } + + stage("RUN selenium tests") { + when { + expression { params.RUN_SELENIUM_TESTS == true } + } + steps{ + sh 'echo "RUN selenium tests - testclient based authorization flow tests and data flow tests"' + sh """ + USE_NEW_PERM_SCREEN=true ON_REMOTE_CI=true pytest -s ./apps/integration_tests/selenium_tests.py + """ + } + } + } +} diff --git a/Jenkinsfiles/cbc-pod-deployment-config-w-selenium-p311-chromium.yaml b/Jenkinsfiles/cbc-pod-deployment-config-w-selenium-p311-chromium.yaml new file mode 100644 index 000000000..016438567 --- /dev/null +++ b/Jenkinsfiles/cbc-pod-deployment-config-w-selenium-p311-chromium.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +spec: + containers: + - name: bb2-cbc-build-selenium-python311-chromium + image: "public.ecr.aws/f5g8o1y9/bb2-cbc-build-selenium-python311-chromium:latest" + tty: true + command: ["tail", "-f"] + imagePullPolicy: Always + nodeSelector: + Agents: true diff --git a/apps/integration_tests/log_event_schemas.py b/apps/integration_tests/log_event_schemas.py index a68535afe..dd2b840af 100755 --- a/apps/integration_tests/log_event_schemas.py +++ b/apps/integration_tests/log_event_schemas.py @@ -46,7 +46,7 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_share_demographic_scopes": {"pattern": "^True$"}, "auth_require_demographic_scopes": {"pattern": "^True$"}, }, @@ -94,7 +94,7 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_require_demographic_scopes": {"pattern": "^True$"}, "req_qparam_client_id": {"type": "string"}, "req_qparam_lang": {"type": "string"}, @@ -129,7 +129,7 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_require_demographic_scopes": {"pattern": "^True$"}, "path": {"pattern": "/mymedicare/login"}, "request_method": {"pattern": "GET"}, @@ -158,7 +158,7 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_crosswalk_action": {"enum": ["R", "C"]}, "auth_require_demographic_scopes": {"pattern": "^True$"}, "req_user_id": {"type": "number"}, @@ -195,7 +195,7 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_crosswalk_action": {"enum": ["R", "C"]}, "auth_require_demographic_scopes": {"pattern": "^True$"}, "req_qparam_client_id": {"type": "string"}, @@ -235,13 +235,13 @@ "auth_client_id": {"type": "string"}, "auth_app_id": {"type": "string"}, "auth_app_name": {"pattern": "TestApp"}, - "auth_app_data_access_type": {"pattern": "RESEARCH_STUDY"}, + "auth_app_data_access_type": {"pattern": "THIRTEEN_MONTH"}, "auth_crosswalk_action": {"enum": ["R", "C"]}, "auth_require_demographic_scopes": {"pattern": "^True$"}, "req_redirect_uri": {"type": "string"}, "req_scope": {"type": "string"}, "req_share_demographic_scopes": {"pattern": "^True$"}, - "req_allow": {"pattern": "Allow"}, + "req_allow": {"pattern": "Connect"}, "req_user_id": {"type": "integer"}, "req_user_username": {"type": "string"}, "req_fhir_id": {"type": "string"}, diff --git a/apps/integration_tests/selenium_cases.py b/apps/integration_tests/selenium_cases.py index fc04aea93..e5cd24525 100755 --- a/apps/integration_tests/selenium_cases.py +++ b/apps/integration_tests/selenium_cases.py @@ -576,16 +576,17 @@ class Action(Enum): "params": [20, By.ID, AUTH_SCREEN_ID_LANG, AUTH_SCREEN_EN_TXT] }, # now check the expiration info section - { - "display": "Check for authorization screen expire info in English", - "action": Action.CONTAIN_TEXT, - "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_EN_EXPIRE_INFO_TXT] - }, - { - "display": "Check en_US date format and validate", - "action": Action.CHECK_DATE_FORMAT, - "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_EN_DATE_FORMAT, EN_US] - }, + # comment out due to PROD TestApp now is RESEARCH_STUDY which does not have expire info + # { + # "display": "Check for authorization screen expire info in English", + # "action": Action.CONTAIN_TEXT, + # "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_EN_EXPIRE_INFO_TXT] + # }, + # { + # "display": "Check en_US date format and validate", + # "action": Action.CHECK_DATE_FORMAT, + # "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_EN_DATE_FORMAT, EN_US] + # }, # the 'approve' and 'deny' button click not using locale based text # so it is lang agnostic CLICK_AGREE_ACCESS @@ -644,16 +645,17 @@ class Action(Enum): "params": [20, By.ID, AUTH_SCREEN_ID_LANG, AUTH_SCREEN_ES_TXT] }, # now check the expiration info section - { - "display": "Check for authorization screen expire info in Spanish", - "action": Action.CONTAIN_TEXT, - "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_ES_EXPIRE_INFO_TXT] - }, - { - "display": "Check Spanish date format and validate", - "action": Action.CHECK_DATE_FORMAT, - "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_ES_DATE_FORMAT, ES_ES] - }, + # comment out due to on PROD TestApp is RESEARCH_STUDY which does not have expire info + # { + # "display": "Check for authorization screen expire info in Spanish", + # "action": Action.CONTAIN_TEXT, + # "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_ES_EXPIRE_INFO_TXT] + # }, + # { + # "display": "Check Spanish date format and validate", + # "action": Action.CHECK_DATE_FORMAT, + # "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_ES_DATE_FORMAT, ES_ES] + # }, # the 'approve' and 'deny' button click not using locale based text # so it is lang agnostic CLICK_AGREE_ACCESS @@ -672,16 +674,16 @@ class Action(Enum): "params": [20, By.ID, AUTH_SCREEN_ID_LANG, AUTH_SCREEN_ES_TXT] }, # now check the expiration info section - { - "display": "Check for authorization screen expire info in Spanish", - "action": Action.CONTAIN_TEXT, - "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_ES_EXPIRE_INFO_TXT] - }, - { - "display": "Check Spanish date format and validate", - "action": Action.CHECK_DATE_FORMAT, - "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_ES_DATE_FORMAT, ES_ES] - }, + # { + # "display": "Check for authorization screen expire info in Spanish", + # "action": Action.CONTAIN_TEXT, + # "params": [20, By.ID, AUTH_SCREEN_ID_EXPIRE_INFO, AUTH_SCREEN_ES_EXPIRE_INFO_TXT] + # }, + # { + # "display": "Check Spanish date format and validate", + # "action": Action.CHECK_DATE_FORMAT, + # "params": [20, By.ID, AUTH_SCREEN_ID_END_DATE, AUTH_SCREEN_ES_DATE_FORMAT, ES_ES] + # }, # the 'approve' and 'deny' button click not using locale based text # so it is lang agnostic CLICK_AGREE_ACCESS diff --git a/apps/integration_tests/selenium_generic.py b/apps/integration_tests/selenium_generic.py index f10c105cd..4ca02e488 100644 --- a/apps/integration_tests/selenium_generic.py +++ b/apps/integration_tests/selenium_generic.py @@ -9,6 +9,7 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.service import Service from .common_utils import extract_href_from_html, extract_last_part_of_url from .selenium_cases import ( @@ -50,10 +51,15 @@ def setup_method(self, method): else: print("driver_ready={}".format(SeleniumGenericTests.driver_ready)) + self.on_remote_ci = os.getenv('ON_REMOTE_CI', 'false') + self.selenium_grid_host = os.getenv('SELENIUM_GRID_HOST', "chrome") + self.selenium_grid = os.getenv('SELENIUM_GRID', "false") self.hostname_url = os.environ['HOSTNAME_URL'] self.use_mslsx = os.environ['USE_MSLSX'] self.login_seq = SEQ_LOGIN_MSLSX if self.use_mslsx == 'true' else SEQ_LOGIN_SLSX - print("use_mslsx={}, hostname_url={}".format(self.use_mslsx, self.hostname_url)) + msg_fmt = "use_mslsx={}, hostname_url={}, selenium_grid={}" + msg = msg_fmt.format(self.use_mslsx, self.hostname_url, self.selenium_grid) + print(msg) opt = webdriver.ChromeOptions() opt.add_argument("--disable-dev-shm-usage") @@ -67,8 +73,20 @@ def setup_method(self, method): opt.add_argument('--allow-insecure-localhost') opt.add_argument("--whitelisted-ips=''") - self.driver = webdriver.Remote( - command_executor='http://chrome:4444/wd/hub', options=opt) + if self.selenium_grid.lower() == 'true': + # selenium hub + hub_url = "http://{}:4444/wd/hub".format(self.selenium_grid_host) + print("RemoteDriver: grid hub url={}".format(hub_url)) + opt.binary_location = "/usr/bin/chromium" + self.driver = webdriver.Remote( + command_executor=hub_url, options=opt) + else: + driver_exec = '/usr/local/bin/chromedriver' if self.on_remote_ci.lower() == 'true' else '/usr/bin/chromedriver' + print("Chrome Driver, location={}".format(driver_exec)) + opt.add_argument("--window-size=1920,980") + opt.add_argument("--headless") + ser = Service(driver_exec) + self.driver = webdriver.Chrome(service=ser, options=opt) self.actions = { Action.LOAD_PAGE: self._load_page, diff --git a/docker-compose.selenium.remote.yml b/docker-compose.selenium.remote.yml index 683729f6d..59e8108fd 100644 --- a/docker-compose.selenium.remote.yml +++ b/docker-compose.selenium.remote.yml @@ -12,7 +12,7 @@ services: - chrome chrome: - image: seleniarm/standalone-chromium + image: selenium/standalone-chromium hostname: chrome ports: - "4444:4444" diff --git a/docker-compose.selenium.yml b/docker-compose.selenium.yml index a2b156421..f05b58072 100755 --- a/docker-compose.selenium.yml +++ b/docker-compose.selenium.yml @@ -17,7 +17,7 @@ services: condition: service_started chrome: - image: seleniarm/standalone-chromium + image: selenium/standalone-chromium hostname: chrome ports: - "4444:4444" @@ -50,6 +50,8 @@ services: bb2slsx: build: . command: ./docker-compose/bluebutton_server_start.sh + environment: + - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} env_file: # local devel specific variables go here! - .env diff --git a/docker-compose/run_selenium_tests_local.sh b/docker-compose/run_selenium_tests_local.sh index a1fa8522f..5f38c026c 100755 --- a/docker-compose/run_selenium_tests_local.sh +++ b/docker-compose/run_selenium_tests_local.sh @@ -40,6 +40,8 @@ display_usage() { echo echo "-h Print this Help." echo "-p Use new permissions screen (defaults to old style screen)." + echo "-g Selenium grid used - hub on port 4444." + echo "-t Show test case actions on std out." echo } @@ -77,17 +79,26 @@ export SERVICE_NAME="selenium-tests" export TESTS_LIST="./apps/integration_tests/selenium_tests.py ./apps/integration_tests/selenium_spanish_tests.py" export DJANGO_SETTINGS_MODULE="hhs_oauth_server.settings.dev" export BB2_SERVER_STD2FILE="" +# selenium grid +export SELENIUM_GRID=false +# Show test actions on std out : pytest -s +PYTEST_SHOW_TRACE_OPT='' -set_slsx +# this seems been overridden by set_msls below - comment out for removal +# set_slsx # Parse command line option -while getopts "hp" option; do +while getopts "hpgt" option; do case $option in h) display_usage exit;; p) export USE_NEW_PERM_SCREEN=true;; + g) + export SELENIUM_GRID=true;; + t) + export PYTEST_SHOW_TRACE_OPT='-s';; \?) display_usage exit;; @@ -96,6 +107,7 @@ done eval last_arg=\$$# +# the default is to use mock login - e.g. for account mgmt tests and logging integration tests set_msls # Parse command line option @@ -139,6 +151,7 @@ fi echo "DJANGO_SETTINGS_MODULE: " ${DJANGO_SETTINGS_MODULE} echo "HOSTNAME_URL: " ${HOSTNAME_URL} +echo "Selenium grid=" ${SELENIUM_GRID} # Set SYSTEM SYSTEM=$(uname -s) @@ -214,7 +227,7 @@ echo "MSLSX=" ${USE_MSLSX} echo "SERVICE NAME=" ${SERVICE_NAME} echo "USE_NEW_PERM_SCREEN=" ${USE_NEW_PERM_SCREEN} -docker-compose -f docker-compose.selenium.yml run --service-ports ${SERVICE_NAME} bash -c "pytest ${TESTS_LIST}" +docker-compose -f docker-compose.selenium.yml run --service-ports ${SERVICE_NAME} bash -c "DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} SELENIUM_GRID=${SELENIUM_GRID} pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}" #Stop containers after use echo_msg diff --git a/docker-compose/run_selenium_tests_remote.sh b/docker-compose/run_selenium_tests_remote.sh index 274bc2c81..a61432435 100755 --- a/docker-compose/run_selenium_tests_remote.sh +++ b/docker-compose/run_selenium_tests_remote.sh @@ -26,6 +26,8 @@ display_usage() { echo echo "-h Print this Help." echo "-p Test for newer permissions screen. Defaults to older screen." + echo "-g Selenium grid used." + echo "-t Show test case actions on std out." echo echo "Examples:" echo @@ -54,15 +56,22 @@ export SERVICE_NAME="selenium-tests-remote" export TESTS_LIST="./apps/integration_tests/selenium_tests.py ./apps/integration_tests/selenium_spanish_tests.py" # BB2 service end point default (SBX) export HOSTNAME_URL="https://sandbox.bluebutton.cms.gov/" +# selenium grid +export SELENIUM_GRID=false +# Show test actions on std out : pytest -s +PYTEST_SHOW_TRACE_OPT='' - -while getopts "hp" option; do +while getopts "hpgt" option; do case $option in h) display_usage; exit;; p) export USE_NEW_PERM_SCREEN=true;; + g) + export SELENIUM_GRID=true;; + t) + export PYTEST_SHOW_TRACE_OPT='-s';; \?) display_usage; exit;; @@ -103,13 +112,14 @@ SYSTEM=$(uname -s) echo "USE_NEW_PERM_SCREEN=" ${USE_NEW_PERM_SCREEN} echo "BB2 Server URL=" ${HOSTNAME_URL} +echo "Selenium grid=" ${SELENIUM_GRID} export USE_NEW_PERM_SCREEN export USE_MSLSX=false # stop all before run selenium remote tests docker-compose -f docker-compose.selenium.remote.yml down --remove-orphans -docker-compose -f docker-compose.selenium.remote.yml run selenium-remote-tests bash -c "pytest ${TESTS_LIST}" +docker-compose -f docker-compose.selenium.remote.yml run selenium-remote-tests bash -c "SELENIUM_GRID=${SELENIUM_GRID} pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}" # Stop containers after use echo_msg diff --git a/hhs_oauth_server/settings/logging_it.py b/hhs_oauth_server/settings/logging_it.py index 10bcf4b6f..ac3f511ff 100755 --- a/hhs_oauth_server/settings/logging_it.py +++ b/hhs_oauth_server/settings/logging_it.py @@ -15,7 +15,7 @@ try: os.mkdir(logdir_path) except FileExistsError as err: - print("Error os.mkdir: {}".format(err)) + print("Warning os.mkdir: {}".format(err)) if logging_handlers is None: raise ValueError("Bad settings, expecting handlers defined in settings.LOGGING")