Commit graph

721 commits

Author SHA1 Message Date
Sipke Schoorstra 103063ee69
Refactor Finish activity tests and workflows. Migrate integration tests to component tests, introduce new workflows for advanced scenarios, and enhance runner utilities to simplify execution logic. 2025-12-20 15:53:57 +01:00
Sipke Schoorstra fbe9ca64f0
Fix Switch activity behavior and add testing utilities for RunWorkflowResult and improve (#7151)
* Add testing utilities for `RunWorkflowResult` and improve `Switch` activity behavior

- Introduced `RunWorkflowResultAssertions` for xUnit-based workflow testing.
- Added `RunWorkflowResultExtensions` for journal-based activity execution context handling.
- Refactored `Switch` activity to track scheduled activities and correctly complete execution when all scheduled activities finish.
- Marked `RunActivityExtensions` methods as obsolete, recommending the use of `WorkflowTestFixture`.

* Update src/common/Elsa.Testing.Shared.Integration/RunActivityExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Switch.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add XML documentation to Switch activity callback method (#7152)

* Initial plan

* Add XML documentation to OnChildActivityCompletedAsync method

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
2025-12-19 17:05:12 +01:00
j03y-nxxbz 48b574a411
Added logic to search for workflow-as-activities based on DefinitionId (not only versionId) (#7149)
* Inital commit:

1. Fixed problem: (re-)added logic to search for workflow-as-activities based on DefinitionId (not only versionId)

2. Added tests for Deserialiazation so this logic cannot disappear "unnoticed" in the future.

* Found one flaw:
workflowDefinitionId is also used in other activities. Therefore, we must make sure to only search by workflowDefinitionId when the value is a string (e.g. when workflow used as activity, the value will always be a constant string, because the workflowDefinitionId cannot be resolved using expressions)

* Final attempt:
1) First try to find the activity by type name
2) Even if a descriptor is found by its type name, there might be multiple versions of a workflow-as-activity, hence; if the workflowDefinitionVersionId is specified, then this can override the initially found activity descriptor by type name.
3) Lastly, only when no activity descriptor is found by type name AND the activity JSON contains the property "workflowDeftinitionId", then we can search by workflowDefinitionId

* Add `net8.0` and `net9.0` targets, update package versions for resilience libraries.

* Exclude `net10.0` target framework from MySQL EF Core project due to Pomelo compatibility constraints.

* Remove unnecessary whitespace in MySQL EF Core project file

* Refactor `ActivityJsonConverterTests` to streamline registry setup and improve readability.

* Adds null activity descriptor lookup mock

Ensures the custom property lookup path is tested by mocking type name lookups to return null when searching for ActivityDescriptors.

* Fix activity descriptor override assignment in `ActivityJsonConverter`

Corrects the assignment logic for `activityDescriptor` and ensures `activityTypeVersion` uses the overridden descriptor's version when a custom property match is found.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor `ActivityJsonConverter` for readability and logic improvements

- Adjust null-check handling for `activityDescriptor` overrides.
- Improve comment clarity and consolidate lambda expressions.
- Remove unnecessary whitespace.

* Add blob extension handling to `BlobStorageWorkflowsProvider`

- Introduce `BlobExtensions` for extracting blob file extensions.
- Add `SupportsExtension` to `IBlobWorkflowFormatHandler` to filter handlers by supported extensions.

* Remove unused workflow files and references in `Elsa.Server.Web`

- Deleted `flowchart-test.elsa` and `multi-workflow-example.elsa`.
- Removed corresponding references from the project file.

---------

