Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/accounts/fixtures/scopes.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
"group": 5,
"description": "Launch with FHIR Patient context.",
"protected_resources": "[]",
"default": "False"
"default": "True"
}
}
]
37 changes: 30 additions & 7 deletions apps/integration_tests/selenium_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

HOSTNAME_URL = os.environ['HOSTNAME_URL']
USE_NEW_PERM_SCREEN = os.environ['USE_NEW_PERM_SCREEN']
USE_LOGIN_WITH_MEDICARE_BUTTON = os.getenv('USE_LOGIN_WITH_MEDICARE_BUTTON', 'false')
PROD_URL = 'https://api.bluebutton.cms.gov'
USER_ACTIVATION_PATH_FMT = "{}/v1/accounts/activation-verify/{}"

Expand Down Expand Up @@ -134,11 +135,13 @@ class Action(Enum):
APP_CSS_SELECTOR_DELETE_APP = ".cta-button:nth-child(2)"

# SLSX login form
SLSX_TXT_FLD_USERNAME = "username-textbox"
SLSX_TXT_FLD_PASSWORD = "password-textbox"
SLSX_TXT_FLD_USERNAME = 'username'
SLSX_TXT_FLD_PASSWORD = 'password'
SLSX_TXT_FLD_USERNAME_VAL = "BBUser00001"
SLSX_TXT_FLD_PASSWORD_VAL = "PW00001!"
SLSX_CSS_BUTTON = "login-button"
SLSX_CSS_CONTINUE_BUTTON = "button[type='submit']"
SLSX_CSS_LOGIN_BUTTON = "//button[@type='submit' and (normalize-space(text())='Log in' or normalize-space(text())='Entrar')]"

# Demographic info access grant form
BTN_ID_GRANT_DEMO_ACCESS = "approve"
Expand Down Expand Up @@ -266,22 +269,42 @@ class Action(Enum):
},
]

