Commit 79fd94be authored by Justin Ho Tuan Duong's avatar Justin Ho Tuan Duong Committed by Dan Davison

Fix all feature specs around services

To use new default where services are activated by default
parent 7d6623d4
......@@ -12,7 +12,7 @@
.form-group.row
= form.label :active, "Active", class: "col-form-label col-sm-2"
.col-sm-10
= form.check_box :active, disabled: disable_fields_service?(@service), data: { qa_selector: 'active_checkbox' }
= form.check_box :active, checked: @service.active || @service.new_record?, disabled: disable_fields_service?(@service)
- if @service.configurable_events.present?
.form-group.row
......
---
title: Activate new project integrations by default
merge_request: 23009
author:
type: changed
......@@ -7,10 +7,6 @@ module QA
module Settings
module Services
class Jenkins < QA::Page::Base
view 'app/views/shared/_service_settings.html.haml' do
element :active_checkbox
end
view 'app/views/shared/_field.html.haml' do
element :jenkins_url_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
element :project_name_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
......@@ -23,7 +19,6 @@ module QA
end
def setup_service_with(jenkins_url:, project_name:)
click_active_checkbox
set_jenkins_url(jenkins_url)
set_project_name(project_name)
set_username('admin')
......@@ -33,10 +28,6 @@ module QA
private
def click_active_checkbox
click_element :active_checkbox
end
def set_jenkins_url(jenkins_url)
fill_element(:jenkins_url_field, jenkins_url)
end
......
......@@ -8,16 +8,15 @@ describe 'User activates issue tracker', :js do
let(:url) { 'http://tracker.example.com' }
def fill_short_form(active = true)
check 'Active' if active
def fill_short_form(disabled: false)
uncheck 'Active' if disabled
fill_in 'service_project_url', with: url
fill_in 'service_issues_url', with: "#{url}/:id"
end
def fill_full_form(active = true)
fill_short_form(active)
check 'Active' if active
def fill_full_form(disabled: false)
fill_short_form(disabled: disabled)
fill_in 'service_new_issue_url', with: url
end
......@@ -86,14 +85,14 @@ describe 'User activates issue tracker', :js do
end
end
describe 'user sets the service but keeps it disabled' do
describe 'user disables the service' do
before do
click_link(tracker)
if skip_new_issue_url
fill_short_form(false)
fill_short_form(disabled: true)
else
fill_full_form(false)
fill_full_form(disabled: true)
end
click_button('Save changes')
......
......@@ -9,8 +9,8 @@ describe 'User activates Jira', :js do
let(:url) { 'http://jira.example.com' }
let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' }
def fill_form(active = true)
check 'Active' if active
def fill_form(disabled: false)
uncheck 'Active' if disabled
fill_in 'service_url', with: url
fill_in 'service_username', with: 'username'
......@@ -83,10 +83,10 @@ describe 'User activates Jira', :js do
end
end
describe 'user sets Jira Service but keeps it disabled' do
describe 'user disables the Jira Service' do
before do
click_link('Jira')
fill_form(false)
fill_form(disabled: true)
click_button('Save changes')
end
......
......@@ -8,8 +8,8 @@ describe 'User activates issue tracker', :js do
let(:url) { 'http://tracker.example.com' }
def fill_form(active = true)
check 'Active' if active
def fill_form(disabled: false)
uncheck 'Active' if disabled
fill_in 'service_project_url', with: url
fill_in 'service_issues_url', with: "#{url}/:id"
......@@ -67,10 +67,10 @@ describe 'User activates issue tracker', :js do
end
end
describe 'user sets the service but keeps it disabled' do
describe 'user disables the service' do
before do
click_link(tracker)
fill_form(false)
fill_form(disabled: true)
click_button('Save changes')
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment