summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/issue/index.rb
blob: 0b47bec2cf1a63e1a261ea46cebd719457603f0f (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# frozen_string_literal: true

module QA
  module Page
    module Project
      module Issue
        class Index < Page::Base
          view 'app/assets/javascripts/issues_list/components/issuable.vue' do
            element :issue_container
            element :issue_link
          end

          view 'app/assets/javascripts/vue_shared/components/issue/issue_assignees.vue' do
            element :assignee_link
            element :avatar_counter_content
          end

          view 'app/views/projects/issues/export_csv/_button.html.haml' do
            element :export_as_csv_button
          end

          view 'app/views/projects/issues/export_csv/_modal.html.haml' do
            element :export_issues_button
            element :export_issues_modal
          end

          view 'app/views/projects/issues/import_csv/_button.html.haml' do
            element :import_issues_button
            element :import_from_jira_link
          end

          view 'app/views/shared/issuable/_nav.html.haml' do
            element :closed_issues_link
          end

          def avatar_counter
            find_element(:avatar_counter_content)
          end

          def click_issue_link(title)
            click_link(title)
          end

          def click_closed_issues_link
            click_element :closed_issues_link
          end

          def click_export_as_csv_button
            click_element(:export_as_csv_button)
          end

          def click_export_issues_button
            click_element(:export_issues_button)
          end

          def click_import_from_jira_link
            click_element(:import_from_jira_link)
          end

          def click_import_issues_dropdown
            # When there are no issues, the image that loads causes the buttons to jump
            has_loaded_all_images?
            click_element(:import_issues_button)
          end

          def export_issues_modal
            find_element(:export_issues_modal)
          end

          def go_to_jira_import_form
            click_import_issues_dropdown
            click_import_from_jira_link
          end

          def has_assignee_link_count?(count)
            all_elements(:assignee_link, count: count)
          end

          def has_issue?(issue)
            has_element? :issue_container, issue_title: issue.title
          end
        end
      end
    end
  end
end

QA::Page::Project::Issue::Index.prepend_if_ee('QA::EE::Page::Project::Issue::Index')