cloud_v2
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShiplight Cloud v2
Shiplight Cloud v2
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.
Use the Nova results API to publish and inspect Shiplight test results from local runs, CI runs, and hosted execution. The path segment is the API contract version.
/v1在开始使用该技能前,每天最多刷新一次Shiplight技能:
- 检查当前项目中时间戳文件。
.shiplight-agent-skills-last-update - 如果时间戳文件缺失或已超过24小时,运行,然后创建/更新时间戳文件(即使命令执行失败也要操作)。将
npx -y skills@latest update -y视为本地缓存,不要提交到版本控制。.shiplight-agent-skills-last-update - 如果更新命令执行失败,继续使用当前已安装的技能,并简要提及失败情况。
使用Nova结果API从本地运行、CI运行和托管执行中发布和查看Shiplight测试结果。路径段是API协议版本。
/v1Setup
配置
Use a Nova API token in and the Nova API base URL in .
SHIPLIGHT_API_TOKENSHIPLIGHT_API_URLbash
export SHIPLIGHT_API_URL=https://nova-api.shiplight.aiAll API calls require:
text
Authorization: Bearer $SHIPLIGHT_API_TOKENIf the user provides a token, append it to the project's file as and tell them to keep out of git.
.envSHIPLIGHT_API_TOKEN=<token>.env使用中的Nova API令牌,以及中的Nova API基础URL。
SHIPLIGHT_API_TOKENSHIPLIGHT_API_URLbash
export SHIPLIGHT_API_URL=https://nova-api.shiplight.ai所有API调用都需要:
text
Authorization: Bearer $SHIPLIGHT_API_TOKEN如果用户提供令牌,将其追加到项目的文件中,格式为,并告知用户不要将提交到git。
.envSHIPLIGHT_API_TOKEN=<token>.envError Handling
错误处理
| Error | Action |
|---|---|
| 400 Bad Request | Fix the request body, IDs, or query parameters |
| 401 Unauthorized | Token is missing, invalid, expired, or for the wrong Nova environment |
| 403 Forbidden | Token lacks the required permission |
| 404 Not Found | Run, result, or artifact was not found for this organization |
| 422 Validation | Show the validation message and correct the payload |
| 500 Server Error | Retry only if the operation is idempotent; otherwise report the failure |
| 错误 | 处理方式 |
|---|---|
| 400 请求错误 | 修正请求体、ID或查询参数 |
| 401 未授权 | 令牌缺失、无效、过期或所属Nova环境错误 |
| 403 禁止访问 | 令牌缺少所需权限 |
| 404 未找到 | 该组织未找到对应的运行、结果或制品 |
| 422 验证失败 | 显示验证信息并修正请求负载 |
| 500 服务器错误 | 仅当操作是幂等的时重试;否则报告失败情况 |
REST API
REST API
Base URL:
$SHIPLIGHT_API_URL基础URL:
$SHIPLIGHT_API_URLCreate Test Run
创建测试运行
Create a test run and result slots. The response includes presigned upload URLs for per-result video and trace artifacts.
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d @run.jsonRequest:
json
{
"trigger": "local_cli",
"startTime": "2026-05-27T10:00:00.000Z",
"metadata": {
"gitBranch": "main",
"gitCommit": "abc1234",
"gitRepo": "org/repo",
"authorEmail": "dev@example.com",
"ciProvider": "github_actions",
"ciBuildId": "12345",
"ciBuildUrl": "https://github.com/org/repo/actions/runs/12345",
"commitTitle": "Fix checkout flow",
"commitUrl": "https://github.com/org/repo/commit/abc1234",
"prNumber": 42,
"prTitle": "Fix checkout flow",
"prUrl": "https://example.com/pr/42",
"hostname": "runner-1",
"nodeVersion": "v22.0.0"
},
"tests": [
{
"testCaseName": "checkout succeeds",
"testCaseBaseName": "checkout succeeds",
"suiteName": "Checkout",
"file": "tests/checkout.test.yaml",
"tags": ["smoke"],
"suiteTags": ["commerce"],
"baseUrl": "https://app.example.com",
"skip": false,
"slow": false,
"timeout": 30000,
"parameterSetName": "chromium",
"videoMd5": "base64-encoded-md5",
"traceMd5": "base64-encoded-md5"
}
]
}Response:
json
{
"testRunId": 42,
"testCaseResults": [
{
"testCaseName": "checkout succeeds",
"testCaseResultId": 101,
"uploadUrls": {
"video": "https://...",
"trace": "https://...",
"screenshots": {}
},
"s3Uris": {
"video": "s3://...",
"trace": "s3://..."
}
}
]
}Useful metadata keys include , , , , , , , , , , , , , and . Unknown metadata may be ignored.
gitBranchgitCommitgitRepoauthorEmailcommitTitlecommitUrlciProviderciBuildIdciBuildUrlprTitleprNumberprUrlhostnamenodeVersion创建测试运行和结果槽位。响应包含针对每个结果的视频和追踪制品的预签名上传URL。
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d @run.json请求:
json
{
"trigger": "local_cli",
"startTime": "2026-05-27T10:00:00.000Z",
"metadata": {
"gitBranch": "main",
"gitCommit": "abc1234",
"gitRepo": "org/repo",
"authorEmail": "dev@example.com",
"ciProvider": "github_actions",
"ciBuildId": "12345",
"ciBuildUrl": "https://github.com/org/repo/actions/runs/12345",
"commitTitle": "Fix checkout flow",
"commitUrl": "https://github.com/org/repo/commit/abc1234",
"prNumber": 42,
"prTitle": "Fix checkout flow",
"prUrl": "https://example.com/pr/42",
"hostname": "runner-1",
"nodeVersion": "v22.0.0"
},
"tests": [
{
"testCaseName": "checkout succeeds",
"testCaseBaseName": "checkout succeeds",
"suiteName": "Checkout",
"file": "tests/checkout.test.yaml",
"tags": ["smoke"],
"suiteTags": ["commerce"],
"baseUrl": "https://app.example.com",
"skip": false,
"slow": false,
"timeout": 30000,
"parameterSetName": "chromium",
"videoMd5": "base64-encoded-md5",
"traceMd5": "base64-encoded-md5"
}
]
}响应:
json
{
"testRunId": 42,
"testCaseResults": [
{
"testCaseName": "checkout succeeds",
"testCaseResultId": 101,
"uploadUrls": {
"video": "https://...",
"trace": "https://...",
"screenshots": {}
},
"s3Uris": {
"video": "s3://...",
"trace": "s3://..."
}
}
]
}有用的元数据键包括、、、、、、、、、、、、和。未知的元数据可能会被忽略。
gitBranchgitCommitgitRepoauthorEmailcommitTitlecommitUrlciProviderciBuildIdciBuildUrlprTitleprNumberprUrlhostnamenodeVersionScreenshot Upload URLs
截图上传URL
Generate presigned upload URLs for result screenshots.
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/screenshot-urls" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"stepIds":["step-1"],"md5s":{"step-1":"base64-encoded-md5"}}'Response:
json
{
"screenshots": {
"step-1": "https://..."
},
"screenshotS3Uris": {
"step-1": "s3://..."
}
}为结果截图生成预签名上传URL。
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/screenshot-urls" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"stepIds":["step-1"],"md5s":{"step-1":"base64-encoded-md5"}}'响应:
json
{
"screenshots": {
"step-1": "https://..."
},
"screenshotS3Uris": {
"step-1": "s3://..."
}
}Report Upload URL
报告上传URL
Generate a presigned upload URL for a result report.
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/report-url" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"md5":"base64-encoded-md5"}'Response:
json
{
"reportUrl": "https://...",
"reportS3Uri": "s3://..."
}为结果报告生成预签名上传URL。
bash
curl -X POST "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/report-url" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"md5":"base64-encoded-md5"}'响应:
json
{
"reportUrl": "https://...",
"reportS3Uri": "s3://..."
}Complete Test Run
完成测试运行
Mark a test run complete and attach final per-result status, timing, artifacts, and metadata.
Common values are , , , , and .
resultpassedfailedskippedtimedoutflakybash
curl -X PUT "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/complete" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d @complete-run.jsonRequest:
json
{
"status": "finished",
"endTime": "2026-05-27T10:05:00.000Z",
"totalDuration": 300000,
"results": [
{
"testCaseResultId": 101,
"result": "passed",
"startTime": "2026-05-27T10:00:01.000Z",
"endTime": "2026-05-27T10:00:10.000Z",
"error": null,
"reportS3Uri": "s3://...",
"videoS3Uri": "s3://...",
"traceS3Uri": "s3://...",
"metadata": {}
}
]
}Response:
json
{
"reportUrl": "/run-results/42"
}标记测试运行为完成状态,并附加每个结果的最终状态、时间信息、制品和元数据。常见的值包括、、、和。
resultpassedfailedskippedtimedoutflakybash
curl -X PUT "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/complete" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
-H "Content-Type: application/json" \
-d @complete-run.json请求:
json
{
"status": "finished",
"endTime": "2026-05-27T10:05:00.000Z",
"totalDuration": 300000,
"results": [
{
"testCaseResultId": 101,
"result": "passed",
"startTime": "2026-05-27T10:00:01.000Z",
"endTime": "2026-05-27T10:00:10.000Z",
"error": null,
"reportS3Uri": "s3://...",
"videoS3Uri": "s3://...",
"traceS3Uri": "s3://...",
"metadata": {}
}
]
}响应:
json
{
"reportUrl": "/run-results/42"
}Artifact Read URL
制品读取URL
Generate a signed read URL for an uploaded artifact.
bash
curl "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/artifact-url?type=trace" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN"Supported values: , , , . For screenshots, include .
typereportvideotracescreenshotstepIdbash
curl "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/artifact-url?type=screenshot&stepId=step-1" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN"Response:
json
{
"url": "https://...",
"expiresIn": 3600
}为已上传的制品生成签名读取URL。
bash
curl "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/artifact-url?type=trace" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN"支持的值:、、、。对于截图,需要包含。
typereportvideotracescreenshotstepIdbash
curl "$SHIPLIGHT_API_URL/v1/local-runs/$TEST_RUN_ID/results/$TEST_CASE_RESULT_ID/artifact-url?type=screenshot&stepId=step-1" \
-H "Authorization: Bearer $SHIPLIGHT_API_TOKEN"响应:
json
{
"url": "https://...",
"expiresIn": 3600
}Workflows
工作流
Publish a Run
发布测试运行
- Build the run payload with one entry per discovered test.
- and keep
POST /v1/local-runs,testRunId, upload URLs, and S3 URIs.testCaseResultId - Upload videos and traces directly to the presigned URLs returned by create-run. If an MD5 was provided when requesting a URL, upload the matching content with the required checksum header.
- For screenshots, call , then upload each file to its presigned URL.
screenshot-urls - For reports, call , then upload the report JSON to its presigned URL.
report-url - with each final result and uploaded artifact URI.
PUT /v1/local-runs/{testRunId}/complete - Return the API response's to the user.
reportUrl
- 构建包含每个已发现测试条目的运行负载。
- 调用并保存
POST /v1/local-runs、testRunId、上传URL和S3 URI。testCaseResultId - 直接将视频和追踪文件上传到创建运行接口返回的预签名URL。如果请求URL时提供了MD5值,上传匹配内容时需附带所需的校验和头。
- 对于截图,调用接口,然后将每个文件上传到对应的预签名URL。
screenshot-urls - 对于报告,调用接口,然后将报告JSON上传到对应的预签名URL。
report-url - 调用接口,传入每个结果的最终状态和已上传制品的URI。
PUT /v1/local-runs/{testRunId}/complete - 将API响应中的返回给用户。
reportUrl
Retrieve an Artifact
获取制品
- Call with
artifact-url,type=report,video, ortrace.screenshot - Download from the returned signed URL before it expires.
- For binary artifacts, save with an appropriate filename extension.
- 调用接口,指定
artifact-url、type=report、video或trace。screenshot - 在URL过期前从返回的签名URL下载内容。
- 对于二进制制品,保存时使用合适的文件扩展名。