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
|
# frozen_string_literal: true
module QA
module Page
module Project
module Settings
module Services
class Jira < QA::Page::Base
view 'app/assets/javascripts/integrations/edit/components/dynamic_field.vue' do
element :service_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
element :service_username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
element :service_password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
end
view 'app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue' do
element :service_issue_transition_mode_auto, ':data-qa-selector="`service_issue_transition_mode_${issueTransitionOption.value}`"' # rubocop:disable QA/ElementWithPattern
element :service_issue_transition_mode_custom, ':data-qa-selector="`service_issue_transition_mode_${issueTransitionOption.value}`"' # rubocop:disable QA/ElementWithPattern
element :service_jira_issue_transition_id_field
end
view 'app/assets/javascripts/integrations/edit/components/integration_form.vue' do
element :save_changes_button
end
def setup_service_with(url:)
QA::Runtime::Logger.info "Setting up JIRA"
set_jira_server_url(url)
set_username(Runtime::Env.jira_admin_username)
set_password(Runtime::Env.jira_admin_password)
use_custom_transitions
set_transition_ids('11,21,31,41')
click_save_changes_button
wait_until(reload: false) do
has_element?(:save_changes_button, wait: 1) ? !find_element(:save_changes_button).disabled? : true
end
end
private
def set_jira_server_url(url)
fill_element(:service_url_field, url)
end
def set_username(username)
fill_element(:service_username_field, username)
end
def set_password(password)
fill_element(:service_password_field, password)
end
def use_automatic_transitions
click_element :service_issue_transition_mode_auto
end
def use_custom_transitions
click_element :service_issue_transition_mode_custom
end
def set_transition_ids(transition_ids)
fill_element(:service_jira_issue_transition_id_field, transition_ids)
end
def click_save_changes_button
click_element :save_changes_button
end
end
end
end
end
end
end
|