Co-authored-by: Joey Barten - Founder Orbyss <joey.barten@unfussiness.io>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-17 23:23:49 +01:00
Sipke Schoorstra 4bbdd6f3a7
Configures Flowchart Execution via DI (#7141)
* Introduce `FlowchartExecutionMode` to streamline flowchart execution logic.

- Added `FlowchartExecutionMode` enum to represent execution modes (Default, TokenBased, CounterBased).
- Updated flowchart-related integration and unit tests to use the new execution mode.
- Removed the global `UseTokenFlow` flag in favor of execution-specific configuration via `RunWorkflowOptions`.
- Refactored flowchart-related APIs and test helpers for improved flexibility and modularity.

* Add support for configuring flowchart execution behavior via `FlowchartOptions` and DI.

- Introduced extensions for `FlowchartFeature` to simplify configuration.
- Added DI support for setting default execution modes.
- Refactored flowchart execution logic to prioritize configuration.

* Update default Flowchart execution settings to align with version 3.5.2 behavior

- Changed `DefaultExecutionMode` to `CounterBased`.
- Updated `UseTokenFlow` default to `false`.

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/FlowchartExecutionMode.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/FlowchartFeatureExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/Elsa.Workflows.IntegrationTests/Scenarios/FlowchartNextActivity/Tests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/RunWorkflowOptionsExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor flowchart integration tests for improved formatting and consistency

* Refactor workflow tests and related services to improve reusability and align with updated Flowchart execution behavior

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Options/FlowchartOptions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor flowchart execution logic to use `FlowchartExecutionMode` enum, replacing boolean checks for improved clarity and extensibility.

* Refactor tests and workflow logic to replace boolean `useTokenFlow` with `FlowchartExecutionMode` enum for clarity and consistency.

* Refactor flowchart execution logic to centralize mode-based behavior handling and simplify implementation.

* Remove unnecessary whitespace in Flowchart.cs to improve code formatting

* Remove unnecessary whitespace in FlowJoinTests.cs to improve code formatting

* Update src/common/Elsa.Testing.Shared.Integration/WorkflowTestFixture.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-15 10:15:39 +01:00
Sipke Schoorstra dd6bfbb6b0
Comment out SQL Server image configuration in component test infrastructure. 2025-12-11 10:05:39 +01:00
Sipke Schoorstra 14189494b2
Switch component tests database configuration from PostgreSQL to SQL Server. 2025-12-11 09:58:45 +01:00
Sipke Schoorstra 183934c1af
Revert component tests database configuration from SQL Server to PostgreSQL. 2025-12-11 09:54:16 +01:00
Sipke Schoorstra 1107b48200
Switch component tests from PostgreSQL to SQL Server and update related configurations. 2025-12-11 09:45:37 +01:00
Sipke Schoorstra a80490101a
Refactor flowchart activity execution logic to improve modularity and add enhanced support for FlowJoin activity types. 2025-12-10 21:34:00 +01:00
Sipke Schoorstra 0ef0135303
Merge remote-tracking branch 'origin/patch/3.5.3' into develop/3.6.0 2025-12-10 20:48:50 +01:00
Sipke Schoorstra c79275fcca
Restore Scope.Dispose in AppComponentTest to ensure proper resource cleanup during test execution. 2025-12-10 11:25:29 +01:00
Sipke Schoorstra 8730f0cdeb
Restore Scope.Dispose in AppComponentTest and update WorkflowServer DB connection string with pool size configuration 2025-12-10 11:25:17 +01:00
Sipke Schoorstra da88712e75
Increase PostgreSQL test container max connections to 100 for improved parallelism in component tests 2025-12-10 11:10:45 +01:00
Sipke Schoorstra bcb613cf86
Remove redundant database configuration and simplify connection string in WorkflowServer. 2025-12-10 11:01:52 +01:00
Sipke Schoorstra 56089c95f1
Update workflow to dump Docker logs on failure and improve PostgreSQL container configuration
- Add Docker logs capturing step in GitHub Actions workflow for better debugging.
- Update PostgreSQL test container to use `postgres:16-alpine` with enhanced configuration options.
- Set database connection `Max Pool Size` to 20 in component tests.
2025-12-10 10:55:52 +01:00
Sipke Schoorstra fdf3e385b1
Fix Race Condition Causing Duplicate Trigger Registration in Multi-Engine Environments + Add Concurrency Tests to Prevent Regression (#7131)
* Add component tests for concurrent trigger indexing to prevent duplicate trigger registration in multi-engine workflows (#7130)

* Pin `dotnet-ef` version in `.config/dotnet-tools.json` to address migration bug, update EF Core script modules, and enhance `DesignTimeDbContextFactoryBase` with improved option description.

* Add migrations for EF Core SQLite and MySQL to include unique indexing on triggers.

* Update ConcurrentTriggerIndexing test to verify unique constraint enforcement and throw `DbUpdateException` for duplicate triggers

* Update src/modules/Elsa.Persistence.EFCore/Modules/Runtime/TriggerStore.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Persistence.EFCore/Modules/Runtime/TriggerStore.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update EF Core script to include `Management` module and restore `Sqlite` provider in migration process

* Rename `SimpleHttpApiWorkflow.cs` to `HttpWorkflow.cs` in ConcurrentTriggerIndexing test.

* Remove 'locks' folder from project

Removed the 'locks' folder from the project structure.

* Clean up migration script by removing redundant column type changes

* Update EF Core Oracle migrations to change NVARCHAR2 fields to NCLOB for larger data storage

* Update EF Core Oracle migrations to use NCLOB for larger data storage

* Remove retry logic and logger dependency from EFCoreTriggerStore in TriggerStore implementation

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-05 09:17:14 +01:00
lucas.hipolito ea3c5c67aa Merge remote-tracking branch 'origin/feat/tests-http-endpoint' into feat/tests-http-endpoint 2025-12-03 16:20:02 +01:00
lucas.hipolito dbfd5b65c9 Removing duplicate test 2025-12-03 16:19:59 +01:00
lukhipolito-nexxbiz 904cff75ef
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:18:13 +01:00
lukhipolito-nexxbiz b000b2b794
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:17:56 +01:00
lukhipolito-nexxbiz 8987e043e9
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:17:07 +01:00
lukhipolito-nexxbiz 94b409b08a
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/JsonContentWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:16:48 +01:00
lukhipolito-nexxbiz 6501262486
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/RouteParametersWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:16:28 +01:00
lukhipolito-nexxbiz d9e460e0d4
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:15:59 +01:00
lukhipolito-nexxbiz 90af851962
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/FileUploadWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:15:39 +01:00
lukhipolito-nexxbiz 859a14ede2
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/BlockedFileExtensionWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:14:52 +01:00
lukhipolito-nexxbiz 2f9d6c1ec3
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/BasicHttpEndpointWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:14:39 +01:00
lukhipolito-nexxbiz f023e1f994
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:14:03 +01:00
lukhipolito-nexxbiz c791843860
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointRouteParametersTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:13:49 +01:00
lukhipolito-nexxbiz d8b929a5bd
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/QueryStringAndHeadersWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:13:38 +01:00
lukhipolito-nexxbiz 1f0aa37780
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/MultipleHttpMethodsWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:13:28 +01:00
lukhipolito-nexxbiz 9f0220e088
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/Workflows/FormDataWorkflow.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 16:13:17 +01:00
lucas.hipolito 0074061990 fixing build after merge 2025-12-03 15:31:33 +01:00
lucas.hipolito 2f93f498b4 Merge remote-tracking branch 'origin/feat/tests-http-endpoint' into feat/tests-http-endpoint 2025-12-03 15:30:20 +01:00
lucas.hipolito 7184336f8e PR comments 2025-12-03 15:30:17 +01:00
lukhipolito-nexxbiz fc14e99ed4
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 15:30:00 +01:00
lukhipolito-nexxbiz 536e908898
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 14:33:14 +01:00
lukhipolito-nexxbiz d77f73d1dc
Update test/unit/Elsa.Activities.UnitTests/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 14:08:55 +01:00
lukhipolito-nexxbiz eaac09dfd6
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 14:08:21 +01:00
lucas.hipolito 3ddd6bb1cf Merge remote-tracking branch 'origin/feat/tests-http-endpoint' into feat/tests-http-endpoint 2025-12-03 11:48:56 +01:00
lucas.hipolito 570b0d4678 Removed unnecessary tests, small refactors for readability +organization 2025-12-03 11:48:53 +01:00
lukhipolito-nexxbiz 1fe6e0e420
Update test/unit/Elsa.Activities.UnitTests/Http/HttpEndpointTests.cs
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2025-12-03 11:38:29 +01:00
lucas.hipolito 9e7b04b48d Merge remote-tracking branch 'origin/feat/tests-http-endpoint' into feat/tests-http-endpoint 2025-12-03 11:25:10 +01:00
lukhipolito-nexxbiz c4f1fcdef4
Merge pull request #7126 from elsa-workflows/copilot/sub-pr-7125
Remove test that validates web server behavior rather than Elsa functionality
2025-12-03 11:24:36 +01:00
lucas.hipolito bbf9378d83 Merge remote-tracking branch 'origin/feat/tests-http-endpoint' into feat/tests-http-endpoint 2025-12-03 11:22:06 +01:00
lucas.hipolito ad9bc2ef70 Removing ambiguous assertions 2025-12-03 11:20:51 +01:00
lukhipolito-nexxbiz e3149ea3c2
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 11:19:57 +01:00
lukhipolito-nexxbiz a87cbe34a2
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointSecurityAndEdgeCasesTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 11:18:21 +01:00
lukhipolito-nexxbiz 46004b33c4
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointSecurityAndEdgeCasesTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 11:18:06 +01:00
lukhipolito-nexxbiz 4712782e6d
Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointQueryStringAndHeadersTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 11:17:21 +01:00