Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,64 @@
using Elsa.Testing.Shared;
using Xunit.Abstractions;
namespace Elsa.Workflows.IntegrationTests.Scenarios.ParentChildInputs;
/// <summary>
/// Tests for the flowchart completion feature using various workflow setups.
/// </summary>
public class Tests
{
private readonly CapturingTextWriter _capturingTextWriter = new();
private readonly IServiceProvider _services;
public Tests(ITestOutputHelper testOutputHelper)
{
_services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
}
[Fact(DisplayName = "Child activity receives workflow input from parent even if same name.")]
public async Task Test1()
{
// Populate registries.
await _services.PopulateRegistriesAsync();
// Import child workflow.
var childFileName = $"Scenarios/ParentChildInputs/Workflows/child.json";
await _services.ImportWorkflowDefinitionAsync(childFileName);
// Import parent workflow.
var parentFileName = $"Scenarios/ParentChildInputs/Workflows/parent1.json";
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync(parentFileName);
// Execute.
var input = new Dictionary<string, object> { ["Input1"] = "Foo" };
await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId, input);
// Assert expected output.
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "Parent: Foo", "Child: Bar" }, lines);
}
[Fact(DisplayName = "Child activity receives input from parent event if same name and does not use global workflow input.")]
public async Task Test2()
{
// Populate registries.
await _services.PopulateRegistriesAsync();
// Import child workflow.
var childFileName = $"Scenarios/ParentChildInputs/Workflows/child.json";
await _services.ImportWorkflowDefinitionAsync(childFileName);
// Import parent workflow.
var parentFileName = $"Scenarios/ParentChildInputs/Workflows/parent2.json";
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync(parentFileName);
// Execute.
var input = new Dictionary<string, object> { ["Input1"] = "Foo" };
await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId, input);
// Assert expected output.
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "Parent: Foo", "Child: Foo" }, lines);
}
}
@@ -0,0 +1,139 @@
{
"id": "228c0150ab7b4745b038b950be574935",
"definitionId": "25b097966de245818e9a5c0d04f3323e",
"name": "Child",
"createdAt": "2023-09-06T09:57:32.944622+00:00",
"version": 5,
"variables": [],
"inputs": [
{
"uiHint": "singleline",
"storageDriverType": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core",
"type": "Object",
"name": "Input1",
"displayName": "Input1",
"description": "",
"category": "",
"isArray": false
}
],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output1",
"description": "",
"isArray": false
}
],
"outcomes": [],
"customProperties": {},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "Flowchart1",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:45",
"NotFoundConnectionsKey": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"start": "WriteLine1",
"activities": [
{
"outputName": {
"typeName": "String",
"expression": {
"type": "Literal",
"value": "Output1"
},
"memoryReference": {
"id": "ca8473b5-83ec-4f75-a2f1-dfba71f349d1"
}
},
"outputValue": {
"typeName": "Object",
"expression": {
"type": "JavaScript",
"value": "return getInput1();"
},
"memoryReference": {
"id": "06c6243d-8a57-45e3-ae54-f209b95d2bb2"
}
},
"id": "SetOutput1",
"name": null,
"type": "Elsa.SetOutput",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 636,
"y": 250.01388549804688
},
"size": {
"width": 107.734375,
"height": 50
}
}
}
},
{
"text": {
"typeName": "String",
"expression": {
"type": "JavaScript",
"value": "\u0022Child: \u0022 \u002B getInput1();"
},
"memoryReference": {
"id": "3f726554-0fa1-4e54-b5e7-74b18807437b"
}
},
"id": "WriteLine1",
"name": null,
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 332.01385498046875,
"y": 222.01388549804688
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
}
],
"connections": [
{
"source": {
"activity": "WriteLine1",
"port": "Done"
},
"target": {
"activity": "SetOutput1",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,138 @@
{
"id": "e49f81715e29460187671ee298bbd0b2",
"definitionId": "6a4f5aeecbf94fc09dbba65363c5cb57",
"name": "Parent1",
"createdAt": "2023-09-06T11:38:10.701838+00:00",
"version": 8,
"variables": [],
"inputs": [
{
"uiHint": "singleline",
"storageDriverType": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core",
"type": "Object",
"name": "Input1",
"displayName": "Input1",
"description": "",
"category": "",
"isArray": false
}
],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output1",
"description": "",
"isArray": false
}
],
"outcomes": [],
"customProperties": {},
"isReadonly": false,
"isLatest": true,
"isPublished": false,
"options": {
"autoUpdateConsumingWorkflows": false
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "Flowchart1",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:45",
"NotFoundConnectionsKey": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"start": "WriteLine1",
"activities": [
{
"text": {
"typeName": "String",
"expression": {
"type": "JavaScript",
"value": "\u0022Parent: \u0022 \u002B getInput1();"
},
"memoryReference": {
"id": "3070bee4-8309-44e3-a805-a9ec7fdd7ac2"
}
},
"id": "WriteLine1",
"name": null,
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 160,
"y": 280
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
},
{
"workflowDefinitionId": "25b097966de245818e9a5c0d04f3323e",
"workflowDefinitionVersionId": "228c0150ab7b4745b038b950be574935",
"latestAvailablePublishedVersion": 5,
"latestAvailablePublishedVersionId": "228c0150ab7b4745b038b950be574935",
"id": "22jW7xiYM0K30H99EDWztQ",
"name": "Child1",
"type": "Child",
"version": 5,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 405.3984375,
"y": 204.0078125
},
"size": {
"width": 94.765625,
"height": 116.015625
}
}
},
"input1": {
"typeName": "Object",
"expression": {
"type": "JavaScript",
"value": "\u0060Bar\u0060"
},
"memoryReference": {
"id": "22jW7xiYM0K30H99EDWztQ:input-0"
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "Output1"
}
}
}
],
"connections": [
{
"source": {
"activity": "WriteLine1",
"port": "Done"
},
"target": {
"activity": "22jW7xiYM0K30H99EDWztQ",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,138 @@
{
"id": "c5aa339e124f4486b14dbfdc133a45d1",
"definitionId": "8ad20b5ff9ee4ff59b8dfcfb6d4e29a0",
"name": "Parent2",
"createdAt": "2023-09-06T11:38:30.217265+00:00",
"version": 1,
"variables": [],
"inputs": [
{
"uiHint": "singleline",
"storageDriverType": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core",
"type": "Object",
"name": "Input1",
"displayName": "Input1",
"description": "",
"category": "",
"isArray": false
}
],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output1",
"description": "",
"isArray": false
}
],
"outcomes": [],
"customProperties": {},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"autoUpdateConsumingWorkflows": false
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "Flowchart1",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:45",
"NotFoundConnectionsKey": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"start": "WriteLine1",
"activities": [
{
"text": {
"typeName": "String",
"expression": {
"type": "JavaScript",
"value": "\u0022Parent: \u0022 \u002B getInput1();"
},
"memoryReference": {
"id": "3070bee4-8309-44e3-a805-a9ec7fdd7ac2"
}
},
"id": "WriteLine1",
"name": null,
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 160,
"y": 280
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
},
{
"workflowDefinitionId": "25b097966de245818e9a5c0d04f3323e",
"workflowDefinitionVersionId": "228c0150ab7b4745b038b950be574935",
"latestAvailablePublishedVersion": 5,
"latestAvailablePublishedVersionId": "228c0150ab7b4745b038b950be574935",
"id": "22jW7xiYM0K30H99EDWztQ",
"name": "Child1",
"type": "Child",
"version": 5,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 405.3984375,
"y": 204.0078125
},
"size": {
"width": 135.390625,
"height": 120
}
}
},
"input1": {
"typeName": "Object",
"expression": {
"type": "JavaScript",
"value": "getInput1()"
},
"memoryReference": {
"id": "22jW7xiYM0K30H99EDWztQ:input-0"
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "Output1"
}
}
}
],
"connections": [
{
"source": {
"activity": "WriteLine1",
"port": "Done"
},
"target": {
"activity": "22jW7xiYM0K30H99EDWztQ",
"port": "In"
}
}
]
}
}