Skip to content

Commit 8cff3ef

Browse files
authored
Merge pull request #211 from UiPath/feature/add_init_flow_test
tests: add init flow testcase
2 parents f34b8d2 + fab8a27 commit 8cff3ef

File tree

19 files changed

+102
-470
lines changed

19 files changed

+102
-470
lines changed

testcases/README.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

testcases/company-research-agent/.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

testcases/company-research-agent/agent.mermaid

Lines changed: 0 additions & 23 deletions
This file was deleted.

testcases/company-research-agent/run.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
#!/bin/bash
22
cd /app/testcases/company-research-agent
33

4-
# Sync dependencies for this specific testcase
54
echo "Syncing dependencies..."
65
uv sync
76

8-
# Authenticate with UiPath
97
echo "Authenticating with UiPath..."
108
uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
119

12-
# Pack the agent
10+
echo "Running uipath init..."
11+
uv run uipath init
12+
1313
echo "Packing agent..."
1414
uv run uipath pack
1515

16-
# Run the agent
1716
echo "Input from input.json file"
1817
uv run uipath run agent --file input.json
1918

20-
# Print the output file
2119
source /app/testcases/common/print_output.sh
2220
print_uipath_output
2321

24-
# Validate output
2522
echo "Validating output..."
2623
python src/assert.py || { echo "Validation failed!"; exit 1; }
2724

testcases/company-research-agent/uipath.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

testcases/init-flow/input.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"topic": "uipath"
3+
}

testcases/init-flow/pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[project]
2+
name = "agent"
3+
version = "0.0.1"
4+
description = "agent"
5+
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
6+
dependencies = [
7+
"langchain-anthropic>=0.3.8",
8+
"uipath-langchain",
9+
]
10+
requires-python = ">=3.10"
11+
12+
[tool.uv.sources]
13+
uipath-langchain = { path = "../../", editable = true }

testcases/init-flow/run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
cd /app/testcases/init-flow
3+
4+
echo "Syncing dependencies..."
5+
uv sync
6+
7+
echo "Backing up pyproject.toml..."
8+
cp pyproject.toml pyproject-overwrite.toml
9+
10+
echo "Creating new UiPath agent..."
11+
uv run uipath new agent
12+
13+
# uipath new overwrites pyproject.toml, so we need to copy it back
14+
echo "Restoring pyproject.toml..."
15+
cp pyproject-overwrite.toml pyproject.toml
16+
uv sync
17+
18+
echo "Authenticating with UiPath..."
19+
uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
20+
21+
echo "Initializing UiPath..."
22+
uv run uipath init
23+
24+
echo "Packing agent..."
25+
uv run uipath pack
26+
27+
echo "Input from input.json file"
28+
uv run uipath run agent --file input.json
29+
30+
source /app/testcases/common/print_output.sh
31+
print_uipath_output
32+
33+
echo "Validating output..."
34+
python src/assert.py || { echo "Validation failed!"; exit 1; }
35+
36+
echo "Testcase completed successfully."

testcases/init-flow/src/assert.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
import json
3+
4+
print("Checking init-flow output...")
5+
6+
# Check NuGet package
7+
uipath_dir = ".uipath"
8+
assert os.path.exists(uipath_dir), "NuGet package directory (.uipath) not found"
9+
10+
nupkg_files = [f for f in os.listdir(uipath_dir) if f.endswith('.nupkg')]
11+
assert nupkg_files, "NuGet package file (.nupkg) not found in .uipath directory"
12+
13+
print(f"NuGet package found: {nupkg_files[0]}")
14+
15+
# Check agent output file
16+
output_file = "__uipath/output.json"
17+
assert os.path.isfile(output_file), "Agent output file not found"
18+
19+
print("Agent output file found")
20+
21+
# Check status and required fields
22+
with open(output_file, 'r', encoding='utf-8') as f:
23+
output_data = json.load(f)
24+
25+
# Check status
26+
status = output_data.get("status")
27+
assert status == "successful", f"Agent execution failed with status: {status}"
28+
29+
print("Agent execution status: successful")
30+
31+
# Check required fields for simple local MCP agent
32+
assert "output" in output_data, "Missing 'output' field in agent response"
33+
34+
output_content = output_data["output"]
35+
assert "report" in output_content, "Missing 'report' field in output"
36+
37+
report = output_content["report"]
38+
assert report and isinstance(report, str), "Report field is empty or not a string"
39+
40+
print("Required fields validation passed")

testcases/simple-local-mcp/.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)