summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features/top_nav_spec_helpers.rb
blob: de495eceabcaadce06deeaa3cee2dd0dd1d78cae (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
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

# These helpers help you interact within the Source Editor (single-file editor, snippets, etc.).
#
module Spec
  module Support
    module Helpers
      module Features
        module TopNavSpecHelpers
          def open_top_nav
            find('.js-top-nav-dropdown-toggle').click
          end

          def within_top_nav
            within('.js-top-nav-dropdown-menu') do
              yield
            end
          end

          def open_top_nav_projects
            open_top_nav

            within_top_nav do
              click_button('Projects')
            end
          end

          def open_top_nav_groups
            open_top_nav

            within_top_nav do
              click_button('Groups')
            end
          end
        end
      end
    end
  end
end