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 @@ ...@@ -12,7 +12,7 @@
.form-group.row .form-group.row
= form.label :active, "Active", class: "col-form-label col-sm-2" = form.label :active, "Active", class: "col-form-label col-sm-2"
.col-sm-10 .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? - if @service.configurable_events.present?
.form-group.row .form-group.row
......
---
title: Activate new project integrations by default
merge_request: 23009
author:
type: changed
...@@ -7,10 +7,6 @@ module QA ...@@ -7,10 +7,6 @@ module QA
module Settings module Settings
module Services module Services
class Jenkins < QA::Page::Base 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 view 'app/views/shared/_field.html.haml' do
element :jenkins_url_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern 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 element :project_name_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
...@@ -23,7 +19,6 @@ module QA ...@@ -23,7 +19,6 @@ module QA
end end
def setup_service_with(jenkins_url:, project_name:) def setup_service_with(jenkins_url:, project_name:)
click_active_checkbox
set_jenkins_url(jenkins_url) set_jenkins_url(jenkins_url)
set_project_name(project_name) set_project_name(project_name)
set_username('admin') set_username('admin')
...@@ -33,10 +28,6 @@ module QA ...@@ -33,10 +28,6 @@ module QA
private private
def click_active_checkbox
click_element :active_checkbox
end
def set_jenkins_url(jenkins_url) def set_jenkins_url(jenkins_url)
fill_element(:jenkins_url_field, jenkins_url) fill_element(:jenkins_url_field, jenkins_url)
end end
......
...@@ -8,16 +8,15 @@ describe 'User activates issue tracker', :js do ...@@ -8,16 +8,15 @@ describe 'User activates issue tracker', :js do
let(:url) { 'http://tracker.example.com' } let(:url) { 'http://tracker.example.com' }
def fill_short_form(active = true) def fill_short_form(disabled: false)
check 'Active' if active uncheck 'Active' if disabled
fill_in 'service_project_url', with: url fill_in 'service_project_url', with: url
fill_in 'service_issues_url', with: "#{url}/:id" fill_in 'service_issues_url', with: "#{url}/:id"
end end
def fill_full_form(active = true) def fill_full_form(disabled: false)
fill_short_form(active) fill_short_form(disabled: disabled)
check 'Active' if active
fill_in 'service_new_issue_url', with: url fill_in 'service_new_issue_url', with: url
end end
...@@ -86,14 +85,14 @@ describe 'User activates issue tracker', :js do ...@@ -86,14 +85,14 @@ describe 'User activates issue tracker', :js do
end end
end end
describe 'user sets the service but keeps it disabled' do describe 'user disables the service' do
before do before do
click_link(tracker) click_link(tracker)
if skip_new_issue_url if skip_new_issue_url
fill_short_form(false) fill_short_form(disabled: true)
else else
fill_full_form(false) fill_full_form(disabled: true)
end end
click_button('Save changes') click_button('Save changes')
......
...@@ -9,8 +9,8 @@ describe 'User activates Jira', :js do ...@@ -9,8 +9,8 @@ describe 'User activates Jira', :js do
let(:url) { 'http://jira.example.com' } let(:url) { 'http://jira.example.com' }
let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' } let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' }
def fill_form(active = true) def fill_form(disabled: false)
check 'Active' if active uncheck 'Active' if disabled
fill_in 'service_url', with: url fill_in 'service_url', with: url
fill_in 'service_username', with: 'username' fill_in 'service_username', with: 'username'
...@@ -83,10 +83,10 @@ describe 'User activates Jira', :js do ...@@ -83,10 +83,10 @@ describe 'User activates Jira', :js do
end end
end end
describe 'user sets Jira Service but keeps it disabled' do describe 'user disables the Jira Service' do
before do before do
click_link('Jira') click_link('Jira')
fill_form(false) fill_form(disabled: true)
click_button('Save changes') click_button('Save changes')
end end
......
...@@ -8,8 +8,8 @@ describe 'User activates issue tracker', :js do ...@@ -8,8 +8,8 @@ describe 'User activates issue tracker', :js do
let(:url) { 'http://tracker.example.com' } let(:url) { 'http://tracker.example.com' }
def fill_form(active = true) def fill_form(disabled: false)
check 'Active' if active uncheck 'Active' if disabled
fill_in 'service_project_url', with: url fill_in 'service_project_url', with: url
fill_in 'service_issues_url', with: "#{url}/:id" fill_in 'service_issues_url', with: "#{url}/:id"
...@@ -67,10 +67,10 @@ describe 'User activates issue tracker', :js do ...@@ -67,10 +67,10 @@ describe 'User activates issue tracker', :js do
end end
end end
describe 'user sets the service but keeps it disabled' do describe 'user disables the service' do
before do before do
click_link(tracker) click_link(tracker)
fill_form(false) fill_form(disabled: true)
click_button('Save changes') click_button('Save changes')
end 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