 
         bufferView.filterEditorView.getModel().setText('sample.js:4')
         bufferView.populateList()
-        {filePath} = bufferView.getSelectedItem()
-        expect(atom.project.getDirectories()[0].resolve(filePath)).toBe editor1.getPath()
-
-        spyOn(bufferView, 'moveToLine').andCallThrough()
-        atom.commands.dispatch bufferView.element, 'core:confirm'
+        waitForPathsToDisplay bufferView
+
+        runs ->
+          {filePath} = bufferView.getSelectedItem()
+          expect(atom.project.getDirectories()[0].resolve(filePath)).toBe editor1.getPath()
+
+          spyOn(bufferView, 'moveToLine').andCallThrough()
+          atom.commands.dispatch bufferView.element, 'core:confirm'
 
         waitsFor ->
           bufferView.moveToLine.callCount > 0

    it "highlights an exact match", ->
      bufferView.filterEditorView.getModel().setText('sample.js')
      bufferView.populateList()
      resultView = bufferView.getSelectedItemView()

      primaryMatches = resultView.find('.primary-line .character-match')
      secondaryMatches = resultView.find('.secondary-line .character-match')
      expect(primaryMatches.length).toBe 1
      expect(primaryMatches.last().text()).toBe 'sample.js'
      # Use `toBeGreaterThan` because dir may have some characters in it
      expect(secondaryMatches.length).toBeGreaterThan 0
      expect(secondaryMatches.last().text()).toBe 'sample.js'

    it "highlights a partial match", ->
      bufferView.filterEditorView.getModel().setText('sample')
      bufferView.populateList()
      resultView = bufferView.getSelectedItemView()

      primaryMatches = resultView.find('.primary-line .character-match')
      secondaryMatches = resultView.find('.secondary-line .character-match')
      expect(primaryMatches.length).toBe 1
      expect(primaryMatches.last().text()).toBe 'sample'
      # Use `toBeGreaterThan` because dir may have some characters in it
      expect(secondaryMatches.length).toBeGreaterThan 0
      expect(secondaryMatches.last().text()).toBe 'sample'

    it "highlights multiple matches in the file name", ->
      bufferView.filterEditorView.getModel().setText('samplejs')
      bufferView.populateList()
      resultView = bufferView.getSelectedItemView()

      primaryMatches = resultView.find('.primary-line .character-match')
      secondaryMatches = resultView.find('.secondary-line .character-match')
      expect(primaryMatches.length).toBe 2
      expect(primaryMatches.first().text()).toBe 'sample'
      expect(primaryMatches.last().text()).toBe 'js'
      # Use `toBeGreaterThan` because dir may have some characters in it
      expect(secondaryMatches.length).toBeGreaterThan 1
      expect(secondaryMatches.last().text()).toBe 'js'

    it "highlights matches in the directory and file name", ->
      bufferView.items = [

      pane = atom.workspace.getActivePane()

      dispatchCommand('toggle-buffer-finder')
      waitForPathsToDisplay bufferView

      filePath = null
      runs ->
        {filePath} = bufferView.getSelectedItem()
        atom.commands.dispatch bufferView.filterEditorView.element, 'pane:split-up'

      waitsFor ->
        atom.workspace.getPanes().length is 2
