Make `all_elements` more reliable

Given that it is not a good practice to use Capybara's all and first methods, maybe it would be better to remove these methods from our QA framework itself, so that we don't accidentally use them leading to flaky tests.

Recently I burnt my fingers with using all_elements - which I fixed later - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23977

/cc @gl-quality


Update: Instead of removing all and first, we could use the parameters that make them more reliable, e.g., count/minimum/maximum (see https://gitlab.com/gitlab-org/quality/team-tasks/issues/86#note_173032333)

E.g.: https://gitlab.com/gitlab-org/gitlab/blob/master/qa/qa/page/base.rb#L209

      def within_element_by_index(name, index)
        page.within all_elements(name, minimum: index + 1)[index] do
          yield
        end
      end

This could be improved further with an optional count parameter (code is untested):

      def within_element_by_index(name, index, count: nil)
        page.within all_elements(name, minimum: index + 1, count: count)[index] do
          yield
        end
      end

So if we know exactly how many elements there should be in total, we can specify the count and it will wait until they all appear.

Otherwise, we know what index we expect, which means we know the minimum number of elements that should appear, so it will wait until at least that many appear. In that case it's still possible that the expected element will appear later (after the default 10 second max wait), but if that happens we can make it wait longer.

Edited by Mark Lapierre