cloud
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShiplight Cloud
Shiplight Cloud
Daily Skill Update Check
每日技能更新检查
Before starting this skill's work, opportunistically refresh Shiplight skills at most once per day:
- Check the timestamp file at in the current project.
.shiplight-agent-skills-last-update - If the timestamp file is missing or older than 24 hours, run , then create/update the timestamp file even if the command fails. Treat
npx -y skills@latest update -yas local cache and do not commit it..shiplight-agent-skills-last-update - If the update command fails, continue with the currently installed skill and mention the failure briefly.
Sync local YAML test cases, templates, and TypeScript functions with the Shiplight cloud using MCP tools. Primarily used to push local tests up to the cloud (and pull cloud tests back down) so they can run on a schedule, be shared with your team, and integrate with CI. Also manages test runs, environments, folders, suites, and accounts via the REST API.
在开始使用本技能前,每天最多刷新一次Shiplight技能:
- 检查当前项目中的时间戳文件。
.shiplight-agent-skills-last-update - 如果时间戳文件缺失或已超过24小时,运行,即使命令执行失败也要创建/更新时间戳文件。将
npx -y skills@latest update -y视为本地缓存,无需提交到代码仓库。.shiplight-agent-skills-last-update - 如果更新命令执行失败,继续使用当前已安装的技能,并简要提及失败情况。
使用MCP工具将本地YAML测试用例、模板和TypeScript函数与Shiplight Cloud同步。主要用于将本地测试推送到云端(或将云端测试拉取到本地),以便按计划运行、与团队共享并集成到CI流程中。同时可通过REST API管理测试运行、环境、文件夹、套件和账户。
Setup
配置
Requires a Shiplight cloud subscription and a . If cloud MCP tools (, , etc.) are not in the tool list, the token is missing.
SHIPLIGHT_API_TOKENsave_test_caseget_test_caseTell the user:
Cloud tools are not available. Get your API token from https://app.shiplight.ai/settings/api-tokens, setin your project'sSHIPLIGHT_API_TOKENfile, then reconnect MCP (.env)./mcp
If the user provides a token, append it to the project's file (create if needed) and tell them: "Saved to — make sure is in your . Reconnect MCP () to activate cloud tools."
.env<project>/.env.env.gitignore/mcpAll REST API calls require:
Authorization: Bearer $SHIPLIGHT_API_TOKEN告知用户:
如果用户提供令牌,将其追加到项目的文件中(若文件不存在则创建),并告知用户:"已保存到——确保已添加到中。重新连接MCP()以激活云端工具。"
.env<project>/.env.env.gitignore/mcp所有REST API调用都需要:
Authorization: Bearer $SHIPLIGHT_API_TOKENError Handling
错误处理
| Error | Action |
|---|---|
| 401 Unauthorized | Token is invalid or expired — ask user to check |
| 403 Forbidden | Insufficient permissions — inform user |
| 404 Not Found | Resource not found — report to user |
| 422 Validation | Show validation message to user |
| Tool not found | Token is missing — guide user through setup above |
| 错误类型 | 处理操作 |
|---|---|
| 401 Unauthorized | 令牌无效或过期——请用户检查.env中的 |
| 403 Forbidden | 权限不足——告知用户 |
| 404 Not Found | 资源不存在——向用户报告 |
| 422 Validation | 向用户显示验证信息 |
| 工具未找到 | 令牌缺失——引导用户完成上述配置步骤 |
MCP Tools
MCP工具
These tools are available when is set. Prefer over passing content directly (saves tokens). Always use for .
SHIPLIGHT_API_TOKENfile_pathoutput_format: 'yaml'get_test_case- Upload: ,
save_test_case,save_test_account,save_templatesave_function - Download: ,
get_test_case,get_templateget_function - Account: — create/update test account with optional
save_test_accountto upload local browser session to cloudstorage_state_path
当设置好后,以下工具可用。优先使用而非直接传递内容(可节省令牌消耗)。调用时始终使用。
SHIPLIGHT_API_TOKENfile_pathget_test_caseoutput_format: 'yaml'- 上传: 、
save_test_case、save_test_account、save_templatesave_function - 下载: 、
get_test_case、get_templateget_function - 账户: ——创建/更新测试账户,可选择通过
save_test_account将本地浏览器会话上传到云端storage_state_path
ID Tracking
ID追踪
After uploading, add the returned cloud ID to the local file so future saves update instead of creating duplicates:
| Artifact | Local file | ID field |
|---|---|---|
| Test case | | |
| Template | | |
| Function | | |
上传完成后,将返回的云端ID添加到本地文件中,以便后续保存时更新而非创建重复项:
| 工件类型 | 本地文件 | ID字段 |
|---|---|---|
| 测试用例 | | |
| 模板 | | |
| 函数 | | |
REST API
REST API
Base URL:
https://api.shiplight.ai基础URL:
https://api.shiplight.aiTest Cases
测试用例
List Test Cases
列出测试用例
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-casesQuery parameters:
| Param | Type | Description |
|---|---|---|
| string | Comma-separated test case IDs |
| number | Filter by exact folder |
| number | Filter by folder and all descendants |
| string | Comma-separated label IDs (OR logic — matches test cases with ANY of the labels) |
| string | Filter by creator user ID |
| string | Order by field (default: |
| | Order direction (default: |
| number | Max results to return |
Response:
{ data: [{ id, title, test_flow, folder_id, ... }], count: number }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-cases查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| string | 逗号分隔的测试用例ID |
| number | 按指定文件夹过滤 |
| number | 按文件夹及其所有子文件夹过滤 |
| string | 逗号分隔的标签ID(OR逻辑——匹配包含任一标签的测试用例) |
| string | 按创建者用户ID过滤 |
| string | 排序字段(默认: |
| | 排序方向(默认: |
| number | 返回的最大结果数 |
响应:
{ data: [{ id, title, test_flow, folder_id, ... }], count: number }Get Test Case
获取测试用例
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-cases/123Response:
{ id, title, test_flow, folder_id }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-cases/123响应:
{ id, title, test_flow, folder_id }Delete Test Case (soft delete)
删除测试用例(软删除)
Marks the test case and its results as deleted (soft delete — records are retained but hidden from queries).
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-cases/123Response:
{ success: true, message: "Test case deleted" }标记测试用例及其结果为已删除(软删除——记录保留但查询时隐藏)。
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-cases/123响应:
{ success: true, message: "Test case deleted" }Move Test Cases to Folder
将测试用例移动到文件夹
Batch-update the folder assignment for multiple test cases. Set to to move to root.
folder_idnullbash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"test_ids": [101, 102], "folder_id": 5}' \
https://api.shiplight.ai/v1/test-cases/batch-update-folderBody:
{ test_ids: number[], folder_id: number | null }Response:
{ success: true, data: [/* updated test cases */], message: "Successfully updated 2 test cases" }批量更新多个测试用例的文件夹归属。将设为可移动到根目录。
folder_idnullbash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"test_ids": [101, 102], "folder_id": 5}' \
https://api.shiplight.ai/v1/test-cases/batch-update-folder请求体:
{ test_ids: number[], folder_id: number | null }响应:
{ success: true, data: [/* 更新后的测试用例 */], message: "Successfully updated 2 test cases" }Test Data
测试数据
List Test Data
列出测试数据
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-dataUse to fetch specific files:
idsbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-data?ids=1,2,3"Response: array of
{ organization_id, id, name, s3_path, created_at, updated_at, usage_count? }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-data使用获取特定文件:
idsbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-data?ids=1,2,3"响应: 数组
{ organization_id, id, name, s3_path, created_at, updated_at, usage_count? }Get Test Data
获取测试数据
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-data/123Response:
{ organization_id, id, name, s3_path, created_at, updated_at }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-data/123响应:
{ organization_id, id, name, s3_path, created_at, updated_at }Download Test Data File
下载测试数据文件
Streams the file from S3 as .
application/octet-streambash
curl -L -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-data/123/download \
-o ./filename.ext从S3流式传输文件,类型为。
application/octet-streambash
curl -L -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-data/123/download \
-o ./filename.extTest Runs
测试运行
List Test Runs
列出测试运行
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-runs?limit=10"Query parameters:
| Param | Type | Description |
|---|---|---|
| number | Filter by test plan |
| string | Filter by trigger ( |
| string | Filter by result ( |
| number | Max results to return |
Response: array of
{ id, status, result, trigger, start_time, end_time, duration, total_test_case_count, passed_test_case_count, failed_test_case_count }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-runs?limit=10"查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| number | 按测试计划过滤 |
| string | 按触发方式过滤( |
| string | 按结果过滤( |
| number | 返回的最大结果数 |
响应: 数组
{ id, status, result, trigger, start_time, end_time, duration, total_test_case_count, passed_test_case_count, failed_test_case_count }Get Test Run Details
获取测试运行详情
Note: This endpoint has no prefix.
/v1/bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/run-results/456Response:
json
{
"testRun": { "id": 456, "status": "COMPLETED", "result": "PASSED" },
"testCaseResults": [
{ "id": 789, "test_case_id": 123, "result": "PASSED", "duration": 45 }
]
}注意: 该端点没有前缀。
/v1/bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/run-results/456响应:
json
{
"testRun": { "id": 456, "status": "COMPLETED", "result": "PASSED" },
"testCaseResults": [
{ "id": 789, "test_case_id": 123, "result": "PASSED", "duration": 45 }
]
}Trigger Test Run
触发测试运行
Run a test case, test suite, or a combination in the cloud.
By test case:
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API"}' \
https://api.shiplight.ai/v1/test-run/test-case/123By test suite:
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API"}' \
https://api.shiplight.ai/v1/test-run/test-suite/1Generic (multiple test cases, suites, and/or labels):
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API", "test_case_ids": [101, 102], "test_suite_ids": [1]}' \
https://api.shiplight.ai/v1/test-runBy labels (run all test cases with any of the specified labels):
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API", "label_ids": [22, 18]}' \
https://api.shiplight.ai/v1/test-runBody (all trigger endpoints):
| Field | Type | Description |
|---|---|---|
| string | Required. Use |
| number[] | Generic endpoint only — test case IDs to run |
| number[] | Generic endpoint only — test suite IDs to run |
| number[] | Generic endpoint only — label IDs; resolves to test cases with ANY of these labels (OR logic). Can be combined with |
| | Override environment |
Response (201): test run object with
{ id, status, result, ... }After triggering, poll or to check status.
GET /v1/test-runs?limit=1GET /run-results/<id>在云端运行单个测试用例、测试套件或组合。
按测试用例触发:
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API"}' \
https://api.shiplight.ai/v1/test-run/test-case/123按测试套件触发:
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API"}' \
https://api.shiplight.ai/v1/test-run/test-suite/1通用触发(多个测试用例、套件和/或标签):
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API", "test_case_ids": [101, 102], "test_suite_ids": [1]}' \
https://api.shiplight.ai/v1/test-run按标签触发(运行包含任一指定标签的所有测试用例):
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger": "API", "label_ids": [22, 18]}' \
https://api.shiplight.ai/v1/test-run所有触发端点的请求体:
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 必填。使用 |
| number[] | 仅通用端点可用——要运行的测试用例ID |
| number[] | 仅通用端点可用——要运行的测试套件ID |
| number[] | 仅通用端点可用——标签ID;匹配包含任一标签的测试用例(OR逻辑)。可与 |
| | 覆盖环境配置 |
响应(201): 包含的测试运行对象
{ id, status, result, ... }触发后,轮询或检查状态。
GET /v1/test-runs?limit=1GET /run-results/<id>Get Test Case Result
获取测试用例结果
Note: This endpoint has no prefix.
/v1/bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/test-case-results/789Response:
{ id, test_case_id, test_run_id, result, status, duration, environment_name, environment_url, video, trace, report_s3_uri, report, error }The , , and fields contain S3 URIs — use the Artifacts endpoint to download them.
videotracereport_s3_uriThe field contains step-by-step execution details in — each step has , , , , and artifact S3 URIs (, , etc.).
reportreport[0].resultJsondescriptionstatusmessagedurationscreenshot_s3_pathmessages_s3_path注意: 该端点没有前缀。
/v1/bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/test-case-results/789响应:
{ id, test_case_id, test_run_id, result, status, duration, environment_name, environment_url, video, trace, report_s3_uri, report, error }videotracereport_s3_urireportreport[0].resultJsondescriptionstatusmessagedurationscreenshot_s3_pathmessages_s3_pathEnvironments
环境
List Environments
列出环境
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/environmentsResponse: array of
{ id, name, url }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/environments响应: 数组
{ id, name, url }Get Environment
获取环境
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/environments/1Response:
{ id, name, url }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/environments/1响应:
{ id, name, url }Variables
变量
Environment-scoped variables — the cloud equivalent of in . Use for secrets (passwords, API keys) so they're masked in logs.
variablesplaywright.config.tsisSensitive: true环境作用域变量——相当于中的云端版本。对于机密信息(密码、API密钥),使用以便在日志中隐藏。
playwright.config.tsvariablesisSensitive: trueList Variables
列出变量
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/variables?environmentId=1"Response: array of
{ id, name, value, environment_id, is_sensitive }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/variables?environmentId=1"响应: 数组
{ id, name, value, environment_id, is_sensitive }Test Accounts
测试账户
List Test Accounts
列出测试账户
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-accounts?environmentId=1"Query: (number, optional but recommended) — filter by environment.
environmentIdResponse: array of
{ id, name, username, environmentId, loginConfig }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-accounts?environmentId=1"查询参数: (数字,可选但推荐)——按环境过滤。
environmentId响应: 数组
{ id, name, username, environmentId, loginConfig }Get Test Account
获取测试账户
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-accounts/1Response:
{ id, name, username, password, environmentId, loginConfig }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-accounts/1响应:
{ id, name, username, password, environmentId, loginConfig }Forward Email Configs
转发邮箱配置
Forward email configs store the Mailgun forwarding address and extraction filters used by email-based login and verification flows. All responses are scoped to the organization associated with .
SHIPLIGHT_API_TOKEN转发邮箱配置存储Mailgun转发地址和提取过滤器,用于基于邮箱的登录和验证流程。所有响应都与关联的组织绑定。
SHIPLIGHT_API_TOKENList Forward Email Configs
列出转发邮箱配置
Returns all forward email configs for the organization, ordered by descending.
created_atbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/forward-email-configsResponse: array of
{ id, organization_id, name, forward_email, extraction_type, prompt, filter_from_email, filter_to_email, filter_subject, filter_body_contains, created_at, updated_at }返回组织的所有转发邮箱配置,按降序排列。
created_atbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/forward-email-configs响应: 数组
{ id, organization_id, name, forward_email, extraction_type, prompt, filter_from_email, filter_to_email, filter_subject, filter_body_contains, created_at, updated_at }Get Forward Email Config
获取转发邮箱配置
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/forward-email-configs/1Response:
{ id, organization_id, name, forward_email, extraction_type, prompt, filter_from_email, filter_to_email, filter_subject, filter_body_contains, created_at, updated_at }Fields:
| Field | Type | Description |
|---|---|---|
| number | Forward email config ID |
| string | Organization that owns the config |
| string | Human-readable config name |
| string | Mailgun forwarding inbox address |
| string | Extraction mode, such as |
| string | Optional custom extraction prompt |
| string | Optional sender filter |
| string | Optional recipient filter |
| string | Optional subject filter |
| string | Optional body text filter |
| string | ISO timestamp |
| string | ISO timestamp |
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/forward-email-configs/1响应:
{ id, organization_id, name, forward_email, extraction_type, prompt, filter_from_email, filter_to_email, filter_subject, filter_body_contains, created_at, updated_at }字段说明:
| 字段 | 类型 | 描述 |
|---|---|---|
| number | 转发邮箱配置ID |
| string | 拥有该配置的组织ID |
| string | 配置的可读名称 |
| string | Mailgun转发收件箱地址 |
| string | 提取模式,如 |
| string | 可选的自定义提取提示 |
| string | 可选的发件人过滤器 |
| string | 可选的收件人过滤器 |
| string | 可选的主题过滤器 |
| string | 可选的正文内容过滤器 |
| string | ISO时间戳 |
| string | ISO时间戳 |
Folders
文件夹
List All Folders
列出所有文件夹
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/allOptional query:
?search=keywordResponse: array of
{ id, name, description, parentId, pathIds }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/all可选查询参数:
?search=keyword响应: 数组
{ id, name, description, parentId, pathIds }List Folders by Parent
按父文件夹列出子文件夹
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-folders?parentId=1"Omit entirely for root-level folders.
parentIdResponse: array of
{ id, name, description, parentId }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-folders?parentId=1"省略可获取根级文件夹。
parentId响应: 数组
{ id, name, description, parentId }Get Folder
获取文件夹
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/1Response:
{ id, name, description, parentId, pathIds }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/1响应:
{ id, name, description, parentId, pathIds }Create Folder
创建文件夹
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Smoke Tests", "parentId": 1}' \
https://api.shiplight.ai/v1/test-foldersBody:
{ name: string, description?: string, parentId?: number | null }Response (201):
{ success: true, data: { id, name, description, parentId } }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Smoke Tests", "parentId": 1}' \
https://api.shiplight.ai/v1/test-folders请求体:
{ name: string, description?: string, parentId?: number | null }响应(201):
{ success: true, data: { id, name, description, parentId } }Update Folder
更新文件夹
bash
curl -X PATCH -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Regression Tests"}' \
https://api.shiplight.ai/v1/test-folders/1Body:
{ name?: string, description?: string }Response:
{ success: true, data: { id, name, description } }bash
curl -X PATCH -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Regression Tests"}' \
https://api.shiplight.ai/v1/test-folders/1请求体:
{ name?: string, description?: string }响应:
{ success: true, data: { id, name, description } }Delete Folder
删除文件夹
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/1Response:
{ success: true }bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-folders/1响应:
{ success: true }Move Folder
移动文件夹
Move a folder to a different parent. Set to to move to root.
parentIdnullbash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"parentId": 5}' \
https://api.shiplight.ai/v1/test-folders/1/moveBody:
{ parentId: number | null }Response:
{ success: true }将文件夹移动到不同的父文件夹。将设为可移动到根目录。
parentIdnullbash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"parentId": 5}' \
https://api.shiplight.ai/v1/test-folders/1/move请求体:
{ parentId: number | null }响应:
{ success: true }Test Suites
测试套件
Test suites group test cases for organized execution. Use suites to manage which test cases run together.
测试套件用于将测试用例分组,便于组织执行。使用套件管理需一起运行的测试用例。
List All Suites
列出所有套件
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-suitesResponse: array of
{ id, title, description, testCount, createdAt, updatedAt }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-suites响应: 数组
{ id, title, description, testCount, createdAt, updatedAt }Get Suite
获取套件
Returns suite metadata and its test cases. Always use to select only the columns you need — without it, the endpoint returns full test case entities which is too expensive.
?fields=?fields=idtitledescriptionstatusfolder_idtest_typecreated_atupdated_aturlbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-suites/1?fields=id,title,status"Response:
json
{
"suite": { "id": 1, "title": "Smoke Tests", "description": "...", "testCount": 5 },
"testCases": [
{ "id": 101, "title": "Login flow", "status": "Active" },
{ "id": 102, "title": "Search", "status": "Active" }
]
}返回套件元数据及其包含的测试用例。务必使用选择所需列——若不指定,端点会返回完整的测试用例实体,开销过大。
?fields=?fields=idtitledescriptionstatusfolder_idtest_typecreated_atupdated_aturlbash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/test-suites/1?fields=id,title,status"响应:
json
{
"suite": { "id": 1, "title": "Smoke Tests", "description": "...", "testCount": 5 },
"testCases": [
{ "id": 101, "title": "Login flow", "status": "Active" },
{ "id": 102, "title": "Search", "status": "Active" }
]
}Create Suite
创建套件
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Smoke Tests", "description": "Core user flows"}' \
https://api.shiplight.ai/v1/test-suitesBody:
{ title: string, description?: string }Response (201):
{ id, title, description, createdAt, updatedAt }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Smoke Tests", "description": "Core user flows"}' \
https://api.shiplight.ai/v1/test-suites请求体:
{ title: string, description?: string }响应(201):
{ id, title, description, createdAt, updatedAt }Update Suite
更新套件
bash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Regression Tests"}' \
https://api.shiplight.ai/v1/test-suites/1Body:
{ title?: string, description?: string }Response:
{ success: true, message: "Test suite updated successfully" }bash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Regression Tests"}' \
https://api.shiplight.ai/v1/test-suites/1请求体:
{ title?: string, description?: string }响应:
{ success: true, message: "Test suite updated successfully" }Delete Suite
删除套件
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-suites/1Response:
{ success: true, message: "Test suite deleted" }bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/test-suites/1响应:
{ success: true, message: "Test suite deleted" }Add Test Cases to Suite
向套件添加测试用例
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"testCaseIds": [101, 102, 103]}' \
https://api.shiplight.ai/v1/test-suites/1/test-casesBody:
{ testCaseIds: number[] }Response:
{ success: true, message: "Test cases added to suite successfully" }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"testCaseIds": [101, 102, 103]}' \
https://api.shiplight.ai/v1/test-suites/1/test-cases请求体:
{ testCaseIds: number[] }响应:
{ success: true, message: "Test cases added to suite successfully" }Remove Test Cases from Suite
从套件移除测试用例
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"testCaseIds": [101]}' \
https://api.shiplight.ai/v1/test-suites/1/test-casesBody:
{ testCaseIds: number[] }Response:
{ success: true, message: "Test cases removed from suite successfully" }bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"testCaseIds": [101]}' \
https://api.shiplight.ai/v1/test-suites/1/test-cases请求体:
{ testCaseIds: number[] }响应:
{ success: true, message: "Test cases removed from suite successfully" }Labels
标签
Labels let you tag test cases (e.g., , ) and trigger runs by label instead of manually managing suites.
daily-regressionpre-merge标签用于标记测试用例(如、),可按标签触发运行,无需手动管理套件。
daily-regressionpre-mergeList Labels
列出标签
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labelsResponse:
{ success: true, data: [{ id, name, color, organizationId, createdAt, updatedAt }] }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels响应:
{ success: true, data: [{ id, name, color, organizationId, createdAt, updatedAt }] }Create Label
创建标签
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "daily-regression", "color": "#4CAF50"}' \
https://api.shiplight.ai/v1/labelsBody:
{ name: string, color: string }Response (201):
{ success: true, data: { id, name, color } }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "daily-regression", "color": "#4CAF50"}' \
https://api.shiplight.ai/v1/labels请求体:
{ name: string, color: string }响应(201):
{ success: true, data: { id, name, color } }Update Label
更新标签
bash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "nightly-regression"}' \
https://api.shiplight.ai/v1/labels/22Body:
{ name?: string, color?: string }bash
curl -X PUT -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "nightly-regression"}' \
https://api.shiplight.ai/v1/labels/22请求体:
{ name?: string, color?: string }Delete Label
删除标签
bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/22bash
curl -X DELETE -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/22Add Labels to Test Case
为测试用例添加标签
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labelIds": [22, 18]}' \
https://api.shiplight.ai/v1/labels/test-case/123/addBody:
{ labelIds: number[] }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labelIds": [22, 18]}' \
https://api.shiplight.ai/v1/labels/test-case/123/add请求体:
{ labelIds: number[] }Remove Labels from Test Case
从测试用例移除标签
bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labelIds": [22]}' \
https://api.shiplight.ai/v1/labels/test-case/123/removeBody:
{ labelIds: number[] }bash
curl -X POST -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labelIds": [22]}' \
https://api.shiplight.ai/v1/labels/test-case/123/remove请求体:
{ labelIds: number[] }Get Labels for Test Case
获取测试用例的标签
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/test-case/123Response:
{ success: true, data: [{ id, name, color }] }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/test-case/123响应:
{ success: true, data: [{ id, name, color }] }Get Test Case IDs by Label
获取标签对应的测试用例ID
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/test-cases/22Response:
{ success: true, data: [101, 102, 103] }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/labels/test-cases/22响应:
{ success: true, data: [101, 102, 103] }Templates (Reusable Steps)
模板(可复用步骤)
Reusable test step sequences that can be referenced from test cases via in YAML or in the cloud. The API uses the legacy name "reusable-steps".
template:reference_id可复用的测试步骤序列,可通过YAML中的或云端的在测试用例中引用。API使用旧名称"reusable-steps"。
template:reference_idGet Template
获取模板
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/reusable-steps/138Response:
{ id, name, description, statements }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/reusable-steps/138响应:
{ id, name, description, statements }Test Functions
测试函数
Custom TypeScript functions that can be called from test cases via in YAML.
call: "file#export"可从测试用例中调用的自定义TypeScript函数,通过YAML中的调用。
call: "file#export"Get Test Function
获取测试函数
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/functions/42Response:
{ id, name, description, code, status }bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
https://api.shiplight.ai/v1/functions/42响应:
{ id, name, description, code, status }Artifacts
工件
Download S3 File
下载S3文件
Download test artifacts (videos, traces, reports) referenced by S3 URIs in test case results.
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/s3/file?uri=s3://bucket/path/video.webm"Query: (string, required) — S3 URI from test result fields (, , ).
urivideotracereport_s3_uriResponse: raw file contents with appropriate content-type. For binary files (videos, traces), use to save to disk.
curl -o <output_file>下载测试用例结果中S3 URI对应的测试工件(视频、追踪文件、报告)。
bash
curl -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
"https://api.shiplight.ai/v1/s3/file?uri=s3://bucket/path/video.webm"查询参数: (字符串,必填)——测试结果字段(、、)中的S3 URI。
urivideotracereport_s3_uri响应: 原始文件内容及对应内容类型。对于二进制文件(视频、追踪文件),使用保存到本地磁盘。
curl -o <output_file>Workflows
工作流
Sync local project to cloud
将本地项目同步到云端
- Sync test accounts: call with credentials and
save_test_account(if the local project uses storageState-based auth)storage_state_path - Sync test cases: find all files, call
.test.yamlwithsave_test_casefor each. If the file already has afile_path, it updates; if not, it creates and returns an ID.test_case_id - Track IDs: add the returned to the YAML if not already present
test_case_id - Sync templates and functions: repeat with and
save_templatesave_function
- 同步测试账户: 调用,传入凭证和
save_test_account(如果本地项目使用基于storageState的认证)storage_state_path - 同步测试用例: 查找所有文件,为每个文件调用
.test.yaml并传入save_test_case。如果文件已有file_path,则更新;若无,则创建并返回ID。test_case_id - 追踪ID: 如果本地YAML文件中没有,将返回的ID添加进去
test_case_id - 同步模板和函数: 重复上述步骤,使用和
save_templatesave_function
Download test case from cloud
从云端下载测试用例
-
Callwith
get_test_caseandtest_case_idoutput_format: 'yaml' -
Convert the cloudto baseURL + relative paths. Cloud test cases have a top-level
url:field for the starting URL (e.g.,url:). Local YAML tests split this into two parts:url: https://app.example.com/dashboard- Base URL — set once in playwright.config.ts at the project level () if all tests share the same origin, or per-test via
use: { baseURL: 'https://app.example.com' }. Prefer project-level.base_url: https://app.example.com - Navigation — use relative paths in the test steps ().
URL: /dashboard
Remove the top-levelfield from the downloaded YAML, ensureurl:is configured, and convert any absolute URL statements to relative paths.baseURL - Base URL — set once in playwright.config.ts at the project level (
-
Save the returned YAML to afile
.test.yaml
-
调用,传入
get_test_case并设置test_case_idoutput_format: 'yaml' -
将云端的转换为baseURL + 相对路径。云端测试用例有一个顶级
url:字段用于起始URL(例如url:)。本地YAML测试将其拆分为两部分:url: https://app.example.com/dashboard- 基础URL — 如果所有测试共享同一源,在项目级的playwright.config.ts中设置一次(),或在测试用例中通过
use: { baseURL: 'https://app.example.com' }单独设置。优先使用项目级配置。base_url: https://app.example.com - 导航路径 — 在测试步骤中使用相对路径()。
URL: /dashboard
从下载的YAML中移除顶级字段,确保已配置url:,并将所有绝对URL语句转换为相对路径。baseURL - 基础URL — 如果所有测试共享同一源,在项目级的playwright.config.ts中设置一次(
-
将返回的YAML保存为文件
.test.yaml
Download test artifacts
下载测试工件
- → find
GET /test-case-results/<id>,video, ortracefields (S3 URIs)report_s3_uri - → download the artifact content
GET /v1/s3/file?uri=<S3_URI>
- → 查找
GET /test-case-results/<id>、video或trace字段(S3 URI)report_s3_uri - → 下载工件内容
GET /v1/s3/file?uri=<S3_URI>