def revert_project(self): """ Revert current project. """ self('project_menu').click() self('revert_button').click() page = ConfirmationPage(self) page.click_ok() return WorkspacePage.verify(self.browser, self.port)
def delete_file(self, filename, confirm=True): """ Delete `filename`. """ self('files_tab').click() element = self.find_file(filename) chain = ActionChains(self.browser) chain.context_click(element).perform() time.sleep(0.5) self('file_delete').click() time.sleep(0.5) page = ConfirmationPage(self) if confirm: page.click_ok() else: page.click_cancel()
def replace(self, name, classname, confirm=True): """ Replace `name` with an instance of `classname`. """ library_item = self.get_library_item(classname) target = self.get_dataflow_figure(name).root chain = ActionChains(self.browser) chain.click_and_hold(library_item) chain.move_to_element_with_offset(target, 125, 30) chain.release(None) chain.perform() dialog = ConfirmationPage(self) if confirm: dialog.click_ok() else: dialog.click_cancel()
def replace_driver(self, assembly_name, driver_type): ''' find 'driver_type' in the library, drag and drop it on to the driver figure of the 'assembly_name' ''' newdriver = self.find_library_button(driver_type) assembly = self.get_dataflow_figure(assembly_name) driver_element = self.get_dataflow_figure('driver') div = driver_element.get_drop_targets()[0] chain = self.drag_element_to(newdriver, div, True) self.check_highlighting(driver_element('content_area').element, True, "Driver's content_area") self.release(chain) # brings up a confirm dialog for replacing the existing driver. dialog = ConfirmationPage(assembly) dialog.click_ok()
def attempt_to_close_workspace(self, expectDialog, confirm): """ Close the workspace page. Returns :class:`ProjectsListPage`. """ self('project_menu').click() self('close_button').click() #if you expect the "close without saving?" dialog if expectDialog: dialog = ConfirmationPage(self) if confirm: #close without saving self.browser.execute_script('openmdao.Util.closeWebSockets();') NotifierPage.wait(self) dialog.click_ok() from project import ProjectsListPage return ProjectsListPage.verify(self.browser, self.port) else: #return to the project, intact. dialog.click_cancel() else: #no unsaved changes from project import ProjectsListPage return ProjectsListPage.verify(self.browser, self.port)
def delete_files(self, file_paths, confirm=True): """ Delete all the files in the list `file_paths` """ # need select all the files given in file_paths self('files_tab').click() for filename in file_paths: element = self.find_file(filename) chain = ActionChains(self.browser) #Mac OSX does not use CONTROL key if sys.platform == 'darwin': chain.key_down(Keys.SHIFT).click(element).key_up(Keys.SHIFT).perform() else: chain.key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform() self('files_tab').click() self('file_menu').click() self('delete_files_button').click() page = ConfirmationPage(self) if confirm: page.click_ok() else: page.click_cancel()
def delete_files(self, file_paths, confirm=True): """ Delete all the files in the list `file_paths` """ # need select all the files given in file_paths self('files_tab').click() for filename in file_paths: element = self.find_file(filename) chain = ActionChains(self.browser) # Mac OSX does not use CONTROL key if sys.platform == 'darwin': chain.key_down(Keys.SHIFT).click(element).key_up(Keys.SHIFT).perform() else: chain.key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform() self('files_tab').click() self('file_menu').click() self('delete_files_button').click() page = ConfirmationPage(self) if confirm: page.click_ok() else: page.click_cancel()