summaryrefslogtreecommitdiff
path: root/qa/qa/page/admin/overview/users/show.rb
blob: be73f3d80bfc123493f5e772dbe435c910f17112 (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
# frozen_string_literal: true

module QA
  module Page
    module Admin
      module Overview
        module Users
          class Show < QA::Page::Base
            view 'app/views/admin/users/_head.html.haml' do
              element :impersonate_user_link
            end

            view 'app/views/admin/users/show.html.haml' do
              element :user_id_content
            end

            view 'app/assets/javascripts/admin/users/components/actions/approve.vue' do
              element :approve_user_button
              element :approve_user_confirm_button
            end

            view 'app/assets/javascripts/admin/users/components/user_actions.vue' do
              element :user_actions_dropdown_toggle
            end

            view 'app/helpers/users_helper.rb' do
              element :confirm_user_button
              element :confirm_user_confirm_button
            end

            def open_user_actions_dropdown(user)
              click_element(:user_actions_dropdown_toggle, username: user.username)
            end

            def click_impersonate_user
              click_element(:impersonate_user_link)
            end

            def user_id
              find_element(:user_id_content).text
            end

            def confirm_user
              click_element :confirm_user_button
              click_element :confirm_user_confirm_button
            end

            def approve_user(user)
              open_user_actions_dropdown(user)
              click_element :approve_user_button
              click_element :approve_user_confirm_button
            end
          end
        end
      end
    end
  end
end