Loading
Add test runs tab with GraphQL query to fetch test run data
What does this MR do and why?
Add test runs tab with GraphQL query to fetch test run data
- Replace placeholder UI with actual GraphQL query integration
- Create project and group queries for fetching policy test runs
- Display latest test run with state, project, timing, and errors
- Show loading state while fetching and handle query errors
- Update tests for new query-based implementation
References
Screenshots or screen recordings
| Project | Group |
|---|---|
![]() |
![]() |
How to set up and validate locally
Prerequisites
- Enable the feature flag:
Feature.enable(:spep_test_run) - Set up a group with a security policy project and a scheduled pipeline execution policy. See the Pipeline execution policy documentation for setup instructions.
Step 1: Create a test run via Rails console Follow the instructions from !226513 Step 1:
policy = Security::Policy.type_pipeline_execution_schedule_policy.last
project = policy.projects.last || Project.find_by_full_path('your-group/your-project')
user = User.find_by_username('your-username')
result = Security::PipelineExecutionPolicies::TestRunService.new(
policy: policy, project: project, user: user
).execute
# Verify the test run was created
result.payload[:test_run]
# => #<Security::ScheduledPipelineExecutionPolicyTestRun id: ..., state: "running", ...>Step 2: View the test run in the UI
- Navigate to the group or project where the policy is configured
- Go to Secure > Policies
- Click on the scheduled pipeline execution policy to open the policy drawer
- Click on the Test runs tab
- You should see the most recent test run with its state, project, timing, and any error messages
Step 3: Verify expected behavior
- The test run should display the state (Running, Completed, or Failed)
- If the test run has finished, it should show the completion time and duration
- If the test run failed, it should display the error message in red
- At the group level, you should see a project selector to choose which project to run tests against
- Verify the badges in the policy list
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #588504 (closed)
Edited by Alexander Turinske

