summaryrefslogtreecommitdiff
path: root/qa/qa/page/profile/password.rb
blob: ee042450f8d66682c3488f63b16aee30d5418649 (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
# frozen_string_literal: true

module QA
  module Page
    module Profile
      class Password < Page::Base
        view 'app/views/profiles/passwords/edit.html.haml' do
          element :current_password_field
          element :new_password_field
          element :confirm_password_field
          element :save_password_button
        end

        view 'app/views/profiles/passwords/new.html.haml' do
          element :current_password_field
          element :new_password_field
          element :confirm_password_field
          element :set_new_password_button
        end

        def update_password(new_password, current_password)
          find_element(:current_password_field).set current_password
          find_element(:new_password_field).set new_password
          find_element(:confirm_password_field).set new_password
          click_element(:save_password_button)
        end

        def set_new_password(new_password, current_password)
          fill_element :current_password_field, current_password
          fill_element :new_password_field, new_password
          fill_element :confirm_password_field, new_password
          click_element :set_new_password_button
        end
      end
    end
  end
end