summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features/sorting_helpers.rb
blob: a6428bf85731b3d0d4f527b75b977671172cb134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

# These helpers allow you to manipulate with sorting features.
#
# Usage:
#   describe "..." do
#     include Spec::Support::Helpers::Features::SortingHelpers
#     ...
#
#     sort_by("Last updated")
#
module Spec
  module Support
    module Helpers
      module Features
        module SortingHelpers
          def sort_by(value)
            find('.filter-dropdown-container .dropdown').click

            page.within('ul.dropdown-menu.dropdown-menu-right li') do
              click_link(value)
            end
          end
        end
      end
    end
  end
end