Group Test Webhook - Determine Project based on hook type's requirement
Problem
Currently when you test Webhooks at the Group level, it gets the first non-empty project in the Group (ie !project.empty_repo?). When trying to test an Issue event Webhook at the Group level, the first non-empty project is selected, regardless of whether that project has any issues. The Webhook test fails if the first non-empty project has no issues.
Example:
The issues_events_data method in Integrations::ProjectTestData requires that the Project given to it contain an Issue. If not, the Webhook test fails.
As the user does not have control as to what Project is passed to the test, and there is no check beforehand to ensure the first non-empty Project has any Issues, the Webhook test fails.
Proposal
Either to allow the user to specify a particular project in the Group when testing Webhooks at Group level, or ensure the Project selection process looks for a non-empty Project in the Group that also satisfies the basic requirement of the Webhook type. An example for the Issue event Webhook would be to ensure the Project selection process searches for non-empty Projects in the Group that also contains Issues.