'Given the selector for an ancestor of a secondary menu, return a context
manager that will open and close the menu'

@contextmanager
def secondary_action_menu_open(self, ancestor_selector):

    self.wait_for_ajax()
    self._find_within((ancestor_selector + '    .action-more')).click()
    EmptyPromise((lambda : self.is_element_visible((ancestor_selector + '    .actions-dropdown'))), 'Secondary    action    menu    opened').fulfill()
    (yield)
    if self.is_element_visible((ancestor_selector + '    .actions-dropdown')):
        self._find_within((ancestor_selector + '    .action-more')).click()
        EmptyPromise((lambda : (not self.is_element_visible((ancestor_selector + '    .actions-dropdown')))), 'Secondary    action    menu    closed').fulfill()
