def _test_drop_on_driver(browser): project_dict, workspace_page = startup(browser) # replace the 'top' assembly driver with a CONMINdriver replace_driver(workspace_page, 'top', 'CONMINdriver') # Check to see that the content area for the driver is now CONMINdriver driver_element = workspace_page.get_dataflow_figure('driver') eq(driver_element('content_area').find_element_by_xpath('center/i').text, 'CONMINdriver', "Dropping CONMINdriver onto existing driver did not replace it") closeout(project_dict, workspace_page)
def _test_drop_on_driver(browser): project_dict, workspace_page = startup(browser) # replace the 'top' assembly driver with a CONMINdriver replace_driver(workspace_page, 'top', 'CONMINdriver') # Check to see that the content area for the driver is now CONMINdriver driver_element = workspace_page.get_dataflow_figure('driver') eq( driver_element('content_area').find_element_by_xpath('center/i').text, 'CONMINdriver', "Dropping CONMINdriver onto existing driver did not replace it") closeout(project_dict, workspace_page)
def _test_list_slot(browser): project_dict, workspace_page = startup(browser) # replace the 'top' assembly driver with a DOEdriver # (this additionally verifies that an issue with DOEdriver slots is fixed) replace_driver(workspace_page, 'top', 'DOEdriver') # open the object editor dialog for the driver driver = workspace_page.get_dataflow_figure('driver', 'top') editor = driver.editor_page(False) editor.move(-200, 0) editor.show_slots() # get the generator slot figure slot_id = 'SlotFigure-%s-%s' % ('top-driver', 'DOEgenerator') generator_slot = browser.find_element(By.ID, slot_id) # check that slot is not filled eq(False, ("filled" in generator_slot.get_attribute('class')), "generator slot is showing as filled when it should not be") # drop a FullFactorial onto the generator slot generator = workspace_page.find_library_button('FullFactorial') slot_drop(browser, generator, generator_slot, True, 'generator') args_page = ArgsPrompt(workspace_page.browser, workspace_page.port) args_page.click_ok() # refresh time.sleep(1.0) # give it a second to update the figure generator_slot = browser.find_element(By.ID, slot_id) # check for class change (should now be filled) eq(True, ("filled" in generator_slot.get_attribute('class')), "FullFactorial did not drop into generator slot") # get the recorders slot figure slot_id = 'SlotFigure-%s-%s' % ('top-driver', 'recorders') recorders_slot = browser.find_element(By.ID, slot_id) # check that slot is not filled eq(False, ("filled" in recorders_slot.get_attribute('class')), "recorders slot is showing as filled when it should not be") # set center pane to workflow to make sure workflow doesn't steal drops workspace_page('workflow_tab').click() # drop a DumpCaseRecorder onto the recorders slot case_recorder = workspace_page.find_library_button('DumpCaseRecorder') slot_drop(browser, case_recorder, recorders_slot, True, 'recorders') args_page = ArgsPrompt(workspace_page.browser, workspace_page.port) args_page.click_ok() # refresh time.sleep(1.0) # give it a second to update the figure recorders_slot = browser.find_element(By.ID, slot_id) # check for class change (should now be filled) eq(True, ("filled" in recorders_slot.get_attribute('class')), "DumpCaseRecorder did not drop into recorders slot") # check that recorders fig now has one filled and one empty rect rects = recorders_slot.find_elements_by_css_selector('rect') eq(len(rects), 2) eq(True, ('stroke: #0b93d5' in rects[0].get_attribute('style')), "Filled slot element should be outlined in blue") eq(True, ('stroke: #808080' in rects[1].get_attribute('style')), "Unfilled slot element should be outlined in gray") klass = recorders_slot.find_elements_by_css_selector('text#klass') eq(klass[0].text, 'DumpCaseRecorder', "Filled slot element should show the correct type (DumpCaseRecorder)") eq(klass[1].text, 'ICaseRecorder', "Unfilled slot element should show the correct klass (ICaseRecorder)") # drop another CaseRecorder onto the recorders slot case_recorder = workspace_page.find_library_button('CSVCaseRecorder') slot_drop(browser, case_recorder, recorders_slot, True, 'recorders') args_page = ArgsPrompt(workspace_page.browser, workspace_page.port) args_page.click_ok() # refresh time.sleep(1.0) # give it a second to update the figure recorders_slot = browser.find_element(By.ID, slot_id) # check for class change (it should not change... still filled) eq(True, ("filled" in recorders_slot.get_attribute('class')), "CSVCaseRecorder did not drop into recorders slot") # check that recorders fig now has two filled and one empty rect rects = recorders_slot.find_elements_by_css_selector('rect') eq(len(rects), 3) eq(True, ('stroke: #0b93d5' in rects[0].get_attribute('style')), "Filled slot element should be outlined in blue") eq(True, ('stroke: #0b93d5' in rects[1].get_attribute('style')), "Filled slot element should be outlined in blue") eq(True, ('stroke: #808080' in rects[2].get_attribute('style')), "Unfilled slot element should be outlined in gray") klass = recorders_slot.find_elements_by_css_selector('text#klass') eq(klass[0].text, 'DumpCaseRecorder', "Filled slot element should show the correct type (DumpCaseRecorder)") eq(klass[1].text, 'CSVCaseRecorder', "Filled slot element should show the correct type (CSVCaseRecorder)") eq(klass[2].text, 'ICaseRecorder', "Unfilled slot element should show the correct klass (ICaseRecorder)") # drop another CaseRecorder onto the recorders slot case_recorder = workspace_page.find_library_button('DBCaseRecorder') slot_drop(browser, case_recorder, recorders_slot, True, 'recorders') args_page = ArgsPrompt(workspace_page.browser, workspace_page.port) args_page.click_ok() # refresh time.sleep(1.0) # give it a second to update the figure recorders_slot = browser.find_element(By.ID, slot_id) # check that recorders fig now has four total rects rects = recorders_slot.find_elements_by_css_selector('rect') eq(len(rects), 4) # remove an item from the list (the only context menu option) menu_item_remove = recorders_slot.find_element_by_css_selector('ul li') chain = ActionChains(browser) chain.move_to_element_with_offset(recorders_slot, 25, 25) chain.context_click(recorders_slot).perform() menu_item_remove.click() # refresh time.sleep(1.0) # give it a second to update the figure recorders_slot = browser.find_element(By.ID, slot_id) # check that recorders fig now has only three rect # TODO: check that the correct one was removed rects = recorders_slot.find_elements_by_css_selector('rect') eq(len(rects), 3) # Clean up. closeout(project_dict, workspace_page)