Commit 8bdf18d7 authored by Justin Ho's avatar Justin Ho

Extract active toggle click to a function

Extract away complex selector
parent 11a682a9
......@@ -8,7 +8,7 @@ describe 'User activates issue tracker', :js do
let(:url) { 'http://tracker.example.com' }
def fill_form(disable: false, skip_new_issue_url: false)
find('input[name="service[active]"] + button').click if disable
click_active_toggle if disable
fill_in 'service_project_url', with: url
fill_in 'service_issues_url', with: "#{url}/:id"
......
......@@ -9,7 +9,7 @@ describe 'User activates Jira', :js do
let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' }
def fill_form(disable: false)
find('input[name="service[active]"] + button').click if disable
click_active_toggle if disable
fill_in 'service_url', with: url
fill_in 'service_username', with: 'username'
......
......@@ -28,7 +28,7 @@ describe 'Set up Mattermost slash commands', :js do
token = ('a'..'z').to_a.join
fill_in 'service_token', with: token
find('input[name="service[active]"] + button').click
click_active_toggle
click_on 'Save changes'
expect(current_path).to eq(project_settings_integrations_path(project))
......
......@@ -21,7 +21,7 @@ describe 'Slack slash commands' do
it 'redirects to the integrations page after saving but not activating', :js do
fill_in 'service_token', with: 'token'
find('input[name="service[active]"] + button').click
click_active_toggle
click_on 'Save'
expect(current_path).to eq(project_settings_integrations_path(project))
......
......@@ -18,6 +18,10 @@ shared_context 'project service activation' do
click_link(name)
end
def click_active_toggle
find('input[name="service[active]"] + button').click
end
def click_test_integration
click_button('Test settings and 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