Skip to content

Commit a3e6fdc

Browse files
author
JAMES FUQIAN
committed
added test case and update readme with selennium specific info.
1 parent c55b92f commit a3e6fdc

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ Running the Back-end & Front-end
2626
Once Docker and Python are Installed then do the following:
2727

2828
cp server/sample-bluebutton-config.json server/.bluebutton-config.json
29-
29+
30+
or (if running docker compose selenium tests)
31+
32+
cp server/sample-bluebutton-selenium-config.json server/.bluebutton-config.json
33+
3034
Make sure to replace the client_id and client_secret variables within the config file with
3135
the ones you were provided, for your application, when you created your Blue Button Sandbox account,
3236
the supported environments are SANDBOX or PRODUCTION.
@@ -70,6 +74,10 @@ debugpy remote debugging enabled on port 5678 for server in docker compose, deve
7074

7175
Configure the remote target BB2 instance where the tested app is registered (as described above "Running the Back-end & Front-end")
7276

77+
Also use below call back URL in configuration, and add it as redirect URI at Blue Button API app registry:
78+
79+
http://server:3001/api/bluebutton/callback/
80+
7381
Go to local repository base directory and run docker compose as below:
7482

7583
docker-compose -f docker-compose.selenium.yml up --abort-on-container-exit

selenium_tests/src/test_node_sample.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Generated by Selenium IDE
21
import time
32
from selenium import webdriver
43
from selenium.webdriver.common.by import By
54
from selenium.webdriver.support import expected_conditions as EC
65
from selenium.webdriver.support.wait import WebDriverWait
76

7+
CSS_SEL_FE_ERR_MSG_CONTENT = "tbody .ds-u-text-align--left:nth-child(2)"
8+
89

910
class TestNodeSampleApp():
1011
driver_ready = False
@@ -73,6 +74,13 @@ def _assert_EOB_table_records_present(self, cnt):
7374
elements = self._find_elem_xpath(xpath)
7475
assert len(elements) == cnt
7576

77+
def _assert_EOB_table_error_present(self):
78+
element = self._find_and_return(30,
79+
By.CSS_SELECTOR,
80+
CSS_SEL_FE_ERR_MSG_CONTENT)
81+
assert element is not None
82+
print(element.text)
83+
7684
def _input_user_and_passwd_and_login(self):
7785
self._find_and_sendkey(30, By.ID, "username-textbox", "BBUser10000")
7886
self._find_and_sendkey(30, By.ID, "password-textbox", "PW10000!")
@@ -110,5 +118,26 @@ def test_node_sample_app_deny_access(self):
110118
self._input_user_and_passwd_and_login()
111119
self._find_and_click(30, By.ID, "deny")
112120
time.sleep(5)
113-
self._assert_EOB_table_header_present()
114-
self._assert_EOB_table_records_present(0)
121+
self._assert_EOB_table_error_present()
122+
123+
def test_node_sample_app_grant_followed_by_deny_access(self):
124+
'''
125+
this is to verify that the cached result from previous
126+
authorized eob query is clean up (should not see cached claims)
127+
'''
128+
self.driver.get("http://client:3000/")
129+
self.driver.set_window_size(1500, 1800)
130+
elem = self._find_and_click(30, By.ID, "auth_btn")
131+
assert elem is not None
132+
self._input_user_and_passwd_and_login()
133+
self._find_and_click(30, By.ID, "approve")
134+
time.sleep(5)
135+
self._assert_EOB_table_records_present(10)
136+
# go again
137+
elem = self._find_and_click(30, By.ID, "auth_btn")
138+
assert elem is not None
139+
self._input_user_and_passwd_and_login()
140+
self._find_and_click(30, By.ID, "deny")
141+
time.sleep(5)
142+
# should see error message
143+
self._assert_EOB_table_error_present()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"environment": "SANDBOX",
3+
"client_id": "<client_id>",
4+
"client_secret": "<client_secret>",
5+
"callback_url": "http://server:3001/api/bluebutton/callback/",
6+
"version": 2
7+
}

0 commit comments

Comments
 (0)