2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2021-03-24 09:40:16 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Manage > Webhook', type: :system do
|
2021-10-08 06:23:20 +00:00
|
|
|
|
|
|
|
context 'when showing the example payload' do
|
|
|
|
|
|
|
|
it 'shows correctly' do
|
|
|
|
visit '/#manage/webhook'
|
|
|
|
|
|
|
|
within :active_content do
|
|
|
|
click 'a[data-type="payload"]'
|
|
|
|
end
|
|
|
|
|
|
|
|
in_modal disappears: false do
|
|
|
|
expect(page).to have_text('X-Zammad-Trigger:')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when deleting' do
|
2021-03-24 09:40:16 +00:00
|
|
|
let!(:webhook) { create(:webhook) }
|
|
|
|
let!(:trigger) { create(:trigger, perform: { 'notification.webhook' => { 'webhook_id' => webhook.id.to_s } }) }
|
|
|
|
|
|
|
|
it 'referenced webhook shows error message' do
|
|
|
|
visit '/#manage/webhook'
|
|
|
|
|
|
|
|
within :active_content do
|
|
|
|
click '.js-action'
|
|
|
|
click '.js-delete'
|
|
|
|
end
|
|
|
|
|
|
|
|
in_modal disappears: false do
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_text('Cannot delete').and(have_text("##{trigger.id}"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|