summaryrefslogtreecommitdiff
path: root/qa/qa/page/group/show.rb
blob: f23294145ddf2d80be83ee91c73ed87111b673d0 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module QA
  module Page
    module Group
      class Show < Page::Base
        ##
        # TODO, define all selectors required by this page object
        #
        # See gitlab-org/gitlab-qa#154
        #
        view 'app/views/groups/show.html.haml'

        def go_to_subgroup(name)
          click_link name
        end

        def filter_by_name(name)
          fill_in 'Filter by name...', with: name
        end

        def has_subgroup?(name)
          filter_by_name(name)

          page.has_link?(name)
        end

        def go_to_new_subgroup
          within '.new-project-subgroup' do
            # May need to click again because it is possible to click the button quicker than the JS is bound
            wait(reload: false) do
              find('.dropdown-toggle').click

              page.has_css?("li[data-value='new-subgroup']")
            end
            find("li[data-value='new-subgroup']").click
          end

          find("input[data-action='new-subgroup']").click
        end

        def go_to_new_project
          within '.new-project-subgroup' do
            # May need to click again because it is possible to click the button quicker than the JS is bound
            wait(reload: false) do
              find('.dropdown-toggle').click

              page.has_css?("li[data-value='new-project']")
            end
            find("li[data-value='new-project']").click
          end

          find("input[data-action='new-project']").click
        end
      end
    end
  end
end