testzeus-cli 0.0.22__tar.gz → 0.0.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/PKG-INFO +1 -1
  2. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/pyproject.toml +1 -1
  3. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/device_pool.py +1 -1
  4. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/environments.py +4 -1
  5. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/extensions.py +4 -1
  6. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/hypermind_code_blocks.py +4 -1
  7. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/knowledge_bases.py +4 -1
  8. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/notification_channels.py +1 -1
  9. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/tags.py +4 -1
  10. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_data.py +4 -1
  11. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_report_schedules.py +4 -1
  12. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_run_groups.py +3 -1
  13. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_runs.py +159 -9
  14. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_node_runs.py +1 -1
  15. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_runs.py +4 -1
  16. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_schedules.py +1 -1
  17. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suites.py +9 -2
  18. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests.py +9 -2
  19. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests_ai_generator.py +1 -1
  20. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/user_integrations.py +6 -2
  21. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/formatters.py +61 -51
  22. testzeus_cli-0.0.23/testzeus_cli/utils/links.py +49 -0
  23. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/LICENSE +0 -0
  24. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/README.md +0 -0
  25. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/__init__.py +0 -0
  26. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/auth.py +0 -0
  27. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/cli.py +0 -0
  28. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/__init__.py +0 -0
  29. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/daemon.py +0 -0
  30. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests_authoring.py +0 -0
  31. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/config.py +0 -0
  32. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/__init__.py +0 -0
  33. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/auth.py +0 -0
  34. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/client.py +0 -0
  35. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/files.py +0 -0
  36. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/profile.py +0 -0
  37. {testzeus_cli-0.0.22 → testzeus_cli-0.0.23}/testzeus_cli/utils/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testzeus-cli
3
- Version: 0.0.22
3
+ Version: 0.0.23
4
4
  Summary: Command-line interface for TestZeus testing platform
5
5
  License-File: LICENSE
6
6
  Author: Shriyansh Agnihotri
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "testzeus-cli"
7
- version = "0.0.22"
7
+ version = "0.0.23"
8
8
  description = "Command-line interface for TestZeus testing platform"
9
9
  authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
10
10
  readme = "README.md"
@@ -27,7 +27,7 @@ def device_pool_group():
27
27
  @click.option(
28
28
  "--filters", "-f", multiple=True, help="Filter results (format: key=value, e.g. platform=android)"
29
29
  )
30
- @click.option("--sort", help="Sort by field (e.g. device_name, -platform_version)")
30
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field (e.g. device_name, -platform_version)")
31
31
  @click.option("--page", default=1, help="Page number")
32
32
  @click.option("--per-page", default=50, help="Items per page")
33
33
  @click.pass_context
@@ -15,6 +15,7 @@ from testzeus_cli.utils.formatters import format_output, print_message
15
15
  from testzeus_cli.utils.auth import initialize_client_with_token
16
16
  from testzeus_cli.utils.validators import parse_key_value_pairs, validate_tenant_ownership
17
17
  from testzeus_cli.utils.files import match_stored_file
18
+ from testzeus_cli.utils.links import print_platform_link
18
19
 
19
20
  console = Console()
20
21
 