SEQ_LOGIN_SLSX = [
LOGIN_WITH_MEDICARE_BUTTON_SETUP = []
if USE_LOGIN_WITH_MEDICARE_BUTTON == 'true':
LOGIN_WITH_MEDICARE_BUTTON_SETUP = [{
"display": "Click 'Log in with Medicare.gov' button",
"action": Action.FIND_CLICK,
"params": [
20,
By.CSS_SELECTOR,
"button.ds-c-button.ds-c-button--solid.ds-u-margin-top--2"
],
}]

SEQ_LOGIN_SLSX = LOGIN_WITH_MEDICARE_BUTTON_SETUP + [

{
"display": "Medicare.gov login username",
"action": Action.FIND_SEND_KEY,
"params": [20, By.ID, SLSX_TXT_FLD_USERNAME, SLSX_TXT_FLD_USERNAME_VAL]
"params": [20, By.NAME, SLSX_TXT_FLD_USERNAME, SLSX_TXT_FLD_USERNAME_VAL]
},
{
"display": "Click 'Continue' on SLSX login form",
"action": Action.FIND_CLICK,
"params": [20, By.CSS_SELECTOR, SLSX_CSS_CONTINUE_BUTTON]
},
WAIT_SECONDS,
{
"display": "Medicare.gov login password",
"action": Action.FIND_SEND_KEY,
"params": [20, By.ID, SLSX_TXT_FLD_PASSWORD, SLSX_TXT_FLD_PASSWORD_VAL]
"params": [20, By.NAME, SLSX_TXT_FLD_PASSWORD, SLSX_TXT_FLD_PASSWORD_VAL]
},
{
"display": "Click 'submit' on SLSX login form",
"display": "Click 'Log In' on SLSX login form",
"action": Action.FIND_CLICK,
"params": [20, By.ID, SLSX_CSS_BUTTON]
"params": [20, By.XPATH, SLSX_CSS_LOGIN_BUTTON]
},
WAIT_SECONDS
]

SEQ_REACH_AUTHORIZE_BTN = [
Expand Down
5 changes: 1 addition & 4 deletions docker-compose/run_selenium_tests_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ display_usage() {
echo "Options:"
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
Expand Down Expand Up @@ -74,7 +73,7 @@ echo_msg
set -e -u -o pipefail

export USE_MSLSX=true
export USE_NEW_PERM_SCREEN=false
export USE_NEW_PERM_SCREEN=true
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"
Expand All @@ -93,8 +92,6 @@ while getopts "hpgt" option; do
h)
display_usage
exit;;
p)
export USE_NEW_PERM_SCREEN=true;;
g)
export SELENIUM_GRID=true;;
t)
Expand Down
22 changes: 15 additions & 7 deletions docker-compose/run_selenium_tests_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ display_usage() {
echo "Options:"
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 '-l Use Login with Medicare.gov button'
echo
echo "Examples:"
echo
echo "run_selenium_tests_remote.sh -p https://sandbox.bluebutton.cms.gov/ (or SBX)"
echo "run_selenium_tests_remote.sh https://sandbox.bluebutton.cms.gov/ (or SBX)"
echo
echo "run_selenium_tests_remote.sh https://api.bluebutton.cms.gov/ (or PROD)"
echo
echo "run_selenium_tests_remote.sh -p https://test.bluebutton.cms.gov/ (or TEST)"
echo "run_selenium_tests_remote.sh https://test.bluebutton.cms.gov/ (or TEST)"
echo
echo "<bb2 server url> default to SBX (https://sandbox.bluebutton.cms.gov/)"
echo
Expand All @@ -50,7 +50,8 @@ echo_msg
# Set bash builtins for safety
set -e -u -o pipefail

export USE_NEW_PERM_SCREEN=false
USE_LOGIN_WITH_MEDICARE_BUTTON="${USE_LOGIN_WITH_MEDICARE_BUTTON:-}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to get a run of docker-compose/run_selenium_tests_remote.sh TEST to ever record USE_LOGIN_WITH_MEDICARE_BUTTON=false, even when I set USE_LOGIN_WITH_MEDICARE_BUTTON='false' prior to running. This might not be working correctly, or maybe I'm not setting the variable correctly. Can you check that out, and let me know if there is a way to force USE_LOGIN_WITH_MEDICARE_BUTTON='false' against TEST?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add this variable to docker-compose/selenium-env-vars.env

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, I added USE_LOGIN_WITH_MEDICARE_BUTTON=false to the env file, but in the output I still see USE_LOGIN_WITH_MEDICARE_BUTTON= true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how you are executing it
If you are executing this

./docker-compose/run_selenium_tests_remote.sh TEST

Then in terminal you have to do
export USE_LOGIN_WITH_MEDICARE_BUTTON=false then you will be able to see it in terminal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That worked, thanks!

export USE_NEW_PERM_SCREEN=true
export SERVICE_NAME="selenium-tests-remote"
# TODO optionally add the Spanish selenium tests here if desired
export TESTS_LIST="./apps/integration_tests/selenium_tests.py ./apps/integration_tests/selenium_spanish_tests.py"
Expand All @@ -66,10 +67,10 @@ while getopts "hpgt" option; do
h)
display_usage;
exit;;
p)
export USE_NEW_PERM_SCREEN=true;;
g)
export SELENIUM_GRID=true;;
l)
export USE_LOGIN_WITH_MEDICARE_BUTTON=true;;
t)
export PYTEST_SHOW_TRACE_OPT='-s';;
\?)
Expand All @@ -93,6 +94,9 @@ then
;;
TEST)
export HOSTNAME_URL="https://test.bluebutton.cms.gov/"
if [[ -z "${USE_LOGIN_WITH_MEDICARE_BUTTON}" ]]; then
export USE_LOGIN_WITH_MEDICARE_BUTTON=true
fi
;;
*)
if [[ ${last_arg} == 'http'* ]]
Expand All @@ -111,6 +115,7 @@ fi
SYSTEM=$(uname -s)

echo "USE_NEW_PERM_SCREEN=" ${USE_NEW_PERM_SCREEN}
echo "USE_LOGIN_WITH_MEDICARE_BUTTON=" ${USE_LOGIN_WITH_MEDICARE_BUTTON}
echo "BB2 Server URL=" ${HOSTNAME_URL}
echo "Selenium grid=" ${SELENIUM_GRID}

Expand All @@ -119,7 +124,10 @@ 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 "SELENIUM_GRID=${SELENIUM_GRID} pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}"
docker compose -f docker-compose.selenium.remote.yml run selenium-remote-tests bash -c \
"SELENIUM_GRID=${SELENIUM_GRID} \
USE_LOGIN_WITH_MEDICARE_BUTTON=${USE_LOGIN_WITH_MEDICARE_BUTTON} \
pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}"

# Stop containers after use
echo_msg
Expand Down
Loading