Skip to content

Commit

Permalink
feat: Add test-runs API (#233)
Browse files Browse the repository at this point in the history
* feat: Add test-runs api

* adjust request structure

* add us-east-4
  • Loading branch information
tianfeng92 committed Jan 10, 2024
1 parent fe16a47 commit 6157efe
Show file tree
Hide file tree
Showing 5 changed files with 423 additions and 26 deletions.
357 changes: 357 additions & 0 deletions apis/testruns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,357 @@
{
"swagger": "2.0",
"info": {
"title": "test-runs-api",
"version": "1.0.1"
},
"basePath": "/test-runs",
"servers": [
{
"url": "https://api.{region}.saucelabs.{tld}",
"variables": {
"region": {
"default": "us-west-1",
"description": "region of datacenter",
"enum": ["us-west-1", "eu-central-1", "us-east-4", "staging"]
},
"tld": {
"default": "com",
"description": "internal or external API",
"enum": ["net", "com"]
}
}
}
],
"paths": {
"/v1/": {
"post": {
"summary": "Post Test Runs",
"operationId": "createTestRunsV1",
"parameters": [
{
"in": "body",
"name": "parameters",
"required": true,
"description": "create test runs request body",
"schema": {
"$ref": "#/definitions/TestRuns"
}
}
],
"responses": {
"204": {
"description": "Test runs successfully created with no content returned"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/HTTPValidationError"
}
}
}
}
}
}
}
},
"definitions": {
"ApiTesting": {
"title": "ApiTesting",
"type": "object",
"properties": {
"run_id": {
"title": "Run Id",
"type": "string"
},
"run_name": {
"title": "Run Name",
"type": "string"
},
"run_mode": {
"title": "Run Mode",
"type": "string"
},
"project_id": {
"title": "Project Id",
"type": "string"
},
"project_name": {
"title": "Project Name",
"type": "string"
},
"failures_count": {
"title": "Failures Count",
"type": "integer"
},
"warning_count": {
"title": "Warning Count",
"type": "integer"
}
}
},
"Ci": {
"title": "Ci",
"type": "object",
"properties": {
"ref_name": {
"title": "Ref Name",
"type": "string"
},
"commit_sha": {
"title": "Commit Sha",
"type": "string"
},
"repository": {
"title": "Repository",
"type": "string"
},
"branch": {
"title": "Branch",
"type": "string"
}
}
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/definitions/ValidationError"
}
}
}
},
"TestRunPlatform": {
"title": "TestRunPlatform",
"enum": ["vdc", "rdc", "api", "other"],
"type": "string",
"description": "An enumeration."
},
"SauceJob": {
"title": "SauceJob",
"type": "object",
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
}
},
"Status": {
"title": "Status",
"enum": ["passed", "failed", "skipped"],
"type": "string",
"description": "An enumeration."
},
"TestRunTestError": {
"title": "TestRunTestError",
"type": "object",
"properties": {
"message": {
"title": "Message",
"type": "string"
},
"path": {
"title": "Path",
"type": "string"
},
"line": {
"title": "Line",
"type": "integer"
}
}
},
"TestRun": {
"title": "TestRun",
"required": ["name", "start_time", "end_time", "duration"],
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"id": {
"title": "Id",
"type": "string"
},
"user_id": {
"title": "User Id",
"type": "string"
},
"org_id": {
"title": "Org Id",
"type": "string"
},
"team_id": {
"title": "Team Id",
"type": "string"
},
"group_id": {
"title": "Group Id",
"type": "string"
},
"author_id": {
"title": "Author Id",
"type": "string"
},
"path_name": {
"title": "Path Name",
"type": "string"
},
"build_id": {
"title": "Build Id",
"type": "string"
},
"build_name": {
"title": "Build Name",
"type": "string"
},
"creation_time": {
"title": "Creation Time",
"type": "string",
"format": "date-time"
},
"start_time": {
"title": "Start Time",
"type": "string",
"format": "date-time"
},
"end_time": {
"title": "End Time",
"type": "string",
"format": "date-time"
},
"duration": {
"title": "Duration",
"type": "integer"
},
"browser": {
"title": "Browser",
"type": "string"
},
"device": {
"title": "Device",
"type": "string"
},
"os": {
"title": "Os",
"type": "string"
},
"app_name": {
"title": "App Name",
"type": "string"
},
"status": {
"type": "string",
"allOf": [
{
"$ref": "#/definitions/Status"
}
],
"default": "skipped"
},
"platform": {
"type": "string",
"allOf": [
{
"$ref": "#/definitions/TestRunPlatform"
}
],
"default": "other"
},
"type": {
"type": "string",
"allOf": [
{
"$ref": "#/definitions/TestType"
}
],
"default": "other"
},
"framework": {
"title": "Framework",
"type": "string"
},
"ci": {
"$ref": "#/definitions/Ci"
},
"api_testing": {
"$ref": "#/definitions/ApiTesting"
},
"sauce_job": {
"$ref": "#/definitions/SauceJob"
},
"errors": {
"title": "Errors",
"type": "array",
"items": {
"$ref": "#/definitions/TestRunTestError"
}
},
"tags": {
"title": "Tags",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"TestRuns": {
"type": "object",
"properties": {
"test_runs": {
"title": "TestRuns",
"type": "array",
"items": {
"$ref": "#/definitions/TestRun"
}
}
}
},
"TestType": {
"title": "TestType",
"enum": ["web", "mobile", "api", "other"],
"type": "string",
"description": "An enumeration."
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
}
}
}
8 changes: 8 additions & 0 deletions docs/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -910,4 +910,12 @@ This endpoint requires API Key authentication and will also return your private
<br><h4>Options</h4>
<ul> <li><b>user_id</b>: user_id</li> <li><b>org_id</b>: org_id</li> <li><b>group_id</b>: group_id</li> <li><b>team_id</b>: team_id</li> <li><b>modified_since</b>: modified_since</li> <li><b>completed</b>: completed</li> <li><b>errored</b>: errored</li> <li><b>failed</b>: failed</li> <li><b>finished</b>: finished</li> <li><b>new</b>: new</li> <li><b>passed</b>: passed</li> <li><b>public</b>: public</li> <li><b>queued</b>: queued</li> <li><b>running</b>: running</li> <li><b>faulty</b>: faulty</li> <li><b>limit</b>: Number of results to return</li> <li><b>offset</b>: Starting number</li> </ul> </td>
</tr>
<tr>
<td>
<b>POST</b> <code>/v1/</code><br>
Post Test Runs
<h3>Example:</h3>
<code>api.createTestRunsV1(parameters)</code>
</td>
</tr>
</tbody></table>
Loading

0 comments on commit 6157efe

Please sign in to comment.