       beforeEach -> disposeDialog()
 
       it "does nothig", ->
-        expect(databasesList.column("database.name")).toContain("first_database")
-        expect(databasesList.column("database.name")).toContain("second_database")
-        expect(databasesList.column("database.name")).toContain("third_database")
+        shouldShowAllDatabases()
 
     describe "when the dialog was confirmed", ->
       beforeEach -> confirmDialog()

  describe "filtering by database name", ->
    it "displays all databases when the filter is not provided", ->
      input("value").enter("")
      expect(databasesList.column("database.name")).toContain("first_database")
      expect(databasesList.column("database.name")).toContain("second_database")
      expect(databasesList.column("database.name")).toContain("third_database")

    it "filters by database name", ->
      input("value").enter("first")
      expect(databasesList.column("database.name")).toContain("first_database")

      input("value").enter("second")
      expect(databasesList.column("database.name")).toContain("second_database")

      input("value").enter("not existing database")
      expect(databasesList.count()).toBe(0)

describe "databases list page", ->
  databasesList = null

  shouldShowDatabase = (name) ->
    expect(databasesList.column("database.name")).toContain(name)

  shouldShowAllDatabases = ->
    shouldShowDatabase("first_database")
    shouldShowDatabase("second_database")
    shouldShowDatabase("third_database")

  beforeEach ->
    browser().navigateTo("/e2e/load_fixtures")
