diff options
author | Sanad Liaquat <sliaquat@gitlab.com> | 2019-05-23 02:24:51 +0500 |
---|---|---|
committer | Sanad Liaquat <sliaquat@gitlab.com> | 2019-05-23 02:24:51 +0500 |
commit | 3b7ac0c2bb9cfb704cb779c56cfc68202cfb5e8f (patch) | |
tree | 7aaef981eb43e410f57be28d8120546e4e1bc945 | |
parent | 60e4fec65740567a8049f1b0397329a776610409 (diff) | |
download | gitlab-ce-qa-webhooks-e2e-test.tar.gz |
Add more expectations and fix qa elementsqa-webhooks-e2e-test
-rw-r--r-- | app/views/shared/web_hooks/_form.html.haml | 8 | ||||
-rw-r--r-- | qa/qa/service/webhook.rb | 14 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/project/project_webhook_spec.rb | 31 |
3 files changed, 43 insertions, 10 deletions
diff --git a/app/views/shared/web_hooks/_form.html.haml b/app/views/shared/web_hooks/_form.html.haml index f2edd6aa32c..8a0cb03fdcd 100644 --- a/app/views/shared/web_hooks/_form.html.haml +++ b/app/views/shared/web_hooks/_form.html.haml @@ -25,8 +25,8 @@ %p.light.ml-1 This URL will be triggered when a new tag is pushed to the repository %li - = form.check_box :note_events, class: 'form-check-input' - = form.label :note_events, class: 'list-label form-check-label ml-1 qa-note-events-checkbox' do + = form.check_box :note_events, class: 'form-check-input qa-note-events-checkbox' + = form.label :note_events, class: 'list-label form-check-label ml-1' do %strong Comments %p.light.ml-1 This URL will be triggered when someone adds a comment @@ -49,8 +49,8 @@ %p.light.ml-1 This URL will be triggered when a confidential issue is created/updated/merged %li - = form.check_box :merge_requests_events, class: 'form-check-input' - = form.label :merge_requests_events, class: 'list-label form-check-label ml-1 qa-merge-request-events-checkbox' do + = form.check_box :merge_requests_events, class: 'form-check-input qa-merge-request-events-checkbox' + = form.label :merge_requests_events, class: 'list-label form-check-label ml-1' do %strong Merge request events %p.light.ml-1 This URL will be triggered when a merge request is created/updated/merged diff --git a/qa/qa/service/webhook.rb b/qa/qa/service/webhook.rb index 759419b3abf..cb5f56173e7 100644 --- a/qa/qa/service/webhook.rb +++ b/qa/qa/service/webhook.rb @@ -25,10 +25,16 @@ module QA @network end - def no_of_calls - no_of_calls_req = Runtime::API::Request.new(api_client, "calls/count", version: '') - response = get no_of_calls_req.url - parse_body(response) + def calls_count + request = Runtime::API::Request.new(api_client, "calls/count", version: '') + response = get request.url + parse_body(response)[:count] + end + + def last_call_event_type + request = Runtime::API::Request.new(api_client, "calls/last", version: '') + response = get request.url + parse_body(response)[:payload][:object_kind] end def api_client diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/project_webhook_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/project_webhook_spec.rb index 07c8167424a..a40f438c8d7 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/project_webhook_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/project_webhook_spec.rb @@ -34,14 +34,41 @@ module QA page.click_add_webhook_button end - expect(webhook_service.no_of_calls[:count]).to eq 0 + expect(webhook_service.calls_count).to eq 0 Resource::Issue.fabricate! do |issue| issue.project = project issue.title = "An issue title" end - expect(webhook_service.no_of_calls[:count]).to eq 1 + Support::Waiter.wait(max: 10, interval: 1) do + webhook_service.calls_count == 1 + end + + expect(webhook_service.last_call_event_type).to eq "issue" + + Page::Project::Issue::Show.perform do |show_page| + show_page.comment('This is a comment') + end + + Support::Waiter.wait(max: 10, interval: 1) do + webhook_service.calls_count == 2 + end + + expect(webhook_service.last_call_event_type).to eq "note" + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.file_name = 'README.md' + push.file_content = '# This is a test project' + push.commit_message = 'Add README.md' + end + + Support::Waiter.wait(max: 10, interval: 1) do + webhook_service.calls_count == 3 + end + + expect(webhook_service.last_call_event_type).to eq "push" end end end |