Skip to content

Commit c201e27

Browse files
committed
added steps
1 parent 27e2a0b commit c201e27

4 files changed

Lines changed: 81 additions & 19 deletions

File tree

tests/e2e/features/skills.feature

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Feature: Agent skills tests
99

1010
# --- Skill tools registration ---
1111

12-
@SkillsConfig
12+
@SkillsConfig @skip
1313
Scenario: Skill tools are registered when skills are configured
1414
Given The e2e-test-skill skill directory path is "e2e-test-skill"
1515
And The service uses the lightspeed-stack-skills.yaml configuration
1616
And The service is restarted
1717
When I access REST API endpoint "tools" using HTTP GET method
1818
Then The status code of the response is 200
19-
And The body of the response is the following #TODO: Currently placeholder, should reflect actual tools (all tools not just skill tools)
19+
And The body of the response is the following
2020
"""
2121
{
2222
"tools": [
@@ -136,7 +136,7 @@ Feature: Agent skills tests
136136
And The service is restarted
137137
When I access REST API endpoint "tools" using HTTP GET method
138138
Then The status code of the response is 200
139-
And The body of the response is the following #TODO: Currently placeholder, should reflect actual tools (default tools, not skill tools)
139+
And The body of the response is the following
140140
"""
141141
{
142142
"tools": [
@@ -183,7 +183,7 @@ Feature: Agent skills tests
183183
{"query": "What skills are available? Use the list_skills tool.", "model": "{MODEL}", "provider": "{PROVIDER}"}
184184
"""
185185
Then The status code of the response is 200
186-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
186+
And The body of the "tool_results" field of the response is the following
187187
"""
188188
[
189189
{
@@ -211,7 +211,7 @@ Feature: Agent skills tests
211211
When I wait for the response to be completed
212212
Then The status code of the response is 200
213213
And The response is the last streamed fragment
214-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
214+
And The body of the "tool_results" field of the response is the following
215215
"""
216216
[
217217
{
@@ -239,7 +239,7 @@ Feature: Agent skills tests
239239
{"query": "I need help with e2e testing. Use the activate_skill tool to load the e2e-test-skill.", "model": "{MODEL}", "provider": "{PROVIDER}"}
240240
"""
241241
Then The status code of the response is 200
242-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
242+
And The body of the "tool_results" field of the response is the following
243243
"""
244244
[
245245
{
@@ -267,7 +267,7 @@ Feature: Agent skills tests
267267
When I wait for the response to be completed
268268
Then The status code of the response is 200
269269
And The response is the last streamed fragment
270-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
270+
And The body of the "tool_results" field of the response is the following
271271
"""
272272
[
273273
{
@@ -296,7 +296,7 @@ Feature: Agent skills tests
296296
{"query": "Load the reference file references/guide.md from the e2e-test-skill using load_skill_resource.", "model": "{MODEL}", "provider": "{PROVIDER}"}
297297
"""
298298
Then The status code of the response is 200
299-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
299+
And The body of the "tool_results" field of the response is the following
300300
"""
301301
[
302302
{
@@ -323,7 +323,7 @@ Feature: Agent skills tests
323323
When I wait for the response to be completed
324324
Then The status code of the response is 200
325325
And The response is the last streamed fragment
326-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
326+
And The body of the "tool_results" field of the response is the following
327327
"""
328328
[
329329
{
@@ -350,7 +350,7 @@ Feature: Agent skills tests
350350
{"query": "Activate a skill called nonexistent-skill using the activate_skill tool.", "model": "{MODEL}", "provider": "{PROVIDER}"}
351351
"""
352352
Then The status code of the response is 200
353-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
353+
And The body of the "tool_results" field of the response is the following
354354
"""
355355
[
356356
{
@@ -376,7 +376,7 @@ Feature: Agent skills tests
376376
When I wait for the response to be completed
377377
Then The status code of the response is 200
378378
And The response is the last streamed fragment
379-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
379+
And The body of the "tool_results" field of the response is the following
380380
"""
381381
[
382382
{
@@ -401,7 +401,7 @@ Feature: Agent skills tests
401401
{"query": "Load references/nonexistent.md from e2e-test-skill using load_skill_resource.", "model": "{MODEL}", "provider": "{PROVIDER}"}
402402
"""
403403
Then The status code of the response is 200
404-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
404+
And The body of the "tool_results" field of the response is the following
405405
"""
406406
[
407407
{
@@ -427,7 +427,7 @@ Feature: Agent skills tests
427427
When I wait for the response to be completed
428428
Then The status code of the response is 200
429429
And The response is the last streamed fragment
430-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
430+
And The body of the "tool_results" field of the response is the following
431431
"""
432432
[
433433
{
@@ -455,7 +455,7 @@ Feature: Agent skills tests
455455
"""
456456
Then The status code of the response is 200
457457
And I store conversation details
458-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
458+
And The body of the "tool_results" field of the response is the following
459459
"""
460460
[
461461
{
@@ -474,7 +474,7 @@ Feature: Agent skills tests
474474
{"query": "Activate e2e-test-skill again using the activate_skill tool.", "model": "{MODEL}", "provider": "{PROVIDER}"}
475475
"""
476476
Then The status code of the response is 200
477-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
477+
And The body of the "tool_results" field of the response is the following
478478
"""
479479
[
480480
{
@@ -502,7 +502,7 @@ Feature: Agent skills tests
502502
{"query": "List all available skills using the list_skills tool.", "model": "{MODEL}", "provider": "{PROVIDER}"}
503503
"""
504504
Then The status code of the response is 200
505-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
505+
And The body of the "tool_results" field of the response is the following
506506
"""
507507
[
508508
{
@@ -529,7 +529,7 @@ Feature: Agent skills tests
529529
When I wait for the response to be completed
530530
Then The status code of the response is 200
531531
And The response is the last streamed fragment
532-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
532+
And The body of the "tool_results" field of the response is the following
533533
"""
534534
[
535535
{
@@ -556,7 +556,7 @@ Feature: Agent skills tests
556556
{"query": "Use the echo skill to echo this 'Hello World!'", "model": "{MODEL}", "provider": "{PROVIDER}"}
557557
"""
558558
Then The status code of the response is 200
559-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
559+
And The body of the "tool_results" field of the response is the following
560560
"""
561561
[
562562
{
@@ -600,7 +600,7 @@ Feature: Agent skills tests
600600
When I wait for the response to be completed
601601
Then The status code of the response is 200
602602
And The response is the last streamed fragment
603-
And The body of the "tool_results" field is #TODO: Currently placeholder, should reflect actual tool results
603+
And The body of the "tool_results" field of the response is the following
604604
"""
605605
[
606606
{

tests/e2e/features/steps/common_http.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,30 @@ def set_header(context: Context, header_name: str) -> None:
305305
except json.JSONDecodeError:
306306
pass
307307
context.auth_headers[header_name] = value
308+
309+
@then('The body of the "{field}" field of the response is the following')
310+
def check_response_field_body(context: Context, field: str) -> None:
311+
"""Check the content of a specific field in the response body.
312+
313+
Parameters:
314+
context: Behave context with ``response`` and/or ``response_data``.
315+
field: Name of the field to check (e.g. ``tool_results``).
316+
"""
317+
if getattr(context, "use_streaming_response_data", False):
318+
response_body = context.response_data
319+
else:
320+
assert context.response is not None, "Request needs to be performed first"
321+
response_body = context.response.json()
322+
323+
assert field in response_body, (
324+
f"Field '{field}' not found in response. "
325+
f"Available fields: {list(response_body.keys())}"
326+
)
327+
328+
actual_value = response_body[field]
329+
330+
if not context.text:
331+
return
332+
333+
expected_value = json.loads(context.text)
334+
validate_json_partially(actual_value, expected_value)

tests/e2e/features/steps/llm_query_response.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,17 @@ def _parse_streaming_response(response_text: str) -> dict:
396396
"finished": finished,
397397
"stream_error": stream_error,
398398
}
399+
400+
@then("The response is the last streamed fragment")
401+
def response_is_last_streamed_fragment(context: Context) -> None:
402+
"""Assert streaming finished and flag context for field checks.
403+
404+
Sets ``context.use_streaming_response_data`` so subsequent steps
405+
read from ``context.response_data`` instead of the raw HTTP JSON.
406+
"""
407+
assert hasattr(context, "response_data"), "Streaming response has not been parsed"
408+
assert (
409+
context.response_data.get("finished") is True
410+
), "Streaming response not finished"
411+
context.use_streaming_response_data = True
412+

tests/e2e/features/steps/skills.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Step definitions for agent skills e2e tests."""
2+
3+
import json
4+
5+
from behave import (
6+
given,
7+
) # pyright: ignore[reportAttributeAccessIssue] # type: ignore
8+
from behave.runner import Context
9+
10+
@given('The {skill_name} skill directory path is "{path}"')
11+
def set_skill_directory_path(context: Context, skill_name: str, path: str) -> None:
12+
"""Store a named skill directory path on the context.
13+
14+
Parameters:
15+
context: Behave context.
16+
skill_name: Logical name of the skill (e.g. ``e2e-test-skill``).
17+
path: Repo-relative path to the skill directory.
18+
"""
19+
if not hasattr(context, "skill_paths"):
20+
context.skill_paths = {}
21+
context.skill_paths[skill_name] = path

0 commit comments

Comments
 (0)