11# Generated by Selenium IDE
2- import pytest
32import time
4- import json
53from selenium import webdriver
64from selenium .webdriver .common .by import By
75from selenium .webdriver .support import expected_conditions as EC
8- from selenium .webdriver .common .action_chains import ActionChains
9- from selenium .webdriver .support import expected_conditions
106from selenium .webdriver .support .wait import WebDriverWait
11- from selenium .webdriver .common .keys import Keys
12- from selenium .webdriver .common .desired_capabilities import DesiredCapabilities
137
148
159class TestNodeSampleApp ():
10+ driver_ready = False
11+
1612 def setup_method (self , method ):
17- print ("Waiting 20 sec. ======================================>>>>>>>>>" )
18- time .sleep (20 )
19- print ("Waited 20 sec. <<<<<<<<<<<<<<<================================" )
13+ if not TestNodeSampleApp .driver_ready :
14+ time .sleep (20 )
15+ TestNodeSampleApp .driver_ready = True
16+ print ("set driver_ready={}" .format (TestNodeSampleApp .driver_ready ))
17+ else :
18+ print ("driver_ready={}" .format (TestNodeSampleApp .driver_ready ))
2019
2120 opt = webdriver .ChromeOptions ()
2221 opt .add_argument ("--disable-dev-shm-usage" )
@@ -33,7 +32,6 @@ def setup_method(self, method):
3332
3433 # opt.add_argument('--headless')
3534 # self.driver = webdriver.Chrome(options=opt)
36- print ("Register remote debug driver. ***************************" )
3735 self .driver = webdriver .Remote (
3836 command_executor = 'http://chrome:4444/wd/hub' , options = opt )
3937
@@ -52,27 +50,46 @@ def _find_and_sendkey(self, timeout_sec, by, by_expr, txt, **kwargs):
5250 elem .send_keys (txt )
5351 return elem
5452
55- def test_node_sample_app (self ):
56- print ("In test_node_sample_app(): about to connect to FE at http://client:3000 ..." )
57- self .driver .get ("http://client:3000/" )
58- print ("Connected !" )
59- print ("Set window size to 1500 X 1800 ++++++++++++++" )
60- self .driver .set_window_size (1500 , 1800 )
61- print ("Locate button 'Authorize' and click ===================" )
62- # 3 | click | id=auth_btn |
63- elem = self ._find_and_click (30 , By .ID , "auth_btn" )
64- # self._find_and_click(30, By.ID, "auth_btn")
65- print ("Wait 10 sec for the bene login page to show up ===================" )
66- time .sleep (10 )
67- print ("Locate user name input and type user name ===================" )
53+ def _assert_EOB_table_header_present (self ):
54+ self ._find_and_click (30 , By .ID , "column_1" )
55+ self ._find_and_click (30 , By .ID , "column_2" )
56+ self ._find_and_click (30 , By .ID , "column_3" )
57+
58+ def _assert_EOB_table_records_present (self ):
59+ self ._find_and_click (30 , By .ID , "column_1" )
60+ self ._find_and_click (30 , By .ID , "column_2" )
61+ self ._find_and_click (30 , By .ID , "column_3" )
62+
63+ def _input_user_and_passwd_and_login (self ):
6864 self ._find_and_sendkey (30 , By .ID , "username-textbox" , "BBUser10000" )
69- print ("Locate password input and type password ===================" )
7065 self ._find_and_sendkey (30 , By .ID , "password-textbox" , "PW10000!" )
71- print ("Locate login button and click ===================" )
7266 self ._find_and_click (30 , By .ID , "login-button" )
73- print ("Wait 10 sec for access grant page to show up ===================" )
74- time .sleep (10 )
75- print ("Locate Approve button and click ===================" )
67+
68+ def test_node_sample_app_grant_access (self ):
69+ self .driver .get ("http://client:3000/" )
70+ self .driver .set_window_size (1500 , 1800 )
71+ elem = self ._find_and_click (30 , By .ID , "auth_btn" )
72+ assert elem is not None
73+ self ._input_user_and_passwd_and_login ()
7674 self ._find_and_click (30 , By .ID , "approve" )
77- print ( "Now should be able to see the Claims page ===================" )
75+ self . _assert_EOB_table_header_present ( )
7876
77+ def test_node_sample_app_grant_access_no_demographic (self ):
78+ self .driver .get ("http://client:3000/" )
79+ self .driver .set_window_size (1500 , 1800 )
80+ elem = self ._find_and_click (30 , By .ID , "auth_btn" )
81+ assert elem is not None
82+ self ._input_user_and_passwd_and_login ()
83+ # select radio button "No Demographic Data"
84+ self ._find_and_click (30 , By .CSS_SELECTOR , "label:nth-child(5)" )
85+ self ._find_and_click (30 , By .ID , "approve" )
86+ self ._assert_EOB_table_header_present ()
87+
88+ def test_node_sample_app_deny_access (self ):
89+ self .driver .get ("http://client:3000/" )
90+ self .driver .set_window_size (1500 , 1800 )
91+ elem = self ._find_and_click (30 , By .ID , "auth_btn" )
92+ assert elem is not None
93+ self ._input_user_and_passwd_and_login ()
94+ self ._find_and_click (30 , By .ID , "deny" )
95+ self ._assert_EOB_table_header_present ()
0 commit comments