'Wait for all of the items in the task list to be set to the correct state.'

def wait_for_tasks(self, completed=False, fail_on=None):

    if fail_on:
        completed = True
    (state, desc_template) = self._task_properties(completed)
    for (desc, css_class) in self.task_classes.items():
        desc_text = desc_template.format(desc)
        EmptyPromise((lambda : self.q(css='.{}.{}'.format(css_class, state)).present), desc_text, timeout=30)
        if (fail_on == desc):
            EmptyPromise((lambda : self.q(css='.{}.is-complete.has-error'.format(css_class)).present), '{}    checkpoint    marked    as    failed'.format(desc), timeout=30)
            (state, desc_template) = self._task_properties(False)
