'Test that scheduling flows works.'

def testFlowManagement(self):

    self.Open('/')
    self.Type('client_query', 'C.0000000000000001')
    self.Click('client_query_submit')
    self.WaitUntilEqual(u'C.0000000000000001', self.GetText, 'css=span[type=subject]')
    self.Click("css=td:contains('0001')")
    self.WaitUntil(self.IsTextPresent, 'HostC.0000000000000001')
    self.Click("css=a[grrtarget='client.launchFlows']")
    self.Click('css=#_Processes')
    self.Click(('link=' + flows_processes.ListProcesses.__name__))
    self.WaitUntil(self.IsTextPresent, 'C.0000000000000001')
    self.WaitUntil(self.IsTextPresent, 'List    running    processes    on    a    system.')
    self.Click('css=button.Launch')
    self.WaitUntil(self.IsTextPresent, 'Launched    Flow    ListProcesses')
    self.Click('css=#_Browser')
    self.WaitUntil(self.IsTextPresent, flows_webhistory.FirefoxHistory.__name__)
    self.Click('css=#_Filesystem')
    self.WaitUntil(self.IsTextPresent, flows_filesystem.UpdateSparseImageChunks.__name__)
    self.Click(('link=' + flows_transfer.GetFile.__name__))
    self.Select("css=.form-group:has(>    label:contains('Pathtype'))    select", 'OS')
    self.Type("css=.form-group:has(>    label:contains('Path'))    input", u'/dev/c/msn[1].exe')
    self.Click('css=button.Launch')
    self.WaitUntil(self.IsTextPresent, 'Launched    Flow    GetFile')
    flow.GRRFlow.StartFlow(client_id='aff4:/C.0000000000000001', flow_name=gui_test_lib.RecursiveTestFlow.__name__, token=self.token)
    self.Click("css=a[grrtarget='client.flows']")
    self.WaitUntilEqual(gui_test_lib.RecursiveTestFlow.__name__, self.GetText, 'css=grr-client-flows-list    tr:visible:nth(1)    td:nth(2)')
    self.WaitUntilEqual(flows_transfer.GetFile.__name__, self.GetText, 'css=grr-client-flows-list    tr:visible:nth(2)    td:nth(2)')
    self.Click('css=grr-client-flows-list    tr:visible:nth(1)    .tree_closed')
    self.WaitUntilEqual(gui_test_lib.RecursiveTestFlow.__name__, self.GetText, 'css=grr-client-flows-list    tr:visible:nth(2)    td:nth(2)')
    self.Click('css=td:contains(GetFile)')
    self.Click('css=li[heading=Requests]')
    self.WaitUntil(self.IsElementPresent, 'css=td:contains(1)')
    self.WaitUntil(self.IsElementPresent, 'css=.tab-content    td.proto_value:contains(StatFile)')
