blob: f72ca4f068e6a7789d2f95240969bc16cdd8bfe9 (
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 Component
module ConfirmModal
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/assets/javascripts/lib/utils/confirm_via_gl_modal/confirm_modal.vue' do
element :confirm_ok_button
element :confirmation_modal
end
base.view 'app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.vue' do
element :confirm_danger_modal_button
element :confirm_danger_field
end
end
def fill_confirmation_text(text)
fill_element(:confirm_danger_field, text)
end
def wait_for_confirm_button_enabled
wait_until(reload: false) do
!find_element(:confirm_danger_modal_button).disabled?
end
end
def confirm_transfer
wait_for_confirm_button_enabled
click_element(:confirm_danger_modal_button)
end
def click_confirmation_ok_button
click_element(:confirm_ok_button)
end
# Click the confirmation button if the confirmation modal is present
# Can be used when the modal may not always appear in a test. For example, if the modal is behind a feature flag
#
# @return [void]
def click_confirmation_ok_button_if_present
# In the case of changing access levels[1], the modal appears while there's a request in process, so we need
# to skip the loading check otherwise it will time out.
#
# [1]: https://gitlab.com/gitlab-org/gitlab/-/blob/4a99af809b86047ce3c8985e6582748bbd23fc84/qa/qa/page/component/members/members_table.rb#L54
return unless has_element?(:confirmation_modal, skip_finished_loading_check: true)
click_element(:confirm_ok_button, skip_finished_loading_check: true)
end
end
end
end
end
|