Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_object_xpath(test_case, object_type):
- """Find the xpath for object type in the catalog browser"""
- driver = test_case.driver
- database_display_name = test_case.database_display_name
- connection_uid = test_case.connection_uid
- expand_database_and_catalog_node(driver, database_display_name, connection_uid, object_type) # great
- object_xpath = get_objects_xpath(driver, database_display_name, connection_uid, object_type)
- return object_xpath
- def catalog_object_option_map(option):
- """Defines the navigation rules for catalog object dropdowns"""
- open_definition = "//li[contains(@id,'catalogbrowserlist.openDefinition')]"
- open_data = "//li[contains(@id,'catalogbrowserlist.openContent')]"
- debug = "//li[contains(@id,'catalogbrowserlist.openForDebugging')]"
- delete = "//li[contains(@id,'catalogbrowserlist.delete')]"
- export = "//li[contains(@id,'catalogbrowserlist.openExport')]"
- call_proc = "//li[contains(@id,'catalogbrowserlist.invokeProcedure')]"
- call_proc_ui = "//li[contains(@id, 'catalogbrowserlist.invokeProcedureWithUI')]"
- create_shortcut = "//li[contains(@id,'catalogbrowserlist.copyShortcut')]"
- whereused = "//li[contains(@id,'objectdependencebrowser.open')]"
- opensql = "//li[contains(@id,'catalogbrowserlist.openSqlConsole')]"
- openmdx = "//li[contains(@id,'catalogbrowserlist.openMdxConsole')]"
- open_object_search = "//li[contains(@id,'searchbrowser.catalog.open')]"
- open_mdx_search = "//li[contains(@id,'mdxbrowser.catalog.open')]"
- object_map = {'open': open_definition, 'open_data': open_data,
- 'debug': debug, 'delete': delete, 'export': export,
- 'generate_call': call_proc, 'generate_call_ui': call_proc_ui,
- 'shortcut': create_shortcut, 'whereused': whereused,
- 'opensql': opensql, 'openmdx': openmdx, 'open_object_search': open_object_search,
- 'open_mdx_search': open_mdx_search}
- try:
- return object_map[option]
- except KeyError:
- print ('support for {} not added in yet'.format(option))
- def open_catalog_object_option(test_case, object_name, object_type, option, hdi=False):
- driver = test_case.driver
- catalog_xpath = get_object_xpath(test_case, object_type)
- click_button_by_xpath(driver, catalog_xpath)
- snooze(pauseTime * 5)
- type_in_by_xpath(driver, left_sidebar_search_xpath, object_name)
- snooze(pauseTime * 5)
- catalog_list_object_xpath = get_catalog_object_xpath(driver, catalog_list_xpath, object_name)
- if catalog_list_object_xpath:
- snooze(pauseTime)
- right_click_by_xpath(driver, catalog_list_object_xpath)
- snooze(pauseTime * 12)
- option_number = catalog_object_option_map(option)
- # go_down(driver, option_number)
- click_button_by_xpath(driver, option_number)
- snooze(pauseTime * 5)
- else:
- raise Exception('Couldn\'t find object in bottom left catalog browser')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement