def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T54' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot lp.verify_username_field_displays(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(10) gp = generic_page(driver) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(15) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(15) # Click Tools dp.click_tools_icon() time.sleep(15) t = tools(driver) # Click FOLIODX t.click_foliodx() time.sleep(5) # switch to opened window driver.switch_to.window(driver.window_handles[1]) time.sleep(5) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(5) # Close new Window driver.close() # Switch to First Window (Broker Insight) driver.switch_to.window(driver.window_handles[0]) # LOGOUT Section # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen) # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(5) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T242' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "PROD" baseURL = Environments_BICL.return_environments(env) driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot lp.verify_username_field_displays(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(1) gp = generic_page(driver) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(60) # Enter Account Number and click Search dp.enter_account_number_search(account_number) # increase timeout to 15 time.sleep(15) mdp = MYCL_default_page(driver) # Click User Drop Down / Client Link, Redirect to Client Link Site # Click Menu Hamburger mdp.click_hamburger_menu() time.sleep(20) hm = hamburger_menu(driver) hm.click_client_link() # set to 10 or above time.sleep(30) # Navigate to Account / Positions # Verify text exists in Price Column current_url = driver.current_url slashparts = current_url.split('/') bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + '/' + home_index_string nav_screen = "account_positions" screen = Screens.return_screens(nav_screen) driver.get(nav_url + screen) # Set timeout to 25 time.sleep(25) pos = positions(driver) pos.verify_Close_Price_Column_Displays(test_case_ID, browser, env, time_stamp) time.sleep(1) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(1) # Logout # Click User Drop Down (on MYCL Default Page) mdp = MYCL_default_page(driver) mdp.click_user_drop_down() time.sleep(2) # Click Logout mudd = MYCL_user_drop_down(driver) mudd.click_logout() time.sleep(3) # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(3) driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # Create a valid date (1 month ago) date_previous_month = dg.return_date_one_month_ago() dv = date_validator() valid_date = dv.return_valid_date(date_previous_month).strftime("%m-%d-%Y") # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T156_b' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL_Admin = Environments_ADMIN.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" # Launch Admin Site driver.get(baseURL_Admin) driver.maximize_window() # Workaround to Navigate to User Admin Screen current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' manage_user_string = "ManageUser.aspx" manage_user_screen = base_url + manage_user_string # Navigate to Manage User Screen driver.get(manage_user_screen) time.sleep(5) adm = admin(driver) # search for user account adm.enter_user_account_click_search(username) time.sleep(5) adm.click_first_name_tab_3_times() time.sleep(5) # Change Office Code to CA adm.update_office_code_new(rep_code) time.sleep(5) # click Save adm.click_save() # Take screenshot, save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) # Set to at least 20 time.sleep(20) # Launch BICL Site # env = "UAT" baseURL_BICL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" time.sleep(1) driver.get(baseURL_BICL) driver.maximize_window() # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id("UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(10) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(5) # Click Tools dp.click_tools_icon() tls = tools(driver) time.sleep(10) # Confirm that Firelight Displays tls.confirm_firelight_displays(test_case_ID, browser, env, time_stamp) time.sleep(1) # Take screenshot save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) errorDisplays = False # Check if Error Modal Displays if len(driver.find_elements(By.XPATH, "/html/body/div[1]/div/div/div/button")) > 0: errorDisplays = True else: print("No Error") time.sleep(1) # Try / Except Block to test if errorDisplays False # If True, throw exception, take screenshot and FAIL test try: assert errorDisplays is False except AssertionError: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(1) # Take screenshot save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) # LOGOUT Section # TODO: Move Logout methods to Logout Class # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen)
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T342' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) lp.login(username, password) lp.click_login_button() time.sleep(10) gp = generic_page(driver) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(3) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(5) # Navigate to Account Info using URL String a = account(driver) # Click Account Info a.click_account_info() time.sleep(10) ai = account_info(driver) # Account Info Screen # Select "Documents" from VIEW Drop Down ai.select_documents() time.sleep(1) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) ddd = document_drop_down(driver) # Select OPEN ORDER CONFIRMS ddd.select_confirms() time.sleep(10) # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(15) # Switch to the IFrame Containing the Document driver.switch_to.frame(0) # Take Screenshot 4 screenshot_number = "4" time_stamp_4 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_4, screenshot_number, env, time_stamp_4) time.sleep(15) # Logout # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T43' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(3) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(5) # Verify if account icon can be clicked, if not, throw exception and take screenshot try: account_icon = dp.Page_Elements().driver.find_element_by_xpath( "/html/body/div[1]/aside/div/div[2]/ul/li[1]/a/i") account_icon.click() driver.set_page_load_timeout(30) except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise # Navigate to Account Info using URL String # dp.click_account_info_button() current_url = driver.current_url slashparts = current_url.split('/') bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + home_index_string screen_to_navigate_to_1 = "account_account_info" screen_1 = Screens.return_screens(screen_to_navigate_to_1) nav_string_1 = nav_url + screen_1 driver.get(nav_string_1) time.sleep(10) ai = account_info(driver) # Account Info Screen # Select "Documents" from VIEW Drop Down ai.select_documents() time.sleep(1) # Take screenshot after selecting Documents and save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) ddd = document_drop_down(driver) # Select OPEN ORDER CONFIRMS ddd.select_open_order_confirms() time.sleep(1) # Take screenshot after opening document and save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) time.sleep(15) # Switch to the IFrame Containing the PDF Document driver.switch_to.frame(0) # If Error Button displays, mark errorDisplays "TRUE" # errorDisplays default is FALSE errorDisplays = False if len( driver.find_elements( By.XPATH, "/html/body/div[1]/div/div/div/button")) > 0: errorDisplays = True else: print("No Error") # Try / Except Block to test if errorDisplays False # If True, throw exception, take screenshot and FAIL test try: assert errorDisplays is False except AssertionError: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise # Take screenshot before logout and save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) time.sleep(15) # Logout # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T216' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # Launch BICL Site # env = "UAT" baseURL_BICL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" time.sleep(1) driver.get(baseURL_BICL) driver.maximize_window() # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id("UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(1) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(1) # Click Tools dp.click_tools_icon() tls = tools(driver) time.sleep(1) cl = client_search(driver) # Take screenshot save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) # On Tools \ Client Search, input Rep Code cl.input_rep_code(rep_code) # Select "Total Value" From Criteria Column cl.select_value_from_criteria_column() # Select Greater Than 0 cl.select_from_greater_than_less_than_equal() cl.click_rep_code_field() # this will re-focus the mouse time.sleep(5) cl.input_number_value() # Click Go Button cl.click_go_button() time.sleep(5) # verify values in account number column cl.verify_values_in_account_number_column(test_case_ID, browser, env, time_stamp) cl.verify_values_in_name_column(test_case_ID, browser, env, time_stamp) cl.verify_values_in_total_column(test_case_ID, browser, env, time_stamp) # Commenting out phone & business phone verifications cl.verify_values_in_phone_column(test_case_ID, browser, env, time_stamp) cl.verify_values_in_bus_phone_column(test_case_ID, browser, env, time_stamp) cl.verify_values_in_rep_code_column(test_case_ID, browser, env, time_stamp) time.sleep(5) # Take screenshot save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) errorDisplays = False # Check if Error Modal Displays if len(driver.find_elements(By.XPATH, "/html/body/div[1]/div/div/div/button")) > 0: errorDisplays = True else: print("No Error") time.sleep(1) # Try / Except Block to test if errorDisplays False # If True, throw exception, take screenshot and FAIL test try: assert errorDisplays is False except AssertionError: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(1) # Take screenshot save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) # LOGOUT Section # TODO: Move Logout methods to Logout Class # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen)
account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) gp = generic_page(driver) # Timeout method for page to load, timeout set to 30 seconds
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # Create a valid date (1 month ago) date_previous_month = dg.return_date_one_month_ago() dv = date_validator() valid_date = dv.return_valid_date(date_previous_month).strftime("%m-%d-%Y") # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T51' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id("UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(10) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(5) # Verify if account icon can be clicked, if not, throw exception and take screenshot try: account_icon = dp.Page_Elements().driver.find_element_by_xpath( "/html/body/div[1]/aside/div/div[2]/ul/li[1]/a/i") account_icon.click() driver.set_page_load_timeout(30) except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(20) # Click HouseKeeping link dp.click_housekeeping_icon() time.sleep(10) # instantiate housekeeping hk = housekeeping(driver) # Click Documents # hk.click_documents() time.sleep(1) # instantiate documents doc = documents(driver) # Input Rep Code # doc.input_rep_code(rep_code) time.sleep(5) # Select GMAP Reports # Work Around to Select GMAP Reports doc.select_monthly_statements() time.sleep(5) doc.click_rep_code() ms = monthly_statements(driver) ms.select_month() time.sleep(5) # click Search Button doc.click_search_button() # ms.click_document() time.sleep(5) # Take screenshot after clicking search button and save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) time.sleep(20) errorDisplays = False # Check if Error Modal Displays if len(driver.find_elements(By.XPATH, "/html/body/div[1]/div/div/div/button")) > 0: errorDisplays = True else: print("No Error") time.sleep(1) # Try / Except Block to test if errorDisplays False # If True, throw exception, take screenshot and FAIL test try: assert errorDisplays is False except AssertionError: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(15) # Take screenshot after Display of Document and save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) time.sleep(25) # Take screenshot BEFORE logout and save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) # LOGOUT Section # Logout # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T205' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot, save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(5) # Click Account Search Button dp.click_account_search_button() time.sleep(5) # Take screenshot, save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) time.sleep(5) asm = account_search_modal(driver) # Click on Security Description Tab asm.click_security_description_tab() # Enter Security and Click Go asm.input_security(test_data1) asm.click_go_button() time.sleep(5) # Take screenshot, save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) sdr = security_description_results(driver) sdr.verify_text_displays(test_data2, test_case_ID, browser, env, time_stamp) # close account_search_modal asm.close_account_search_modal() time.sleep(5) # Take screenshot, save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) time.sleep(5) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T323' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) gp = generic_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(10) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) time.sleep(5) # Click Account Search Button dp.click_account_search_button() time.sleep(5) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(5) asm = account_search_modal(driver) # input value in NAME field asm.input_value_in_name_field(test_data1) # input value in SSN Field # asm.input_value_in_ssn_field(test_data2) # input value in Rep Code asm.clear_value_in_rep_code_field() # Click GO (Search) Button asm.click_account_search_go_button() # set to 10 - 15 time.sleep(15) asm.locate_click_account() # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(1) # Search for a previously searched for account dp.search_for_previously_searched_for_account() time.sleep(10) # Click GAIN & LOSS Icon dp.click_gain_loss_icon() time.sleep(5) # Enter "TEST" in NAME field of ACCOUNT SEARCH window asm.input_value_in_name_field(test_data2) # Click GO (Search) Button asm.click_account_search_go_button() time.sleep(15) # close account_search_modal asm.close_account_search_modal() time.sleep(5) # Open Account Search Modal, Perform Search with "TEST" in Name field dp.click_account_search_button_after_close() time.sleep(5) # Take Screenshot 4 screenshot_number = "4" time_stamp_4 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_4, screenshot_number, env, time_stamp_4) time.sleep(5) # Confirm that fields blank in Account Search Modal asm.verify_fields_blank_name(test_case_ID, browser, env, time_stamp) time.sleep(5) asm.verify_ssn_field_blank(test_case_ID, browser, env, time_stamp) time.sleep(5) asm.verify_rep_code_field_blank(test_case_ID, browser, env, time_stamp) time.sleep(5) # input TEST in NAME field asm.input_value_in_name_field(test_data2) time.sleep(1) # Click GO (Search) Button asm.click_account_search_go_button() # Set to 15 time.sleep(10) # close account_search_modal asm.close_account_search_modal() # LOGOUT Section # Click User Drop Down (on BICL Default Page) # dp.click_user_drop_down() # # time.sleep(2) # Click Logout # udd = user_drop_down(driver) # udd.click_logout() time.sleep(5) # Force Logout # Logout Workaround # Get current URL string, find base URL # Add logout_string to base_url to force logout current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' logout_string = "user/login?logout=1" logout_screen = base_url + logout_string # Navigate to Logout Screen driver.get(logout_screen) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T193' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "DEV" baseURL_Admin = Environments_ADMIN.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" # Launch Admin Site # driver.get(baseURL_Admin) # driver.maximize_window() # Assemble Admin URL String with User Creds parse_object = urlparse(baseURL_Admin) fdqm = parse_object.netloc base_url = "https://" + username + ":" + password + "@" + fdqm # Navigate to Admin Page using Admin URL String driver.get(base_url) driver.maximize_window() # Workaround to Navigate to User Admin Screen current_url = driver.current_url slashparts = current_url.split('/') # Now join back the first three sections 'http:', '' and 'example.com' base_url = '/'.join(slashparts[:3]) + '/' manage_user_string = "ManageUser.aspx" manage_user_screen = base_url + manage_user_string # Navigate to Manage User Screen driver.get(manage_user_screen) time.sleep(5) adm = admin(driver) # search for user account adm.enter_user_account_click_search(username) gp = generic_page(driver) gp.scroll_down() time.sleep(5) adm.click_password_reset_button() # Change focus to Modal time.sleep(1) # switch focus to modal driver.switch_to.window(driver.window_handles[1]) time.sleep(1) prm_before = password_reset_modal_before(driver) # Click Reset Password prm_before.click_reset_password() time.sleep(1) # Parse and Save Password String prm_after = password_reset_modal_after(driver) updated_password = prm_after.return_new_password() # time.sleep(1) # print(updated_password) # time.sleep(1) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) # Close password reset modal prm_after.click_close() time.sleep(1) # switch focus to parent window driver.switch_to.window(driver.window_handles[0]) time.sleep(1) # Launch BICL Site & login # env = "DEV" baseURL_BICL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" time.sleep(5) driver.get(baseURL_BICL) driver.maximize_window() time.sleep(1) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, updated_password) lp.click_login_button() time.sleep(10) # Set Password back to original cpm = change_password_modal(driver) # input password into required fields cpm.input_new_password(password) # confirm password # cpm.confirm_new_password(password) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) # Click Submit cpm.click_submit_button() time.sleep(1) # Close "Change Password" Modal cpm.close_change_password_modal() time.sleep(1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(5) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Launch BICL Site driver.get(baseURL_BICL) driver.maximize_window() # Login to Site lp = LoginPage(driver) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) lp.login(username, password) lp.click_login_button() time.sleep(5) dp = default_page(driver) time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T237' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # Launch BICL Site # env = "UAT" baseURL_BICL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" time.sleep(1) driver.get(baseURL_BICL) driver.maximize_window() # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise # Take screenshot save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) time.sleep(5) errorDisplays = False # Check if Error Modal Displays if len( driver.find_elements( By.XPATH, "/html/body/div[1]/div/div/div/button")) > 0: errorDisplays = True else: print("No Error") time.sleep(1) # Try / Except Block to test if errorDisplays False # If True, throw exception, take screenshot and FAIL test try: assert errorDisplays is False except AssertionError: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(1) # Take screenshot save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T194' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(1) # Take screenshot, save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(1) # Enter Account Number and click Search dp.enter_account_number_search(account_number) # increase timeout to 15 time.sleep(20) mdp = MYCL_default_page(driver) # Click User Drop Down / Client Link, Redirect to Client Link Site # Click Menu Hamburger mdp.click_hamburger_menu() time.sleep(5) hm = hamburger_menu(driver) hm.click_client_link() # set to 10 or above time.sleep(10) # Navigate to Gains & Loss / Unrealized Summary # Verify text exists in Price Column current_url = driver.current_url slashparts = current_url.split('/') bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + '/' + home_index_string screen_to_navigate_to_1 = "gains_loss_unrealized_summary" screen_1 = Screens.return_screens(screen_to_navigate_to_1) driver.get(nav_url + screen_1) # Set timeout to 25 time.sleep(30) glus = gain_loss_unrealized_summary(driver) time.sleep(1) glus.verify_values_display_in_Price_Column(test_case_ID, browser, env, time_stamp) time.sleep(1) # Take screenshot, save to utilities/test_results/screenshots screenshot_2 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_2" + "_" + control_point_2 + "_" + time_stamp + ".png" saved_screenshot_location_2 = str(screenshot_directory / screenshot_2) driver.get_screenshot_as_file(saved_screenshot_location_2) # Navigate to Gains & Loss / Unrealized Detail # Verify text exists in Price Column bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + '/' + home_index_string screen_to_navigate_to_2 = "gains_loss_unrealized_detail" screen_2 = Screens.return_screens(screen_to_navigate_to_2) driver.get(nav_url + screen_2) time.sleep(25) glud = gain_loss_unrealized_detail(driver) glud.verify_values_display_in_Price_Column(test_case_ID, browser, env, time_stamp) # Take screenshot, save to utilities/test_results/screenshots screenshot_3 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_3" + "_" + control_point_3 + "_" + time_stamp + ".png" saved_screenshot_location_3 = str(screenshot_directory / screenshot_3) driver.get_screenshot_as_file(saved_screenshot_location_3) # Navigate to Account / Positions # Verify text exists in Price Column bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + '/' + home_index_string screen_to_navigate_to_3 = "account_positions" screen_3 = Screens.return_screens(screen_to_navigate_to_3) driver.get(nav_url + screen_3) time.sleep(25) ap = positions(driver) ap.verify_values_display_in_Price_Column(test_case_ID, browser, env, time_stamp) # Take screenshot, save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) time.sleep(1) # Logout # Click User Drop Down (on MYCL Default Page) mdp = MYCL_default_page(driver) mdp.click_user_drop_down() time.sleep(2) # Click Logout mudd = MYCL_user_drop_down(driver) mudd.click_logout() time.sleep(1) driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # CSV Reader # Read in username, password and env variables with open(csv_directory) as f: rows = list(csv.reader(f)) test_scenario = rows[2][0] username = rows[2][1] password = rows[2][2] account_number = rows[1][3] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "BICL_UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads, if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_scenario + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) lp.login(username, password) lp.click_login_button() time.sleep(10) # Take screenshot after login and save to utilities/test_results/screenshots screenshot_name = test_scenario + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(5) except: screenshot_name = "FAIL" + "_" + test_scenario + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) time.sleep(3) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(5) # Verify if overview displays, if not, throw exception and take screenshot try: overview = dp.Page_Elements().driver.find_element_by_xpath( "/html/body/div[1]/div[2]/div/div/ul/li[1]/a") overview.click driver.set_page_load_timeout(30) except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_scenario + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) # Logout lg = Logout(driver) lg.click_user_drop_down() time.sleep(2) lg.click_logout() driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T386' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot lp.verify_username_field_displays(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(10) gp = generic_page(driver) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(15) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(15) # Verify if account icon can be clicked, if not, throw exception and take screenshot dp.verify_account_icon_clickable(test_case_ID, browser, env, time_stamp) # Click Menu Hamburger dp.click_menu_hamburger() time.sleep(5) hm = hamburger_menu(driver) # Click Account on Hamburger Menu hm.click_account() time.sleep(5) # Open Distributions hm.select_distributions() time.sleep(5) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(5) # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(5) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T267_a' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) gp = generic_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(10) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(1) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(10) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) # Click Notes Button dp.click_notes_button() time.sleep(15) nm = notes_modal(driver) # click "All Rep Notes" nm.click_all_rep_notes_tab() time.sleep(1) # Click PDF Export Button arnt = all_rep_notes_tab(driver) arnt.click_export_pdf_button() time.sleep(3) # Switch to Rep Notes PDF driver.switch_to.window(driver.window_handles[1]) time.sleep(3) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(5) # Close Window driver.close() time.sleep(1) # Switch back to Main Window driver.switch_to.window(driver.window_handles[0]) # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(5) # LOGOUT Section # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T369' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) # baseURL = "https://beta.bi.dev.wedbus.com" driver.get(baseURL) driver.maximize_window() time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot lp.verify_username_field_displays(test_case_ID, browser, env, time_stamp) lp.login(username, password) lp.click_login_button() time.sleep(10) gp = generic_page(driver) # Take Screenshot 1 screenshot_number = "1" time_stamp_1 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_1, screenshot_number, env, time_stamp_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds gp.verify_page_loads(test_case_ID, browser, env, time_stamp) time.sleep(15) # Click Housekeeping dp.click_housekeeping_icon() time.sleep(15) h = housekeeping(driver) time.sleep(5) # Click MF Questionnaire Mgr # h.click_mf_questionnaire_mgr() # Navigation Workaround current_url = driver.current_url slashparts = current_url.split('/') bbu = build_base_url() home_index_string = bbu.return_home_index_string() nav_url = '/'.join(slashparts[:3]) + home_index_string screen_to_navigate_to_1 = "housekeeping_mf_questionnaire_MGR" screen = Screens.return_screens(screen_to_navigate_to_1) nav_string = nav_url + screen driver.get(nav_string) time.sleep(15) # Validate that correct panel displays (correct title displays on screen) gp.validate_correct_text_displays(test_data1, test_case_ID, browser, env, time_stamp) time.sleep(5) # Take Screenshot 2 screenshot_number = "2" time_stamp_2 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_2, screenshot_number, env, time_stamp_2) time.sleep(5) # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() udd = user_drop_down(driver) udd.click_logout() # Take Screenshot 3 screenshot_number = "3" time_stamp_3 = dg.return_time_stamp() gp.take_screenshot(test_case_ID, browser, control_point_3, screenshot_number, env, time_stamp_3) time.sleep(5) # Close Browser driver.quit()
def test_login_chrome(self, browser, env): driver = browser # Create Time Stamp Variable (using Date Time Generator Class in utilities) dg = date_time_generator() time_stamp = dg.return_time_stamp() date_today = dg.return_date_today() time_today = dg.return_time_today() # This section reads in values from csv file using Pandas Library # Declare Test Case ID test_case_ID = 'QTML-T175' # Declare csv directory df = pd.read_csv(csv_directory) # print(df) # Select Row where "Test_Case_ID" Column Matches the test_case_ID declared above (Line 31) # This is the row that contains the data values for this test scenario test_case_row = df.loc[df.Test_Case_ID == test_case_ID] # print(test_case_row) # Read in Values from "test_case_row" object test_scenario = test_case_row['Test_Scenario'].values[0] username = test_case_row['User'].values[0] password = test_case_row['Password'].values[0] browser = test_case_row['Browser'].values[0] account_number = test_case_row['account_number'].values[0] rep_code = test_case_row['rep_code'].values[0] test_data1 = test_case_row['test_data1'].values[0] test_data2 = test_case_row['test_data_2'].values[0] control_point_1 = test_case_row['control_point_1'].values[0] control_point_2 = test_case_row['control_point_2'].values[0] control_point_3 = test_case_row['control_point_3'].values[0] control_point_4 = test_case_row['control_point_4'].values[0] # To DEBUG, Uncomment this NEXT line AND Comment lines 13, 15 and 18. Also, SHIFT + TAB lines 17 - 86 (This will remove indents) # driver = webdriver.Chrome(str(CONFIG_PATH / 'chromedriver.exe')) ## Select Appropriate URL based on the Environment Value (env) # env = "UAT" baseURL = Environments_BICL.return_environments(env) driver.get(baseURL) driver.maximize_window() # Search for User Account time.sleep(5) # Login to Site lp = LoginPage(driver) # Verify if page loads (username_field should be clickable), if not, throw exception and take screenshot try: username_field = lp.Page_Elements().driver.find_element_by_id( "UserName") username_field.click() except NoSuchElementException: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise lp.login(username, password) lp.click_login_button() time.sleep(5) # Take screenshot, save to utilities/test_results/screenshots screenshot_1 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_1" + "_" + control_point_1 + "_" + time_stamp + ".png" saved_screenshot_location_1 = str(screenshot_directory / screenshot_1) driver.get_screenshot_as_file(saved_screenshot_location_1) dp = default_page(driver) # Timeout method for page to load, timeout set to 30 seconds try: driver.set_page_load_timeout(30) except: screenshot_name = "FAIL" + "_" + test_case_ID + "_" + browser + "_" + env + "_" + time_stamp + ".png" saved_screenshot_location = str(screenshot_directory / screenshot_name) driver.get_screenshot_as_file(saved_screenshot_location) raise time.sleep(5) # Enter Account Number and click Search dp.enter_account_number_search(account_number) time.sleep(1) # Navigate to Order Entry dp.click_order_entry_icon() time.sleep(1) oe = order_entry(driver) time.sleep(3) # Click Mutual Funds oe.click_mutual_funds() mf = mutual_funds(driver) time.sleep(2) # Mutual Funds Screen # Select Sell on Action Drop Down mf.select_sell_from_action_dropdown() time.sleep(2) # Input Sell Quantity in Quantity Field mf.input_value_in_quantity() time.sleep(2) # Input Value in Fund mf.input_value_in_fund(test_data1) time.sleep(2) # Select SHARE from Transaction Type mf.select_share_from_transaction_type_dropdown() time.sleep(2) # Select SOLICITED from Drop Down mf.select_solicited_from_dropdown() time.sleep(2) # Input value in Accepted By mf.input_value_in_accepted_by(username) time.sleep(2) # Input Date Today mf.input_date_today(date_today) time.sleep(2) # Input Time Today mf.input_time_today(time_today) time.sleep(2) # Click Submit mf.click_submit_button() time.sleep(1) # Verify that Questionnaire does not display # Logout # Click User Drop Down (on BICL Default Page) dp.click_user_drop_down() time.sleep(2) # Click Logout udd = user_drop_down(driver) udd.click_logout() # Take screenshot, save to utilities/test_results/screenshots screenshot_4 = test_case_ID + "_" + browser + "_" + env + "_" + "screenshot_4" + "_" + control_point_4 + "_" + time_stamp + ".png" saved_screenshot_location_4 = str(screenshot_directory / screenshot_4) driver.get_screenshot_as_file(saved_screenshot_location_4) driver.quit()