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)
Ejemplo n.º 2
0
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)
def _test_slots(browser):
    project_dict, workspace_page = startup(browser)

    editor, metamodel, caseiter, caserec, comp, meta_name = slot_reset(
        workspace_page)

    execcomp = workspace_page.find_library_button('ExecComp')

    ##################################################
    # First part of test: Drag and drop ExecComp from the Library
    # onto the recorder slot of a MetaModel. This should fail.
    ##################################################
    #drag one success and one failure onto slots
    #failure:
    slot_drop(browser, execcomp, caserec, False, 'Component')

    slot_id = 'SlotFigure-%s-%s'

    #refresh
    time.sleep(1.0)  # give it a second to update the figure
    caserec = browser.find_element(By.ID, slot_id % (meta_name, 'recorder'))

    #check for class change
    eq(False, ("filled" in caserec.get_attribute('class')),
       "Component dropped into CaseRecorder (should not have)")

    ##################################################
    # Second part of test: Drag and drop ExecComp from the Library onto the
    # model (IComponent) slot of a MetaModel.
    ##################################################
    slot_drop(browser, execcomp, comp, True, 'Component')
    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
    comp = browser.find_element(By.ID, slot_id % (meta_name, 'model'))

    #check for class change
    eq(True, ("filled" in comp.get_attribute('class')),
       "Component did not drop into Component slot")

    #for the future:
    """
    # get the objects we need for the test
    # setup a data structure explaining which things can be dropped where
    # element, dropOnCaseIter, dropOnCaseRec, dropOnComp
    dropdata = [('CSVCaseIterator', True, False, False),\
                 ('CSVCaseRecorder', False, True, False),\
                 ('ExecComp', False, False, True),\
                 ('Assembly', False, False, True)]

    drop_elements = [(workspace_page.find_library_button(ele[0]), ele[1], ele[2], ele[3]) for ele in dropdata]

    #now loop through each dropable item, and see what happens when it lands on the target
    for ele in drop_elements:
        #drop on caseiter
        slot_drop(browser, ele[0].element, caseiter, ele[1], 'CaseIterator')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on caserec
        slot_drop(browser, ele[0].element, caserec, ele[2], 'CaseRecorder')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on comp
        slot_drop(browser, ele[0].element, comp, ele[3], 'Component')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR

        editor, metamodel, caseiter, caserec, comp = slot_reset(workspace_page, editor, metamodel, True)
    """

    closeout(project_dict, workspace_page)
Ejemplo n.º 4
0
def _test_slots(browser):
    project_dict, workspace_page = startup(browser)

    editor, metamodel, caseiter, caserec, comp, meta_name = slot_reset(workspace_page)

    execcomp = workspace_page.find_library_button('ExecComp')

    ##################################################
    # First part of test: Drag and drop ExecComp from the Library
    # onto the recorder slot of a MetaModel. This should fail.
    ##################################################
    #drag one success and one failure onto slots
    #failure:
    slot_drop(browser, execcomp, caserec, False, 'Component')

    slot_id = 'SlotFigure-%s-%s'

    #refresh
    time.sleep(1.0)  # give it a second to update the figure
    caserec = browser.find_element(By.ID, slot_id % (meta_name, 'recorder'))

    #check for class change
    eq(False, ("filled" in caserec.get_attribute('class')),
        "Component dropped into CaseRecorder (should not have)")

    ##################################################
    # Second part of test: Drag and drop ExecComp from the Library onto the
    # model (IComponent) slot of a MetaModel.
    ##################################################
    slot_drop(browser, execcomp, comp, True, 'Component')
    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
    comp = browser.find_element(By.ID, slot_id % (meta_name, 'model'))

    #check for class change
    eq(True, ("filled" in comp.get_attribute('class')),
        "Component did not drop into Component slot")

    #for the future:
    """
    # get the objects we need for the test
    # setup a data structure explaining which things can be dropped where
    # element, dropOnCaseIter, dropOnCaseRec, dropOnComp
    dropdata = [('CSVCaseIterator', True, False, False),\
                 ('CSVCaseRecorder', False, True, False),\
                 ('ExecComp', False, False, True),\
                 ('Assembly', False, False, True)]

    drop_elements = [(workspace_page.find_library_button(ele[0]), ele[1], ele[2], ele[3]) for ele in dropdata]

    #now loop through each dropable item, and see what happens when it lands on the target
    for ele in drop_elements:
        #drop on caseiter
        slot_drop(browser, ele[0].element, caseiter, ele[1], 'CaseIterator')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on caserec
        slot_drop(browser, ele[0].element, caserec, ele[2], 'CaseRecorder')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on comp
        slot_drop(browser, ele[0].element, comp, ele[3], 'Component')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR

        editor, metamodel, caseiter, caserec, comp = slot_reset(workspace_page, editor, metamodel, True)
    """

    closeout(project_dict, workspace_page)