@@ -221,7 +222,7 @@ def create(ctx, name, device_type, status, data, data_file, tags, connected_envi
221
222
  @click.option(
222
223
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
223
224
  )
224
- @click.option("--sort", help="Sort by field")
225
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
225
226
  @click.option("--expand", help="Expand related entities")
226
227
  @click.pass_context
227
228
  def list(ctx, filters, sort, expand):
@@ -244,6 +245,7 @@ def list(ctx, filters, sort, expand):
244
245
 
245
246
  try:
246
247
  result = asyncio.run(_run())
248
+ print_platform_link(ctx, "environments")
247
249
  format_output(result, ctx.obj["FORMAT"])
248
250
  except Exception as e:
249
251
  print_message(f"[red]Error listing environments: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -303,6 +305,7 @@ def get(ctx, env_id, expand):
303
305
 
304
306
  try:
305
307
  result = asyncio.run(_run())
308
+ print_platform_link(ctx, "environments")
306
309
  format_output(result, ctx.obj["FORMAT"])
307
310
  except Exception as e:
308
311
  print_message(f"[red]Error getting environment: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -13,6 +13,7 @@ from testzeus_cli.config import get_client_config
13
13
  from testzeus_cli.utils.formatters import format_output, print_message
14
14
  from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
15
15
  from testzeus_cli.utils.auth import initialize_client_with_token
16
+ from testzeus_cli.utils.links import print_platform_link
16
17
 
17
18
  console = Console()
18
19
 
@@ -27,7 +28,7 @@ def extensions_group():
27
28
  @click.option(
28
29
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
29
30
  )
30
- @click.option("--sort", help="Sort by field")
31
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
31
32
  @click.option("--expand", help="Expand related entities (comma-separated)")
32
33
  @click.option("--page", default=1, help="Page number")
33
34
  @click.option("--per-page", default=50, help="Items per page")
@@ -55,6 +56,7 @@ def list_extensions(ctx, filters, sort, expand, page, per_page):
55
56
  return extensions
56
57
 
57
58
  result = asyncio.run(_run())
59
+ print_platform_link(ctx, "training-runs")
58
60
  format_output(result, ctx.obj["FORMAT"])
59
61
 
60
62
 
@@ -85,6 +87,7 @@ def get_extension(ctx, extension_id, expand):
85
87
  return extension.data
86
88
 
87
89
  result = asyncio.run(_run())
90
+ print_platform_link(ctx, "training-runs")
88
91
  format_output(result, ctx.obj["FORMAT"])
89
92
 
90
93
 
@@ -13,6 +13,7 @@ from testzeus_cli.utils.formatters import format_output, print_message
13
13
  from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
14
14
  from testzeus_cli.utils.auth import initialize_client_with_token
15
15
  from testzeus_cli.utils.files import match_stored_file
16
+ from testzeus_cli.utils.links import print_platform_link
16
17
  from pocketbase.client import FileUpload
17
18
 
18
19
  console = Console()
@@ -28,7 +29,7 @@ def hypermind_code_blocks_group():
28
29
  @click.option(
29
30
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
30
31
  )
31
- @click.option("--sort", help="Sort by field")
32
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
32
33
  @click.option("--expand", help="Expand related entities")
33
34
  @click.pass_context
34
35
  def list_hypermind_code_blocks(ctx, filters, sort, expand):
@@ -54,6 +55,7 @@ def list_hypermind_code_blocks(ctx, filters, sort, expand):
54
55
  return code_blocks
55
56
 
56
57
  result = asyncio.run(_run())
58
+ print_platform_link(ctx, "hypermind-code-blocks")
57
59
  format_output(result, ctx.obj["FORMAT"])
58
60
 
59
61
 
@@ -83,6 +85,7 @@ def get_hypermind_code_block(ctx, code_block_id, expand):
83
85
  return code_block.data
84
86
 
85
87
  result = asyncio.run(_run())
88
+ print_platform_link(ctx, "hypermind-code-blocks")
86
89
  format_output(result, ctx.obj["FORMAT"])
87
90
 
88
91
 
@@ -10,6 +10,7 @@ from testzeus_cli.config import get_client_config
10
10
  from testzeus_cli.utils.formatters import format_output, print_message
11
11
  from testzeus_cli.utils.auth import initialize_client_with_token
12
12
  from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
13
+ from testzeus_cli.utils.links import print_platform_link
13
14
 
14
15
  console = Console()
15
16
 
@@ -24,7 +25,7 @@ def knowledge_bases_group():
24
25
  @click.option(
25
26
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
26
27
  )
27
- @click.option("--sort", help="Sort by field")
28
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
28
29
  @click.option("--expand", help="Expand related entities")
29
30
  @click.pass_context
30
31
  def list(ctx, filters, sort, expand):
@@ -51,6 +52,7 @@ def list(ctx, filters, sort, expand):
51
52
 
52
53
  try:
53
54
  result = asyncio.run(_run())
55
+ print_platform_link(ctx, "integrations/knowledge-base")
54
56
  format_output(result, ctx.obj["FORMAT"])
55
57
  except Exception as e:
56
58
  print_message(f"[red]Error listing knowledge bases: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -81,6 +83,7 @@ def get_kb(ctx, kb_id, expand):
81
83
 
82
84
  try:
83
85
  result = asyncio.run(_run())
86
+ print_platform_link(ctx, "integrations/knowledge-base")
84
87
  format_output(result, ctx.obj["FORMAT"])
85
88
  except Exception as e:
86
89
  print_message(f"[red]Error getting knowledge base: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -26,7 +26,7 @@ def notification_channels_group():
26
26
  @click.option(
27
27
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
28
28
  )
29
- @click.option("--sort", help="Sort by field")
29
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
30
30
  @click.option("--expand", help="Expand related entities (comma-separated)")
31
31
  @click.option("--page", default=1, help="Page number")
32
32
  @click.option("--per-page", default=50, help="Items per page")
@@ -10,6 +10,7 @@ from testzeus_cli.config import get_client_config
10
10
  from testzeus_cli.utils.formatters import format_output, print_message
11
11
  from testzeus_cli.utils.auth import initialize_client_with_token
12
12
  from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id, validate_tenant_ownership
13
+ from testzeus_cli.utils.links import print_platform_link
13
14
 
14
15
  console = Console()
15
16
 
@@ -59,7 +60,7 @@ def create(ctx, name, value):
59
60
  @click.option(
60
61
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
61
62
  )
62
- @click.option("--sort", help="Sort by field")
63
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
63
64
  @click.option("--expand", help="Expand related entities")
64
65
  @click.pass_context
65
66
  def list(ctx, filters, sort, expand):
@@ -86,6 +87,7 @@ def list(ctx, filters, sort, expand):
86
87
 
87
88
  try:
88
89
  result = asyncio.run(_run())
90
+ print_platform_link(ctx, "tags")
89
91
  format_output(result, ctx.obj["FORMAT"])
90
92
  except Exception as e:
91
93
  print_message(f"[red]Error listing tags: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -116,6 +118,7 @@ def get_tags(ctx, tag_id, expand):
116
118
 
117
119
  try:
118
120
  result = asyncio.run(_run())
121
+ print_platform_link(ctx, "tags")
119
122
  format_output(result, ctx.obj["FORMAT"])
120
123
  except Exception as e:
121
124
  print_message(f"[red]Error getting tag: {str(e)}[/red]", ctx.obj["FORMAT"])
@@ -15,6 +15,7 @@ from testzeus_cli.utils.formatters import format_output, print_message
15
15
  from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
16
16
  from testzeus_cli.utils.auth import initialize_client_with_token
17
17
  from testzeus_cli.utils.files import match_stored_file
18
+ from testzeus_cli.utils.links import print_platform_link
18
19
  from pocketbase.client import FileUpload
19
20
 
20
21
  console = Console()
@@ -60,7 +61,7 @@ def test_data_group():
60
61
  @click.option(
61
62
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
62
63
  )
63
- @click.option("--sort", help="Sort by field")
64
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
64
65
  @click.option("--expand", help="Expand related entities")
65
66
  @click.pass_context
66
67
  def list_test_data(ctx, filters, sort, expand):
@@ -86,6 +87,7 @@ def list_test_data(ctx, filters, sort, expand):
86
87
  return test_data
87
88
 
88
89
  result = asyncio.run(_run())
90
+ print_platform_link(ctx, "test-data")
89
91
  format_output(result, ctx.obj["FORMAT"])
90
92
 
91
93
 
@@ -115,6 +117,7 @@ def get_test_data(ctx, test_data_id, expand):
115
117
  return test_data.data
116
118
 
117
119
  result = asyncio.run(_run())
120
+ print_platform_link(ctx, "test-data")
118
121
  format_output(result, ctx.obj["FORMAT"])
119
122
 
120
123
 
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
12
12
  from testzeus_cli.utils.formatters import format_output, print_message
13
13
  from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
14
14
  from testzeus_cli.utils.auth import initialize_client_with_token
15
+ from testzeus_cli.utils.links import print_platform_link
15
16
 
16
17
  console = Console()
17
18
 
@@ -26,7 +27,7 @@ def test_report_schedules_group():
26
27
  @click.option(
27
28
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
28
29
  )
29
- @click.option("--sort", help="Sort by field")
30
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
30
31
  @click.option("--expand", help="Expand related entities (comma-separated)")
31
32
  @click.option("--page", default=1, help="Page number")
32
33
  @click.option("--per-page", default=50, help="Items per page")
@@ -54,6 +55,7 @@ def list_schedules(ctx, filters, sort, expand, page, per_page):
54
55
  return schedules
55
56
 
56
57
  result = asyncio.run(_run())
58
+ print_platform_link(ctx, "report-scheduler")
57
59
  format_output(result, ctx.obj["FORMAT"])
58
60
 
59
61
 
@@ -84,6 +86,7 @@ def get_schedule(ctx, schedule_id, expand):
84
86
  return schedule.data
85
87
 
86
88
  result = asyncio.run(_run())
89
+ print_platform_link(ctx, "report-scheduler")
87
90
  format_output(result, ctx.obj["FORMAT"])
88
91
 
89
92
 
@@ -13,6 +13,7 @@ from testzeus_cli.config import get_client_config
13
13
  from testzeus_cli.utils.formatters import format_output, print_message
14
14
  from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
15
15
  from testzeus_cli.utils.auth import initialize_client_with_token
16
+ from testzeus_cli.utils.links import print_platform_link
16
17
 
17
18
  console = Console()
18
19
 
@@ -27,7 +28,7 @@ def test_run_groups_group():
27
28
  @click.option(
28
29
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
29
30
  )
30
- @click.option("--sort", help="Sort by field")
31
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
31
32
  @click.option("--expand", help="Expand related entities (comma-separated)")
32
33
  @click.option("--page", default=1, help="Page number")
33
34
  @click.option("--per-page", default=50, help="Items per page")
@@ -377,6 +378,7 @@ def download_test_run_group_report(ctx, test_run_group_id, output_dir, report_fo
377
378
 
378
379
  try:
379
380
  result = asyncio.run(_run())
381
+ print_platform_link(ctx, "reports")
380
382
  if result["success"]:
381
383
  print_message(
382
384
  f"[green]Report downloaded successfully to: {result['file_path']}[/green]",
@@ -9,13 +9,21 @@ from pathlib import Path
9
9
  import click
10
10
  from rich.console import Console
11
11
  from rich.progress import Progress
12
+ from rich.table import Table
12
13
  from datetime import datetime
13
14
 
14
15
  from testzeus_sdk import TestZeusClient
15
16
  from testzeus_cli.config import get_client_config
16
- from testzeus_cli.utils.formatters import format_output, print_message
17
+ from testzeus_cli.utils.formatters import (
18
+ format_dict_as_table,
19
+ format_list_as_table,
20
+ format_output,
21
+ format_value_for_display,
22
+ print_message,
23
+ )
17
24
  from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
18
25
  from testzeus_cli.utils.auth import initialize_client_with_token
26
+ from testzeus_cli.utils.links import print_platform_link
19
27
 
20
28
  console = Console()
21
29
  logger = logging.getLogger("testzeus_cli.commands.test_runs")
@@ -35,7 +43,7 @@ def test_runs_group():
35
43
  @click.option(
36
44
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
37
45
  )
38
- @click.option("--sort", help="Sort by field")
46
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
39
47
  @click.option("--expand", help="Expand related entities")
40
48
  @click.option("--page", default=1, type=int, show_default=True, help="Page number")
41
49
  @click.option("--per-page", default=100, type=int, show_default=True, help="Items per page")
@@ -74,7 +82,12 @@ def list_test_runs(ctx, filters, sort, expand, page, per_page):
74
82
  return test_runs
75
83
 
76
84
  result = asyncio.run(_run())
77
- format_output(result, ctx.obj["FORMAT"])
85
+ print_platform_link(ctx, "test-runs")
86
+ format_output(
87
+ result,
88
+ ctx.obj["FORMAT"],
89
+ columns=["id", "name", "status", "created", "updated", "test_status"],
90
+ )
78
91
 
79
92
 
80
93
  @test_runs_group.command(name="get")
@@ -105,9 +118,79 @@ def get_test_run(ctx, test_run_id, expand):
105
118
  return test_run.data
106
119
 
107
120
  result = asyncio.run(_run())
121
+ print_platform_link(ctx, f"test-runs/{test_run_id}")
108
122
  format_output(result, ctx.obj["FORMAT"])
109
123
 
110
124
 
125
+ _EXPANDED_RUN_FIELDS = [
126
+ "id", "name", "status", "test_status", "executor", "testing_type",
127
+ "execution_mode", "ctrf_status", "is_live_trigger", "test",
128
+ "test_feature", "test_data", "test_params", "tags", "environment",
129
+ "hypermind_code_blocks", "outputs", "test_run_group", "test_suite_run",
130
+ "start_time", "end_time", "created", "updated",
131
+ ]
132
+
133
+ _EXPANDED_DASH_FIELDS = [
134
+ "id", "status", "test_status", "executor", "ctrf_status", "token_usage",
135
+ "heal_recommended", "sdet_failure_reason",
136
+ "start_time", "end_time",
137
+ ]
138
+
139
+
140
+ def _render_expanded_test_run(expanded: dict) -> None:
141
+ """Render the expanded test run tree as sectioned tables."""
142
+
143
+ def important(record, fields):
144
+ return {k: record.get(k) for k in fields if record.get(k) not in (None, "", [], {})}
145
+
146
+ run = expanded.get("test_run") or {}
147
+ console.print("\n[bold cyan]Test Run[/bold cyan]")
148
+ format_dict_as_table({k: run.get(k) for k in _EXPANDED_RUN_FIELDS})
149
+
150
+ for dash in expanded.get("test_run_dashs") or []:
151
+ console.print("\n[bold cyan]Execution[/bold cyan]")
152
+ format_dict_as_table(important(dash, _EXPANDED_DASH_FIELDS))
153
+
154
+ outputs = expanded.get("test_run_dash_outputs") or []
155
+ for index, output in enumerate(outputs, start=1):
156
+ console.print(f"\n[bold cyan]Output {index}/{len(outputs)}[/bold cyan]")
157
+ format_dict_as_table(
158
+ {k: output.get(k) for k in ("id", "name", "status", "execution_plan", "created", "updated")}
159
+ )
160
+
161
+ steps = sorted(expanded.get("test_run_dash_output_steps") or [], key=lambda s: s.get("created") or "")
162
+ if steps:
163
+ console.print(f"\n[bold cyan]Steps ({len(steps)})[/bold cyan]")
164
+ steps_table = Table(show_lines=True)
165
+ steps_table.add_column("ID", min_width=15, no_wrap=True)
166
+ steps_table.add_column("Name", max_width=30, overflow="fold")
167
+ steps_table.add_column("Status", max_width=10, justify="center")
168
+ steps_table.add_column("Helper", max_width=8)
169
+ steps_table.add_column("Assert", max_width=6, justify="center")
170
+ steps_table.add_column("Passed", max_width=6, justify="center")
171
+ steps_table.add_column("Assert Summary", overflow="fold")
172
+ steps_table.add_column("Step Result", overflow="fold")
173
+ steps_table.add_column("Final Response", overflow="fold")
174
+ for step in steps:
175
+ steps_table.add_row(
176
+ str(step.get("id") or ""),
177
+ str(step.get("name") or ""),
178
+ str(step.get("status") or ""),
179
+ str(step.get("execution_helper") or ""),
180
+ str(step.get("is_assert", "")),
181
+ str(step.get("is_passed", "")),
182
+ format_value_for_display(step.get("assert_summary") or ""),
183
+ format_value_for_display(step.get("step_result") or ""),
184
+ format_value_for_display(step.get("final_response") or ""),
185
+ )
186
+ console.print(steps_table)
187
+
188
+ attachments = expanded.get("test_run_dash_outputs_attachments") or []
189
+ if attachments:
190
+ console.print(f"\n[bold cyan]Attachments ({len(attachments)})[/bold cyan]")
191
+ format_list_as_table(attachments, columns=["id", "name", "file_type", "created"])
192
+
193
+
111
194
  @test_runs_group.command(name="get-expanded")
112
195
  @click.argument("test_run_id")
113
196
  @click.pass_context
@@ -135,7 +218,11 @@ def get_expanded_test_run(ctx, test_run_id):
135
218
  return expanded_test_run
136
219
 
137
220
  result = asyncio.run(_run())
138
- format_output(result, ctx.obj["FORMAT"])
221
+ print_platform_link(ctx, f"test-runs/{test_run_id}")
222
+ if ctx.obj["FORMAT"] == "table" and isinstance(result, dict) and "test_run" in result:
223
+ _render_expanded_test_run(result)
224
+ else:
225
+ format_output(result, ctx.obj["FORMAT"])
139
226
 
140
227
 
141
228
  @test_runs_group.command(name="watch")
@@ -206,6 +293,51 @@ def watch_test_run(ctx, test_run_id, interval):
206
293
  exit(1)
207
294
 
208
295
 
296
+ @test_runs_group.command(name="download-attachment")
297
+ @click.argument("attachment_id")
298
+ @click.option(
299
+ "--output-dir", default=".", show_default=True, help="Directory to save the attachment"
300
+ )
301
+ @click.pass_context
302
+ def download_attachment(ctx, attachment_id, output_dir):
303
+ """Download a specific attachment by its ID (see get-expanded for IDs)"""
304
+
305
+ async def _run():
306
+ config, token, _, _ = get_client_config(
307
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
308
+ )
309
+ client = TestZeusClient(**config)
310
+
311
+ attachment_id_validated = validate_id(attachment_id, "attachment")
312
+
313
+ output_path = Path(output_dir)
314
+ output_path.mkdir(parents=True, exist_ok=True)
315
+
316
+ async with client:
317
+ if token:
318
+ initialize_client_with_token(client, token)
319
+ else:
320
+ await client.ensure_authenticated()
321
+
322
+ return await client.test_run_dash_outputs_attachments.download_attachment(
323
+ attachment_id_validated, str(output_path)
324
+ )
325
+
326
+ try:
327
+ result = asyncio.run(_run())
328
+
329
+ if not result:
330
+ print_message(
331
+ f"[yellow]No file found for attachment {attachment_id}[/yellow]", ctx.obj["FORMAT"]
332
+ )
333
+ exit(1)
334
+
335
+ print_message(f"[green]Downloaded attachment to {result}[/green]", ctx.obj["FORMAT"])
336
+ except Exception as e:
337
+ print_message(f"[red]Failed to download attachment:[/red] {str(e)}", ctx.obj["FORMAT"])
338
+ exit(1)
339
+
340
+
209
341
  @test_runs_group.command(name="download-attachments")
210
342
  @click.argument("test_run_id")
211
343
  @click.option(
@@ -234,11 +366,27 @@ def download_attachments(ctx, test_run_id, output_dir):
234
366
  else:
235
367
  await client.ensure_authenticated()
236
368
 
237
- # Download all attachments for the test run using positional parameters
238
- result = await client.test_runs.download_all_attachments(
239
- test_run_id_validated, str(output_path)
240
- )
241
- return result
369
+ try:
370
+ # Download all attachments for the test run using positional parameters
371
+ result = await client.test_runs.download_all_attachments(
372
+ test_run_id_validated, str(output_path)
373
+ )
374
+ return result
375
+ except Exception:
376
+ # A common mix-up: passing an attachment ID to this command.
377
+ # If the ID resolves to an attachment, point at the right command.
378
+ try:
379
+ attachment = await client.test_run_dash_outputs_attachments.get_one(
380
+ test_run_id_validated
381
+ )
382
+ except Exception:
383
+ attachment = None
384
+ if attachment:
385
+ raise click.UsageError(
386
+ f"'{test_run_id}' is an attachment ID, not a test run ID. "
387
+ f"Use: testzeus test-runs download-attachment {test_run_id}"
388
+ )
389
+ raise
242
390
 
243
391
  try:
244
392
  result = asyncio.run(_run())
@@ -254,6 +402,8 @@ def download_attachments(ctx, test_run_id, output_dir):
254
402
  )
255
403
  for attachment in result:
256
404
  print_message(f"- {attachment}", ctx.obj["FORMAT"])
405
+ except click.UsageError:
406
+ raise
257
407
  except Exception as e:
258
408
  if ctx.obj.get("VERBOSE"):
259
409
  print_message("[red]Failed to download attachments:[/red]", ctx.obj["FORMAT"])
@@ -21,7 +21,7 @@ def test_suite_node_runs_group():
21
21
 
22
22
  @test_suite_node_runs_group.command(name="list")
23
23
  @click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
24
- @click.option("--sort", help="Sort by field")
24
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
25
25
  @click.option("--expand", help="Expand related entities")
26
26
  @click.option("--page", default=1, help="Page number")
27
27
  @click.option("--per-page", default=50, help="Items per page")
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
12
12
  from testzeus_cli.utils.auth import initialize_client_with_token
13
13
  from testzeus_cli.utils.formatters import format_output, print_message
14
14
  from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
15
+ from testzeus_cli.utils.links import print_platform_link
15
16
 
16
17
 
17
18
  def _parse_json_value(raw_value: str, option_name: str):
@@ -29,7 +30,7 @@ def test_suite_runs_group():
29
30
 
30
31
  @test_suite_runs_group.command(name="list")
31
32
  @click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
32
- @click.option("--sort", help="Sort by field")
33
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
33
34
  @click.option("--expand", help="Expand related entities")
34
35
  @click.option("--page", default=1, help="Page number")
35
36
  @click.option("--per-page", default=50, help="Items per page")
@@ -52,6 +53,7 @@ def list_test_suite_runs(ctx, filters, sort, expand, page, per_page):
52
53
  expand=expand, sort=sort, filters=filter_dict, page=page, per_page=per_page
53
54
  )
54
55
 
56
+ print_platform_link(ctx, "test-suite-runs")
55
57
  format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
56
58
 
57
59
 
@@ -76,6 +78,7 @@ def get_test_suite_run(ctx, suite_run_id, expand):
76
78
  run = await client.test_suite_runs.get_one(suite_run_id_validated, expand=expand)
77
79
  return run.data
78
80
 
81
+ print_platform_link(ctx, "test-suite-runs")
79
82
  format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
80
83
 
81
84
 
@@ -29,7 +29,7 @@ def test_suite_schedules_group():
29
29
 
30
30
  @test_suite_schedules_group.command(name="list")
31
31
  @click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
32
- @click.option("--sort", help="Sort by field")
32
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
33
33
  @click.option("--expand", help="Expand related entities")
34
34
  @click.option("--page", default=1, help="Page number")
35
35
  @click.option("--per-page", default=50, help="Items per page")
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
12
12
  from testzeus_cli.utils.auth import initialize_client_with_token
13
13
  from testzeus_cli.utils.formatters import format_output, print_message
14
14
  from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
15
+ from testzeus_cli.utils.links import print_platform_link
15
16
 
16
17
 
17
18
  def _parse_json_value(raw_value: str, option_name: str):
@@ -29,7 +30,7 @@ def test_suites_group():
29
30
 
30
31
  @test_suites_group.command(name="list")
31
32
  @click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
32
- @click.option("--sort", help="Sort by field")
33
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
33
34
  @click.option("--expand", help="Expand related entities")
34
35
  @click.option("--page", default=1, help="Page number")
35
36
  @click.option("--per-page", default=50, help="Items per page")
@@ -56,7 +57,12 @@ def list_test_suites(ctx, filters, sort, expand, page, per_page):
56
57
  per_page=per_page,
57
58
  )
58
59
 
59
- format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
60
+ print_platform_link(ctx, "test-suites")
61
+ format_output(
62
+ asyncio.run(_run()),
63
+ ctx.obj["FORMAT"],
64
+ columns=["id", "name", "status", "created", "updated", "tests"],
65
+ )
60
66
 
61
67
 
62
68
  @test_suites_group.command(name="get")
@@ -80,6 +86,7 @@ def get_test_suite(ctx, suite_id, expand):
80
86
  suite = await client.test_suites.get_one(suite_id_validated, expand=expand)
81
87
  return suite.data
82
88
 
89
+ print_platform_link(ctx, "test-suites")
83
90
  format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
84
91
 
85
92
 
@@ -14,6 +14,7 @@ from testzeus_cli.utils.formatters import format_output, print_message
14
14
  from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
15
15
  from testzeus_cli.utils.client import run_client_operation
16
16
  from testzeus_cli.utils.auth import initialize_client_with_token
17
+ from testzeus_cli.utils.links import print_platform_link
17
18
 
18
19
  console = Console()
19
20
 
@@ -28,7 +29,7 @@ def tests_group():
28
29
  @click.option(
29
30
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
30
31
  )
31
- @click.option("--sort", help="Sort by field")
32
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
32
33
  @click.option("--expand", help="Expand related entities")
33
34
  @click.pass_context
34
35
  def list_tests(ctx, filters, sort, expand):
@@ -42,7 +43,12 @@ def list_tests(ctx, filters, sort, expand):
42
43
  )
43
44
 
44
45
  result = run_client_operation(ctx, _list_tests)
45
- format_output(result, ctx.obj["FORMAT"])
46
+ print_platform_link(ctx, "tests")
47
+ format_output(
48
+ result,
49
+ ctx.obj["FORMAT"],
50
+ columns=["id", "name", "created", "updated", "modified_by", "environment", "test_data"],
51
+ )
46
52
 
47
53
 
48
54
  @tests_group.command(name="get")
@@ -71,6 +77,7 @@ def get_test(ctx, test_id, expand):
71
77
  return test.data
72
78
 
73
79
  result = asyncio.run(_run())
80
+ print_platform_link(ctx, "tests")
74
81
  format_output(result, ctx.obj["FORMAT"])
75
82
 
76
83
 
@@ -27,7 +27,7 @@ def tests_ai_generator_group():
27
27
  @click.option(
28
28
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
29
29
  )
30
- @click.option("--sort", help="Sort by field")
30
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
31
31
  @click.option("--expand", help="Expand related entities (comma-separated)")
32
32
  @click.option("--page", default=1, help="Page number")
33
33
  @click.option("--per-page", default=50, help="Items per page")
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
12
12
  from testzeus_cli.utils.formatters import format_output, print_message
13
13
  from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
14
14
  from testzeus_cli.utils.auth import initialize_client_with_token
15
+ from testzeus_cli.utils.links import print_platform_link
15
16
 
16
17
  console = Console()
17
18
 
@@ -26,7 +27,7 @@ def user_integrations_group():
26
27
  @click.option(
27
28
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
28
29
  )
29
- @click.option("--sort", help="Sort by field")
30
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
30
31
  @click.option("--expand", help="Expand related entities")
31
32
  @click.pass_context
32
33
  def list_user_integrations(ctx, filters, sort, expand):
@@ -52,6 +53,7 @@ def list_user_integrations(ctx, filters, sort, expand):
52
53
  return integrations
53
54
 
54
55
  result = asyncio.run(_run())
56
+ print_platform_link(ctx, "integrations/connections")
55
57
  format_output(result, ctx.obj["FORMAT"])
56
58
 
57
59
 
@@ -81,6 +83,7 @@ def get_user_integration(ctx, integration_id, expand):
81
83
  return integration.data
82
84
 
83
85
  result = asyncio.run(_run())
86
+ print_platform_link(ctx, "integrations/connections")
84
87
  format_output(result, ctx.obj["FORMAT"])
85
88
 
86
89
 
@@ -88,7 +91,7 @@ def get_user_integration(ctx, integration_id, expand):
88
91
  @click.option(
89
92
  "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
90
93
  )
91
- @click.option("--sort", help="Sort by field")
94
+ @click.option("--sort", default="-updated", show_default=True, help="Sort by field")
92
95
  @click.option("--expand", help="Expand related entities")
93
96
  @click.pass_context
94
97
  def get_first_user_integration(ctx, filters, sort, expand):
@@ -123,6 +126,7 @@ def get_first_user_integration(ctx, filters, sort, expand):
123
126
  try:
124
127
  result = asyncio.run(_run())
125
128
  if result:
129
+ print_platform_link(ctx, "integrations/connections")
126
130
  format_output(result, ctx.obj["FORMAT"])
127
131
  except Exception as e:
128
132
  print_message(f"[red]Error getting user integration:[/red] {str(e)}", ctx.obj["FORMAT"])
@@ -20,13 +20,15 @@ EXCLUDED_FIELDS = {
20
20
  }
21
21
 
22
22
 
23
- def format_output(data: Any, format_type: str = "table") -> None:
23
+ def format_output(data: Any, format_type: str = "table", columns: Optional[List[str]] = None) -> None:
24
24
  """
25
25
  Format and print output based on the specified format type
26
26
 
27
27
  Args:
28
28
  data: Data to format (dict, list, or primitive)
29
29
  format_type: Output format type ("table", "json", or "yaml")
30
+ columns: Optional explicit column keys (and order) for table output;
31
+ ignored for json/yaml, which always carry the full payload
30
32
  """
31
33
  if format_type == "json":
32
34
  # Use regular print() for JSON to avoid Rich console formatting that can corrupt JSON
@@ -35,9 +37,9 @@ def format_output(data: Any, format_type: str = "table") -> None:
35
37
  console.print(yaml.dump(data, sort_keys=False, default_flow_style=False))
36
38
  else: # table format
37
39
  if isinstance(data, dict):
38
- format_dict_as_table(data)
40
+ format_dict_as_table(data, columns=columns)
39
41
  elif isinstance(data, list):
40
- format_list_as_table(data)
42
+ format_list_as_table(data, columns=columns)
41
43
  else:
42
44
  # Simple value, just print it
43
45
  console.print(str(data))
@@ -150,13 +152,14 @@ def format_value_for_display(value: Any) -> str:
150
152
  return str(value)
151
153
 
152
154
 
153
- def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> None:
155
+ def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None, columns: Optional[List[str]] = None) -> None:
154
156
  """
155
157
  Format a dictionary as a table
156
158
 
157
159
  Args:
158
160
  data: Dictionary to format
159
161
  title: Optional table title
162
+ columns: Optional explicit column keys for list rendering
160
163
  """
161
164
  # Special handling for paginated responses
162
165
  if "items" in data and isinstance(data["items"], list):
@@ -168,7 +171,7 @@ def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> N
168
171
  )
169
172
 
170
173
  # Format the items
171
- format_list_as_table(data["items"], title)
174
+ format_list_as_table(data["items"], title, columns=columns)
172
175
  return
173
176
 
174
177
  # Standard dictionary rendering
@@ -190,13 +193,15 @@ def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> N
190
193
  console.print(table)
191
194
 
192
195
 
193
- def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
196
+ def format_list_as_table(data: List[Any], title: Optional[str] = None, columns: Optional[List[str]] = None) -> None:
194
197
  """
195
198
  Format a list as a table
196
199
 
197
200
  Args:
198
201
  data: List to format
199
202
  title: Optional table title
203
+ columns: Optional explicit column keys (and order); overrides the
204
+ automatic priority-based column selection
200
205
  """
201
206
  if not data:
202
207
  console.print("[yellow]No data available[/yellow]")
@@ -222,50 +227,55 @@ def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
222
227
  # Create table with columns for each key
223
228
  table = Table(title=title, show_lines=True)
224
229
 
225
- # Keep table manageable - use most common/important fields
226
- # Prioritize certain fields - order determines display order
227
- priority_fields = [
228
- "id",
229
- "name",
230
- "status",
231
- "created",
232
- "updated",
233
- "start_time",
234
- "end_time",
235
- "test", # Add test reference
236
- "duration", # Add test duration
237
- "tenant", # Add tenant reference
238
- ]
239
-
240
- # Limit max columns to make output more readable
241
- max_display_columns = 6 # Reduce from 10 to 6 for better readability
242
-
243
- # First ensure we have id and name if they exist
244
- filtered_keys = set()
245
- for key in ["id", "name"]:
246
- if key in all_keys:
247
- filtered_keys.add(key)
248
-
249
- # Then add other priority fields until we reach the limit
250
- for key in priority_fields:
251
- if (
252
- key in all_keys
253
- and key not in filtered_keys
254
- and len(filtered_keys) < max_display_columns
255
- ):
256
- filtered_keys.add(key)
257
-
258
- # If we still have room, add some non-priority fields
259
- if len(filtered_keys) < max_display_columns:
260
- remaining_keys = sorted(list(all_keys - filtered_keys))
261
- remaining_keys = remaining_keys[: max_display_columns - len(filtered_keys)]
262
- filtered_keys.update(remaining_keys)
263
-
264
- # Sort columns with priority fields first
265
- columns = sorted(
266
- filtered_keys,
267
- key=lambda x: (priority_fields.index(x) if x in priority_fields else 999,),
268
- )
230
+ if columns:
231
+ # Explicit column list from the caller: keep the given order,
232
+ # drop keys absent from every record
233
+ columns = [key for key in columns if key in all_keys]
234
+ else:
235
+ # Keep table manageable - use most common/important fields
236
+ # Prioritize certain fields - order determines display order
237
+ priority_fields = [
238
+ "id",
239
+ "name",
240
+ "status",
241
+ "created",
242
+ "updated",
243
+ "start_time",
244
+ "end_time",
245
+ "test", # Add test reference
246
+ "duration", # Add test duration
247
+ "tenant", # Add tenant reference
248
+ ]
249
+
250
+ # Limit max columns to make output more readable
251
+ max_display_columns = 6 # Reduce from 10 to 6 for better readability
252
+
253
+ # First ensure we have id and name if they exist
254
+ filtered_keys = set()
255
+ for key in ["id", "name"]:
256
+ if key in all_keys:
257
+ filtered_keys.add(key)
258
+
259
+ # Then add other priority fields until we reach the limit
260
+ for key in priority_fields:
261
+ if (
262
+ key in all_keys
263
+ and key not in filtered_keys
264
+ and len(filtered_keys) < max_display_columns
265
+ ):
266
+ filtered_keys.add(key)
267
+
268
+ # If we still have room, add some non-priority fields
269
+ if len(filtered_keys) < max_display_columns:
270
+ remaining_keys = sorted(list(all_keys - filtered_keys))
271
+ remaining_keys = remaining_keys[: max_display_columns - len(filtered_keys)]
272
+ filtered_keys.update(remaining_keys)
273
+
274
+ # Sort columns with priority fields first
275
+ columns = sorted(
276
+ filtered_keys,
277
+ key=lambda x: (priority_fields.index(x) if x in priority_fields else 999,),
278
+ )
269
279
 
270
280
  # Add columns to table with appropriate width for IDs
271
281
  for key in columns:
@@ -280,7 +290,7 @@ def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
280
290
  table.add_column("Status", min_width=10, max_width=10, justify="center")
281
291
  else:
282
292
  # For other columns: standard format
283
- table.add_column(key.capitalize(), width=20, overflow="ellipsis")
293
+ table.add_column(key.replace("_", " ").title(), width=20, overflow="ellipsis")
284
294
 
285
295
  # Add rows
286
296
  for item in data:
@@ -0,0 +1,49 @@
1
+ """
2
+ Platform web-app link helpers for TestZeus CLI.
3
+ """
4
+
5
+ from urllib.parse import urlparse
6
+
7
+ from testzeus_cli.config import get_client_config
8
+ from testzeus_cli.utils.formatters import print_message
9
+
10
+
11
+ def platform_url(api_base_url: str, path: str) -> str:
12
+ """
13
+ Build a TestZeus web-app URL from the API base URL.
14
+
15
+ The platform app lives on the API host minus its ``pb.`` prefix
16
+ (e.g. ``pb.dev.testzeus.app`` -> ``dev.testzeus.app``).
17
+
18
+ Args:
19
+ api_base_url: PocketBase/API base URL from the profile config
20
+ path: App path, e.g. ``test-runs/<id>`` or ``tests``
21
+
22
+ Returns:
23
+ Full https URL to the platform page
24
+ """
25
+ host = urlparse(api_base_url).netloc or api_base_url
26
+ if host.startswith("pb."):
27
+ host = host[3:]
28
+ return f"https://{host}/{path.lstrip('/')}"
29
+
30
+
31
+ def print_platform_link(ctx, path: str) -> None:
32
+ """
33
+ Print a link to the matching platform page above command output.
34
+
35
+ Silent on json format (via print_message) and on any config error,
36
+ so it never breaks the command itself.
37
+ """
38
+ try:
39
+ config, _, _, _ = get_client_config(
40
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
41
+ )
42
+ base_url = config.get("base_url", "")
43
+ if base_url:
44
+ print_message(
45
+ f"[blue]Platform:[/blue] {platform_url(base_url, path)}",
46
+ ctx.obj["FORMAT"],
47
+ )
48
+ except Exception:
49
+ pass
File without changes
File without changes