mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 14:17:57 +08:00
FEATURE: Add Filter for Webhook Events by Status (#27332)
* FEATURE: Add Filter for Webhook Events by Status * Fixing multiple issues * Lint * Fixing multiple issues * Change the range of the status for webhook events
This commit is contained in:
37
spec/system/admin_web_hook_events_spec.rb
Normal file
37
spec/system/admin_web_hook_events_spec.rb
Normal file
@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "Admin WebHook Events", type: :system do
|
||||
fab!(:web_hook)
|
||||
fab!(:admin)
|
||||
fab!(:web_hook_event1) { Fabricate(:web_hook_event, web_hook: web_hook, status: 200) }
|
||||
fab!(:web_hook_event2) { Fabricate(:web_hook_event, web_hook: web_hook, status: 404) }
|
||||
|
||||
let(:admin_web_hooks_page) { PageObjects::Pages::AdminWebHookEvents.new }
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
it "shows all webhook events when filter is on 'All Events'" do
|
||||
admin_web_hooks_page.visit(web_hook.id)
|
||||
|
||||
expect(admin_web_hooks_page).to have_web_hook_event(web_hook_event1.id)
|
||||
expect(admin_web_hooks_page).to have_web_hook_event(web_hook_event2.id)
|
||||
end
|
||||
|
||||
it "shows only successfully delivered webhook events when filter is on 'Delivered'" do
|
||||
admin_web_hooks_page.visit(web_hook.id)
|
||||
admin_web_hooks_page.click_filter_all
|
||||
admin_web_hooks_page.click_filter_delivered
|
||||
|
||||
expect(admin_web_hooks_page).to have_web_hook_event(web_hook_event1.id)
|
||||
expect(admin_web_hooks_page).to have_no_web_hook_event(web_hook_event2.id)
|
||||
end
|
||||
|
||||
it "shows only webhook events that are failed to deliver when filter is on 'Failed'" do
|
||||
admin_web_hooks_page.visit(web_hook.id)
|
||||
admin_web_hooks_page.click_filter_all
|
||||
admin_web_hooks_page.click_filter_failed
|
||||
|
||||
expect(admin_web_hooks_page).to have_no_web_hook_event(web_hook_event1.id)
|
||||
expect(admin_web_hooks_page).to have_web_hook_event(web_hook_event2.id)
|
||||
end
|
||||
end
|
32
spec/system/page_objects/pages/admin_web_hook_events.rb
Normal file
32
spec/system/page_objects/pages/admin_web_hook_events.rb
Normal file
@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Pages
|
||||
class AdminWebHookEvents < PageObjects::Pages::Base
|
||||
def visit(id)
|
||||
page.visit("/admin/api/web_hooks/#{id}")
|
||||
self
|
||||
end
|
||||
|
||||
def click_filter_all
|
||||
find(".select-kit-header", text: "All Events").click
|
||||
end
|
||||
|
||||
def click_filter_delivered
|
||||
find(".select-kit-row", text: "Delivered").click
|
||||
end
|
||||
|
||||
def click_filter_failed
|
||||
find(".select-kit-row", text: "Failed").click
|
||||
end
|
||||
|
||||
def has_web_hook_event?(id)
|
||||
page.has_css?("li .event-id", text: id)
|
||||
end
|
||||
|
||||
def has_no_web_hook_event?(id)
|
||||
page.has_no_css?("li .event-id", text: id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user