[go: up one dir, main page]

Resolve ambiguity in ee/spec/features/groups/settings/webhooks_settings_spec.rb

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The spec ee/spec/features/groups/settings/webhooks_settings_spec.rb line 45 ('shows a list of available group hook triggers') needs to be clarified or refactored to ensure it's testing the intended behavior.

Problem

The test 'shows a list of available group hook triggers' appears to be testing the chips displayed on existing hooks rather than the form fields for adding a new webhook. This creates potential ambiguity:

  • If we're supposed to be testing the form, we may get a false positive when the event type is enabled on the demo hook
  • If we're supposed to be testing the demo hook, we may get a false positive because a form field exists with the same label

The test wasn't passing until deployment_events was enabled on the existing hook in the factory (ee/spec/factories/group_hooks.rb), which suggests it's currently testing the chips rather than the form.

Context

From the discussion in !210618 (merged):

ee/spec/features/groups/settings/webhooks_settings_spec.rb:45 was failing in your branch because have_content was unable to find "Deployment events" in the hidden (and possibly not rendered yet?) form that appears when you click "Add new webhook", but IS able to find it on the existing hook - after the event is enabled by default at the factory level.

The spec on line 45 appears to be testing the chips at the moment, which is already covered by the 'creates a group hook' example.

Proposed Solution

Choose one of the following approaches:

  1. Delete the example - if we have confidence that the JS specs show the fields are rendered correctly
  2. Update the example - to explicitly prove that the form is rendered correctly, possibly by:
    • Enabling :js
    • Clicking 'Add new webhook' button
    • Scoping the expectations to the form specifically

Additional Notes

  • The test name "shows a list of available group hook triggers" doesn't quite make sense as the first test in that block, since groups/settings/webhooks_settings_spec.rb was originally written to test the whole /-/hooks page
  • The 'when accessing group hooks' context starts with testing what the user sees if a hook was already created, then adding a new hook, then editing existing hook, etc.
Edited by 🤖 GitLab Bot 🤖