[One Workflow] Add Scout API test scaffold and execution tests#256300
Merged
skynetigor merged 26 commits intoelastic:mainfrom Mar 11, 2026
Merged
[One Workflow] Add Scout API test scaffold and execution tests#256300skynetigor merged 26 commits intoelastic:mainfrom
skynetigor merged 26 commits intoelastic:mainfrom
Conversation
- Introduced Playwright configuration file for testing workflows. - Created constants for common headers and API base URL. - Implemented WorkflowsApiService to handle API interactions, including methods for creating, running, and managing workflow executions. - Added tests for workflow execution concurrency control and scheduled workflows to ensure proper functionality and behavior. This commit lays the groundwork for comprehensive testing of the workflows management feature.
- Updated the method for evaluating expressions from `evaluateExpression` to `render` in the ConcurrencyManager class. - This change enhances clarity and aligns with the updated templating engine API. No functional changes are expected; this is primarily a refactor for improved code maintainability.
- Updated import statements to use `type` for type-only imports in `concurency_control.spec.ts` and `scheduled_workflow.spec.ts`. - Reformatted code for better clarity and consistency, including adjustments to promise handling and array filtering. - Removed unnecessary comments and whitespace to enhance code cleanliness. These changes aim to improve the maintainability and readability of the test files without altering their functionality.
skynetigor
commented
Mar 5, 2026
src/platform/plugins/shared/workflows_management/test/scout_workflows_ui/api/.eslintrc.json
Outdated
Show resolved
Hide resolved
Kiryous
reviewed
Mar 5, 2026
...s_management/test/scout_workflows_ui/api/tests/workflow_execution/concurency_control.spec.ts
Outdated
Show resolved
Hide resolved
- Modified test cases in `concurrency_manager.test.ts` to ensure that null, undefined, and empty string evaluations return null instead of the original key. - Adjusted the `evaluateConcurrencyKey` method in `concurrency_manager.ts` to return null for empty strings and to streamline the rendering logic, enhancing clarity and consistency. These changes improve the accuracy of concurrency key evaluations and ensure that the tests reflect the intended behavior.
yngrdyn
reviewed
Mar 6, 2026
..._management/test/scout_workflows_ui/api/tests/workflow_execution/concurrency_control.spec.ts
Show resolved
Hide resolved
yngrdyn
reviewed
Mar 6, 2026
...ns/shared/workflows_management/test/scout_workflows_ui/api/fixtures/workflows_api_service.ts
Outdated
Show resolved
Hide resolved
This commit introduces a new ESLint configuration file (.eslintrc.js) for the Workflows API tests, disabling the rule that requires the API client in API tests. The previous .eslintrc.json file has been removed as part of this update.
This commit updates the Workflows API service by converting it from a plain object to a class-based implementation. The methods for creating, updating, bulk creating, deleting, and retrieving workflows have been refactored to use async/await syntax for better readability and error handling. Additionally, the import statements have been adjusted to reflect the new structure.
This commit updates the Workflows API fixtures by transitioning from a role-based API client to a more structured approach using the KbnClient. The `spaceTest` function has been introduced to extend the API services, allowing for better integration with the Workflows API Service. Import statements have also been adjusted to reflect these changes.
This commit refactors the Workflows API tests to utilize the `spaceTest` context, enhancing the structure and organization of the tests. The tests have been updated to accommodate the new space-based API service interactions, including adjustments to the import statements and the workflow creation and deletion processes. Additionally, the concurrency control and scheduled workflow tests have been modified to ensure proper handling of space-specific workflows.
skynetigor
commented
Mar 9, 2026
| `; | ||
|
|
||
| // FLAKY: https://github.com/elastic/security-team/issues/16272 | ||
| spaceTest.describe.skip('Scheduled workflow execution', { tag: tags.deploymentAgnostic }, () => { |
Contributor
Author
There was a problem hiding this comment.
Skipped due to inconsistent interval between scheduled executions
This commit further refines the Workflows API tests by removing the explicit use of space IDs in workflow creation, deletion, and other API interactions. The tests have been updated to leverage the context provided by the `spaceTest`, enhancing readability and maintainability. Additionally, adjustments have been made to ensure that the API service methods align with the new structure, promoting a cleaner and more efficient testing framework.
…igor/kibana into scout_tests_for_workflows
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
|
mbondyra
added a commit
to mbondyra/kibana
that referenced
this pull request
Mar 11, 2026
…e_fix * commit '565f7545c422192218b803874fbdf93e8d8f08ee': (27 commits) [Lens API] ESQL schema for XY separately for Agent and some small token optimizations (elastic#256885) Fix "Accessing resource attributes before async attributes settled" telemetry error (elastic#256880) [Security Solution][Attacks/Alerts][Attacks page][Table section] Preserver "Sort by" state on Attacks page (elastic#256717) (elastic#256795) [APM] Improve redirect with default date range guard (elastic#256887) [Security Solution][Attacks/Alerts][Attacks page][Table section] Add assignees avatars to the group component (elastic#250126) (elastic#256901) [Docs] add xpack.alerting.rules.maxScheduledPerMinute setting description (elastic#257041) [SO] Fix non-deterministic ordering in nested find API integration tests (elastic#256447) [Write-restricted dashboards] Update user profile retrieval for getShouldAddAccessControl (elastic#255065) [One Workflow] Add Scout API test scaffold and execution tests (elastic#256300) [Fleet] add use_apm if dynamic_signal_types are enabled (elastic#256429) [Fleet] ignore data streams starting with `.` in Fleet API (elastic#256625) [ES|QL] METRICS_INFO support: columns_after & summary (elastic#256758) [Agent Builder] Agent plugins: initial installation support (elastic#256478) [Streams] Add field descriptions and documentation-only field overrides (elastic#255136) [api-docs] 2026-03-11 Daily api_docs build (elastic#257023) [Security Solution] fix alerts page infinite loading state due to data view error (elastic#256983) [Logging] Add `service.*` global fields (elastic#256878) [Canvas] Apply embeddable transforms to embeddable elements (elastic#252191) [table_list_view_table] stabilize jest test (elastic#254991) [Obs AI] get_index_info: add unit tests (elastic#256802) ...
sorenlouv
pushed a commit
that referenced
this pull request
Mar 17, 2026
## Motivation The `workflows_management` plugin had Scout UI tests (`test/scout_workflows_ui/ui/`) but lacked any API-level tests. Workflow execution behaviour — concurrency control strategies and scheduled execution — is critical to verify at the API layer, where timing-sensitive scenarios can be tested without the overhead of browser-based UI interactions. This PR introduces a Scout API test project alongside the existing UI test project in the same `scout_workflows_ui` root, and adds the first set of API tests covering workflow execution concurrency control and scheduled workflows. ## What was added ### Scout API test scaffold - `api/playwright.config.ts` — Playwright config pointing at `./tests` - `api/fixtures/constants.ts` — shared headers (`kbn-xsrf`, `x-elastic-internal-origin`) and `WORKFLOWS_API_BASE` path - `api/fixtures/workflows_api_service.ts` — `WorkflowsApiService` class wrapping `apiClient` with methods: `create`, `run`, `update`, `getExecution`, `getExecutions`, `waitForTermination`, `bulkDelete`, `deleteAll` - `api/fixtures/index.ts` — extended `apiTest` fixture exposing `getWorkflowsApi` factory (accepts `RoleApiCredentials`) ### Concurrency control tests (`concurency_control.spec.ts`) - **cancel-in-progress strategy** — triggers 3 concurrent executions with the same concurrency key; asserts that all previous executions are cancelled and only the latest completes with all 4 steps - **drop strategy** — triggers 3 concurrent executions; asserts that only the first execution completes while subsequent ones are skipped with 0 steps ### Scheduled workflow tests (`scheduled_workflow.spec.ts`) - **Enabling a scheduled workflow triggers executions automatically** — creates a workflow with `every: 5s`, enables it, waits ~16s, verifies 2+ executions fired and all completed successfully with correct inter-execution timing - **Disabling a scheduled workflow stops new executions** — enables the workflow, waits for executions, disables it, waits again, asserts at most 1 extra in-flight execution appeared after disable - **Scheduled executions do not overlap** — uses a long-running workflow (6s wait step > 5s interval) to prove the scheduler waits for the previous run to finish before starting the next, by asserting consecutive start times are spaced >10s apart --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The
workflows_managementplugin had Scout UI tests (test/scout_workflows_ui/ui/) but lacked any API-level tests. Workflow execution behaviour — concurrency control strategies and scheduled execution — is critical to verify at the API layer, where timing-sensitive scenarios can be tested without the overhead of browser-based UI interactions.This PR introduces a Scout API test project alongside the existing UI test project in the same
scout_workflows_uiroot, and adds the first set of API tests covering workflow execution concurrency control and scheduled workflows.What was added
Scout API test scaffold
api/playwright.config.ts— Playwright config pointing at./testsapi/fixtures/constants.ts— shared headers (kbn-xsrf,x-elastic-internal-origin) andWORKFLOWS_API_BASEpathapi/fixtures/workflows_api_service.ts—WorkflowsApiServiceclass wrappingapiClientwith methods:create,run,update,getExecution,getExecutions,waitForTermination,bulkDelete,deleteAllapi/fixtures/index.ts— extendedapiTestfixture exposinggetWorkflowsApifactory (acceptsRoleApiCredentials)Concurrency control tests (
concurency_control.spec.ts)Scheduled workflow tests (
scheduled_workflow.spec.ts)every: 5s, enables it, waits ~16s, verifies 2+ executions fired and all completed successfully with correct inter-execution timing