def _test_view_stl(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add a STL geometry file
    file_name = 'box.stl'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                               'files/box.stl')
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the STL file
    geom_page = workspace_page.view_geometry(file_name)

    # if we have a canvas... (some test platforms don't support canvas)
    if geom_page.has_canvas():
        time.sleep(5)

        geom_page.expand_faces()
        faces = geom_page.get_face_names()
        eq(faces, ['box_solid1'])

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #2
0
def _test_view_image(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add an image file
    file_name = 'Engine_Example_Process_Diagram.png'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/' + file_name)
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the image file
    images_page = workspace_page.view_image(file_name)

    time.sleep(2)

    # the image will appear twice.. in the main view and as a thumbnail
    image_names = images_page.get_image_names()
    eq(len(image_names), 2)
    eq(image_names[0].endswith(file_name), True)
    eq(image_names[1].endswith(file_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #3
0
def _test_hidden_files(browser):
    project_dict, workspace_page = startup(browser)

    # there are no visible files in a new project
    file_names = workspace_page.get_files()
    eq(len(file_names), 0)

    # show hidden files using file tree pane context menu
    workspace_page.toggle_files()

    # confirm that formerly hidden files are now visible
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    assert '_settings.cfg' in file_names

    # hide files again using file tree pane context menu
    workspace_page.toggle_files()

    # there should be no visible files
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(len(file_names), 0)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #4
0
def _test_addfiles(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Get path to  paraboloid file.
    paraboloidPath = pkg_resources.resource_filename(
        'openmdao.examples.simple', 'paraboloid.py')

    # Get path to optimization_unconstrained file.
    optPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                              'optimization_unconstrained.py')

    # Add the files
    # would like to test adding multiple files but Selenium doesn't support it
    #workspace_page.add_files(paraboloidPath, optPath)
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    expected_file_names = ['optimization_unconstrained.py', 'paraboloid.py']
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_hidden_files(browser):
    project_dict, workspace_page = startup(browser)

    # there are no visible files in a new project
    file_names = workspace_page.get_files()
    eq(len(file_names), 0)

    # show hidden files using file tree pane context menu
    workspace_page.toggle_files()

    # confirm that formerly hidden files are now visible
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    assert '_settings.cfg' in file_names

    # hide files again using file tree pane context menu
    workspace_page.toggle_files()

    # there should be no visible files
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(len(file_names), 0)

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_addfiles(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Get path to  paraboloid file.
    paraboloidPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                                     'paraboloid.py')

    # Get path to optimization_unconstrained file.
    optPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                              'optimization_unconstrained.py')

    # Add the files
    # would like to test adding multiple files but Selenium doesn't support it
    #workspace_page.add_files(paraboloidPath, optPath)
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    expected_file_names = ['optimization_unconstrained.py', 'paraboloid.py']
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)
Example #7
0
def _test_view_image(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add an image file
    file1_name = 'Engine_Example_Process_Diagram.png'
    file1_path = pkg_resources.resource_filename(
        'openmdao.gui.test.functional', 'files/' + file1_name)
    workspace_page.add_file(file1_path)
    time.sleep(1)

    # view the image file
    images_page = workspace_page.view_image(file1_name)
    time.sleep(2)

    # check that the image is displayed
    image = images_page.get_image()
    eq(image.endswith(file1_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # add an image file to a folder
    workspace_page.new_folder('folder')
    time.sleep(1)
    file2_name = 'bmp_24.bmp'
    file2_path = pkg_resources.resource_filename(
        'openmdao.gui.test.functional', 'files/' + file2_name)
    workspace_page.add_file_to_folder('folder', file2_path)
    time.sleep(1)

    # view the image file
    workspace_page.expand_folder('folder')
    time.sleep(1)
    images_page = workspace_page.view_image('folder/' + file2_name)
    time.sleep(2)

    # check that the image is displayed
    image = images_page.get_image()
    eq(image.endswith(file2_name), True)

    # check that both images appear in the thumbnails
    thumbnails = images_page.get_thumbnails()
    thumbnails.sort()
    eq(len(thumbnails), 2)
    eq(thumbnails[0].endswith(file1_name), True)
    eq(thumbnails[1].endswith(file2_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_view_image(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add an image file
    file1_name = 'Engine_Example_Process_Diagram.png'
    file1_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                 'files/' + file1_name)
    workspace_page.add_file(file1_path)
    time.sleep(1)

    # view the image file
    images_page = workspace_page.view_image(file1_name)
    time.sleep(2)

    # check that the image is displayed
    image = images_page.get_image()
    eq(image.endswith(file1_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # add an image file to a folder
    workspace_page.new_folder('folder')
    time.sleep(1)
    file2_name = 'bmp_24.bmp'
    file2_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                 'files/' + file2_name)
    workspace_page.add_file_to_folder('folder', file2_path)
    time.sleep(1)

    # view the image file
    workspace_page.expand_folder('folder')
    time.sleep(1)
    images_page = workspace_page.view_image('folder/'+file2_name)
    time.sleep(2)

    # check that the image is displayed
    image = images_page.get_image()
    eq(image.endswith(file2_name), True)

    # check that both images appear in the thumbnails
    thumbnails = images_page.get_thumbnails()
    thumbnails.sort()
    eq(len(thumbnails), 2)
    eq(thumbnails[0].endswith(file1_name), True)
    eq(thumbnails[1].endswith(file2_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #9
0
def _test_view_file(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add an image file
    file_name = 'Engine_Example_Process_Diagram.png'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/' + file_name)
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the image file in browser
    new_page = workspace_page.view_file(file_name)

    time.sleep(2)

    # the new page should have an img tag with the selected file name
    images = new_page.browser.find_elements_by_css_selector('img')
    eq(len(images), 1)
    eq(images[0].get_attribute('src').strip().endswith(file_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # add a pdf file
    file_name = 'sample.pdf'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/' + file_name)
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the pdf file in browser
    new_page = workspace_page.view_file(file_name)

    time.sleep(2)

    # the new page should have an embed tag with the selected file name
    embeds = new_page.browser.find_elements_by_css_selector('embed')
    eq(len(embeds), 1)
    eq(embeds[0].get_attribute('src').strip().endswith(file_name), True)
    eq(embeds[0].get_attribute('type'), 'application/pdf')

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_view_file(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add an image file
    file_name = 'Engine_Example_Process_Diagram.png'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/' + file_name)
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the image file in browser
    new_page = workspace_page.view_file(file_name)

    time.sleep(2)

    # the new page should have an img tag with the selected file name
    images = new_page.browser.find_elements_by_css_selector('img')
    eq(len(images), 1)
    eq(images[0].get_attribute('src').strip().endswith(file_name), True)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # add a pdf file
    file_name = 'sample.pdf'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/' + file_name)
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the pdf file in browser
    new_page = workspace_page.view_file(file_name)

    time.sleep(2)

    # the new page should have an embed tag with the selected file name
    embeds = new_page.browser.find_elements_by_css_selector('embed')
    eq(len(embeds), 1)
    eq(embeds[0].get_attribute('src').strip().endswith(file_name), True)
    eq(embeds[0].get_attribute('type'), 'application/pdf')

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #11
0
def _test_remove_folder(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Test deleting a folder, but cancel the confirmation
    workspace_page.new_folder('test_folder')
    time.sleep(1.0)

    paraboloidPath = pkg_resources.resource_filename(
        'openmdao.examples.simple', 'paraboloid.py')
    workspace_page.add_file_to_folder('test_folder', paraboloidPath)
    time.sleep(2.0)
    workspace_page.expand_folder('test_folder')
    time.sleep(1.0)

    workspace_page.delete_files(['test_folder'], False)

    expected_file_names = ['paraboloid.py']

    # Check to make sure the folder was NOT deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # toggle hidden files on and off to reset selected/highlighted files
    workspace_page.toggle_files()
    workspace_page.toggle_files()

    # Test deleting a folder
    time.sleep(1.0)
    workspace_page.delete_files(['test_folder'])

    expected_file_names = []

    # Check to make sure the folder was deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_remove_folder(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Test deleting a folder, but cancel the confirmation
    workspace_page.new_folder('test_folder')
    time.sleep(1.0)

    paraboloidPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                                     'paraboloid.py')
    workspace_page.add_file_to_folder('test_folder', paraboloidPath)
    time.sleep(2.0)
    workspace_page.expand_folder('test_folder')
    time.sleep(1.0)

    workspace_page.delete_files(['test_folder'], False)

    expected_file_names = ['paraboloid.py']

    # Check to make sure the folder was NOT deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # toggle hidden files on and off to reset selected/highlighted files
    workspace_page.toggle_files()
    workspace_page.toggle_files()

    # Test deleting a folder
    time.sleep(1.0)
    workspace_page.delete_files(['test_folder'])

    expected_file_names = []

    # Check to make sure the folder was deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)
Example #13
0
def _test_view_csm(browser):
    try:
        from pygem_diamond import gem
    except ImportError:
        raise SkipTest('pygem_diamond is not installed.')

    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add a CSM geometry file
    file_name = 'box.csm'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/box.csm')
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the CSM file
    geom_page = workspace_page.view_geometry(file_name)

    # if we have a canvas... (some test platforms don't support canvas)
    if geom_page.has_canvas():
        time.sleep(5)

        geom_page.expand_edges()
        edges = geom_page.get_edge_names()
        eq(edges, [
            'Body 1 Edge 1', 'Body 1 Edge 2', 'Body 1 Edge 3', 'Body 1 Edge 4',
            'Body 1 Edge 5', 'Body 1 Edge 6', 'Body 1 Edge 7', 'Body 1 Edge 8',
            'Body 1 Edge 9', 'Body 1 Edge 10', 'Body 1 Edge 11',
            'Body 1 Edge 12'
        ])

        geom_page.expand_faces()
        faces = geom_page.get_face_names()
        eq(faces, [
            'Body 1 Face 1', 'Body 1 Face 2', 'Body 1 Face 3', 'Body 1 Face 4',
            'Body 1 Face 5', 'Body 1 Face 6'
        ])

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #14
0
def _test_rename_file(browser):
    # Rename a file in the project.
    project_dict, workspace_page = startup(browser)

    # Add paraboloid.py
    paraboloidPath = pkg_resources.resource_filename(
        'openmdao.examples.simple', 'paraboloid.py')
    workspace_page.add_file(paraboloidPath)
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(file_names, ['paraboloid.py'])

    workspace_page.rename_file('paraboloid.py', 'xyzzy.py')
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(file_names, ['xyzzy.py'])

    # Clean up.
    #closeout(projects_page, project_info_page, project_dict, workspace_page)
    closeout(project_dict, workspace_page)
def _test_rename_file(browser):
    # Rename a file in the project.
    project_dict, workspace_page = startup(browser)

    # Add paraboloid.py
    paraboloidPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                                     'paraboloid.py')
    workspace_page.add_file(paraboloidPath)
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(file_names, ['paraboloid.py'])

    workspace_page.rename_file('paraboloid.py', 'xyzzy.py')
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    eq(file_names, ['xyzzy.py'])

    # Clean up.
    #closeout(projects_page, project_info_page, project_dict, workspace_page)
    closeout(project_dict, workspace_page)
Example #16
0
def _test_view_csm(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    # add a CSM geometry file
    file_name = 'box.csm'
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                               'files/box.csm')
    workspace_page.add_file(file_path)

    time.sleep(2)

    # view the CSM file
    geom_page = workspace_page.view_geometry(file_name)

    # if we have a canvas... (some test platforms don't support canvas)
    if geom_page.has_canvas():
        time.sleep(5)

        geom_page.expand_edges()
        edges = geom_page.get_edge_names()
        eq(edges, ['Body 1 Edge 1',  'Body 1 Edge 2',  'Body 1 Edge 3',
                   'Body 1 Edge 4',  'Body 1 Edge 5',  'Body 1 Edge 6',
                   'Body 1 Edge 7',  'Body 1 Edge 8',  'Body 1 Edge 9',
                   'Body 1 Edge 10', 'Body 1 Edge 11', 'Body 1 Edge 12'])

        geom_page.expand_faces()
        faces = geom_page.get_face_names()
        eq(faces, ['Body 1 Face 1',  'Body 1 Face 2',  'Body 1 Face 3',
                   'Body 1 Face 4',  'Body 1 Face 5',  'Body 1 Face 6'])

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
Example #17
0
def _test_remove_files(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Add some files
    paraboloidPath = pkg_resources.resource_filename(
        'openmdao.examples.simple', 'paraboloid.py')
    optPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                              'optimization_unconstrained.py')
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    expected_file_names = ['optimization_unconstrained.py', 'paraboloid.py']

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # test delete file using context menu, but cancel the confirmation
    workspace_page.delete_file('paraboloid.py', False)

    # Check to make sure the file was NOT deleted
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # test delete file using context menu
    workspace_page.delete_file('paraboloid.py')

    expected_file_names = [
        'optimization_unconstrained.py',
    ]

    # Check to make sure the file was deleted
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # add more files
    file_path_one = pkg_resources.resource_filename(
        'openmdao.gui.test.functional', 'files/basic_model.py')
    file_path_two = pkg_resources.resource_filename(
        'openmdao.examples.enginedesign', 'vehicle_singlesim.py')
    workspace_page.add_file(file_path_one)
    workspace_page.add_file(file_path_two)

    expected_file_names = [
        'optimization_unconstrained.py', 'basic_model.py',
        'vehicle_singlesim.py'
    ]

    # Test deleting multiple files using the delete files pick
    #   on the Files menu, but cancel the confirmation
    workspace_page.delete_files(
        ['vehicle_singlesim.py', 'optimization_unconstrained.py'], False)

    # toggle hidden files on and off to reset selected/highlighted files
    workspace_page.toggle_files()
    workspace_page.toggle_files()

    # Check to make sure the files were NOT deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Test deleting multiple files using the delete files pick
    #   on the Files menu
    workspace_page.delete_files(
        ['vehicle_singlesim.py', 'optimization_unconstrained.py'])

    expected_file_names = ['basic_model.py']

    # Check to make sure the files were deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Test deleting a file in a folder
    workspace_page.new_folder('test_folder')
    time.sleep(1.0)
    workspace_page.add_file_to_folder('test_folder', paraboloidPath)
    time.sleep(2.0)
    workspace_page.expand_folder('test_folder')
    time.sleep(1.0)
    workspace_page.delete_files([
        'test_folder/paraboloid.py',
    ])

    expected_file_names = ['basic_model.py']

    # Check to make sure the file was deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)
Example #18
0
def _test_view_geometry(browser):
    project_dict, workspace_page = startup(browser)
    workspace_window = browser.current_window_handle

    #drop 'GeomComponent' onto the grid
    geom_comp_name = workspace_page.put_element_on_grid('GeomComponent')

    #find it on the page
    geom_comp = workspace_page.get_dataflow_figure(geom_comp_name)

    #open the 'edit' dialog on GeomComponent
    geom_comp_editor = geom_comp.editor_page(False)
    geom_comp_editor.show_slots()

    # Plug BoxParametricGeometry into parametric_geometry
    slot = find_slot_figure(workspace_page, 'parametric_geometry', prefix=geom_comp_name)
    workspace_page.fill_slot_from_library(slot, 'BoxParametricGeometry')

    # Open the geom window
    geom_comp_editor('outputs_tab').click()
    outputs = geom_comp_editor.get_outputs()
    outputs.rows[0].cells[2].click()

    time.sleep(2)  # wait to make sure it is displayed

    # Should be two windows now
    eq(len(browser.window_handles), 2)

    # switch to the geom window
    geom_window = browser.window_handles[-1]
    browser.switch_to_window(geom_window)

    # FIXME: there are still problems with diffing the PNG files.  Not sure
    # if there are differences due to platform or what.  Also on windows
    # document.getElementById("statusline") returns null (could be just a timing thing)
    #  For now, just commenting all of this out until someone has time to
    #  fix it and verify it works on all 3 platforms

    # Compare it to what we expect to get
    # file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
    #                                             'files/box-geom-screenshot.png')

    # hide the framerate status line
    #browser.execute_script( 'document.getElementById("statusline").style.display = "none"')
    #browser.save_screenshot( "geom.png")
    #assert filecmp.cmp( "geom.png", file_path)

    #try:
    #    os.remove("geom.png")
    #except IOError:
    #    pass

    # give it a bit
    time.sleep(3)

    geom_page = GeometryPage.verify(browser, workspace_page.port)

    # if we have a canvas... (some test platforms don't support canvas)
    if geom_page.has_canvas():
        # give it a bit more
        time.sleep(5)

        geom_page.expand_edges()
        edges = geom_page.get_edge_names()
        eq(edges, ['Edge 1', 'Edge 2', 'Edge 3', 'Edge 4', 'Edge 5', 'Edge 6'])

        edges = geom_page.get_edge('Edges')
        edge1 = geom_page.get_edge('Edge 1')
        edge2 = geom_page.get_edge('Edge 2')

        eq([edges.viz, edges.grd, edges.ori], [True, False, False])
        eq([edge1.viz, edge1.grd, edge1.ori], [True, False, False])
        eq([edge2.viz, edge2.grd, edge2.ori], [True, False, False])

        # toggle visibility for an edge
        edge1.viz = False

        # check for expected new edges state
        eq([edges.viz, edges.grd, edges.ori], [False, False, False])
        eq([edge1.viz, edge1.grd, edge1.ori], [False, False, False])
        eq([edge2.viz, edge2.grd, edge2.ori], [True, False, False])

        # toggle visibility for all edges
        edges.viz = True

        # check for expected new edges state
        eq([edges.viz, edges.grd, edges.ori], [True, False, False])
        eq([edge1.viz, edge1.grd, edge1.ori], [True, False, False])
        eq([edge2.viz, edge2.grd, edge2.ori], [True, False, False])

        # check initial state of faces tree
        geom_page.expand_faces()
        faces = geom_page.get_face_names()
        eq(faces, ['Face 1', 'Face 2', 'Face 3', 'Face 4', 'Face 5', 'Face 6'])

        faces = geom_page.get_face('Faces')
        face3 = geom_page.get_face('Face 3')
        face5 = geom_page.get_face('Face 5')

        eq([faces.viz, faces.grd, faces.trn], [True, False, False])
        eq([face3.viz, face3.grd, face3.trn], [True, False, False])
        eq([face5.viz, face5.grd, face5.trn], [True, False, False])

        # toggle transparency for a face
        face3.trn = True

        # check for expected new faces state
        eq([faces.viz, faces.grd, faces.trn], [True, False, False])
        eq([face3.viz, face3.grd, face3.trn], [True, False, True])
        eq([face5.viz, face5.grd, face5.trn], [True, False, False])

        # toggle grid for all faces
        faces.grd = True

        # check for expected new faces state
        eq([faces.viz, faces.grd, faces.trn], [True, True, False])
        eq([face3.viz, face3.grd, face3.trn], [True, True, True])
        eq([face5.viz, face5.grd, face5.trn], [True, True, False])

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
def _test_remove_files(browser):
    # Adds multiple files to the project.
    project_dict, workspace_page = startup(browser)

    # Add some files
    paraboloidPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                                     'paraboloid.py')
    optPath = pkg_resources.resource_filename('openmdao.examples.simple',
                                              'optimization_unconstrained.py')
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    expected_file_names = ['optimization_unconstrained.py', 'paraboloid.py']

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # test delete file using context menu, but cancel the confirmation
    workspace_page.delete_file('paraboloid.py', False)

    # Check to make sure the file was NOT deleted
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # test delete file using context menu
    workspace_page.delete_file('paraboloid.py')

    expected_file_names = ['optimization_unconstrained.py', ]

    # Check to make sure the file was deleted
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # add more files
    file_path_one = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                    'files/basic_model.py')
    file_path_two = pkg_resources.resource_filename('openmdao.examples.enginedesign',
                                                    'vehicle_singlesim.py')
    workspace_page.add_file(file_path_one)
    workspace_page.add_file(file_path_two)

    expected_file_names = ['optimization_unconstrained.py', 'basic_model.py', 'vehicle_singlesim.py']

    # Test deleting multiple files using the delete files pick
    #   on the Files menu, but cancel the confirmation
    workspace_page.delete_files(['vehicle_singlesim.py', 'optimization_unconstrained.py'], False)

    # toggle hidden files on and off to reset selected/highlighted files
    workspace_page.toggle_files()
    workspace_page.toggle_files()

    # Check to make sure the files were NOT deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Test deleting multiple files using the delete files pick
    #   on the Files menu
    workspace_page.delete_files(['vehicle_singlesim.py', 'optimization_unconstrained.py'])

    expected_file_names = ['basic_model.py']

    # Check to make sure the files were deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Test deleting a file in a folder
    workspace_page.new_folder('test_folder')
    time.sleep(1.0)
    workspace_page.add_file_to_folder('test_folder', paraboloidPath)
    time.sleep(2.0)
    workspace_page.expand_folder('test_folder')
    time.sleep(1.0)
    workspace_page.delete_files(['test_folder/paraboloid.py', ])

    expected_file_names = ['basic_model.py']

    # Check to make sure the file was deleted
    time.sleep(1.5)
    file_names = workspace_page.get_files()
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'"
            % (expected_file_names, file_names))

    # Clean up.
    closeout(project_dict, workspace_page)