CaseRun
A CaseRun
is the result object of running a Case
for a specific Site
. Essentially, CaseRuns
allow the user to reuse Cases
for multiple Sites
across the application. A CaseRun
contains all the same components as it's associated Case
as well as expanded information for each step.
CaseRun object
{
"id":"dd1f4670-8547-4fa8-8000-55c8e2dc20be", // uuid specific to the CaseRun
"site":"c1ebc475-b214-4a31-99f2-cb875ea1c185", // uuid specific to the associated Site
"time_created":"2022-06-30T16:42:33.888151Z", // timestamp of CaseRun creation
"time_completed":"2022-06-30T16:44:00.660156Z", // timestamp of CaseRun completion
"case":"e458dbb0-0d29-4d01-a67a-b39899614504", // uuid specific to the associated Case
"title":"contact form", // title of associated Case
"passed":true, // Bool noting if the CaseRun passed or failed
"tags": ["tag1", "tag2"], // <optional> list of info for user to track data
"configs":{ // configs object
"browser":"chrome", // either chrome or firefox
"device":"desktop", // either desktop or mobile
"window_size":"1920,1080", // dimensions of webdriver window. format -> (width,height)
"max_wait_time":30, // max time, in seconds, to wait for element to to be visible
"min_wait_time":10 // time, in seconds, to wait in between each step
},
"steps":[
{
"action":{ // action component
"key":"", // key value used for "keyDown" actions - "Enter", "Tab", etc.
"path":"/", // path to navigate to (NOTE: all paths should be relative - no "https://example.com/")
"type":"navigate", // action type - "click", "navigate", "change", "keyDown"
"value":"", // value you want to "change" the element to "some text"
"passed":true, // bool noting of the specific action passed or failed
"element":"", // selector of element - "navbarSupportedContent > ul > li:nth-child(3) > a"
"exception":null, // exception details if the action failed
"time_created":"2022-06-30 16:42:34.398921", // timestamp when action started
"time_completed":"2022-06-30 16:42:49.900984" // timestamp when action completed
},
"assertion":{
"type":"",
"value":"",
"passed":null,
"element":"",
"exception":null,
"time_created":null,
"time_completed":null
}
},
]
}
Create a CaseRun
This endpoint allows the creation task to run asynchronously on the server and resolves quickly. Depending on the lenght of the associated Case
, this process may take several minutes to complete.
data
in this request:
"data": {
"site_id": "<site:id>", // <required> uuid of the Site you want to run the CaseRun for
"case_id": "<case:id>", // <required> uuid of the Case you want to run
"tags": ["tag1", "tag2"], // <optional> list of info for user to track data
"updates": [ // <optional> list of changes you want to make to the Case's default values (referenced by index)
{
"index": 3, // index of the step you want to update (index = 0 is the first setp)
"value": "jane@example.com" // new value you want to update the action value to
}
],
"configs": { // <optional> configs object
"browser":"chrome", // browser to be used for the tasks, either chrome or firefox
"device":"desktop", // either desktop or mobile
"window_size":"1920,1080", // dimensions of webdriver window. format -> (width,height)
"max_wait_time":30, // max time, in seconds, to wait for element to to be visible
"min_wait_time":10, // time, in seconds, to wait in between each step
"create_issue": true, // bool which, when true, will automatically create an `Issue` object if the caserun fails
},
}
Warning
Passing the configs
object is optional. However, if you do pass the object you must specify all sub-components.
POST - /caserun
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{CURSION_API_BASE_URL}/caserun'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
data = {
"site_id": "<site:id>",
"case_id": "<case:id>",
"tags": ["tag1", "tag2"],
"updates": [
{
"index": 3,
"value": "jane@example.com"
}
]
"configs": {
"device":"desktop",
"window_size":"1920,1080",
"max_wait_time":30,
"min_wait_time":10,
"create_issue": True,
},
}
# send the request
res = requests.post(
url=url,
headers=headers,
data=json.dumps(data)
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id": "dd1f4670-8547-4fa8-8000-55c8e2dc20be",
"site": "c1ebc475-b214-4a31-99f2-cb875ea1c185",
"time_created": "2022-06-30T16:42:33.888151Z",
"time_completed": null,
"case": "e458dbb0-0d29-4d01-a67a-b39899614504",
"title": "contact form",
"tags": ["tag1", "tag2"],
"passed": false,
"configs": {
"device": "desktop",
"window_size": "1920,1080",
"max_wait_time": 30,
"min_wait_time": 10
},
"steps": [
{
"action": {
"key": "",
"path": "/",
"type": "navigate",
"value": "",
"passed": null,
"element": "",
"exception": null,
"time_created": null,
"time_completed": null
},
"assertion" :{
"type": "",
"value": "",
"passed": null,
"element": "",
"exception": null,
"time_created": null,
"time_completed": null
}
},
{
"action": {
"key": "",
"path": "",
"type": "change",
"value": "My Company inc",
"passed": null,
"element": "#leadCapCompany",
"exception": null,
"time_created": null,
"time_completed": null
},
"assertion": {
"text": "Can we grab your info real quick?",
"type": "match",
"value": "Can we grab your info real quick?",
"passed": null,
"element": "#layoutDefault_content > main > header > div.page-header-content > div > div > div:nth-child(1) > h1",
"exception": null,
"time_created": null,
"time_completed": null
}
},
# SHOETENED FOR DISPLAY PURPOSES
],
}
Retrieve a CaseRun
This endpoint returns a single CaseRun
object and is useful as a simple "detailed view" of the caserun.
GET - /caserun/<caserun:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/caserun/<caserun:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id": "dd1f4670-8547-4fa8-8000-55c8e2dc20be",
"site": "c1ebc475-b214-4a31-99f2-cb875ea1c185",
"time_created": "2022-06-30T16:42:33.888151Z",
"time_completed": "2022-06-30T16:44:00.660156Z",
"case": "e458dbb0-0d29-4d01-a67a-b39899614504",
"title": "contact form",
"tags": ["tag1", "tag2"],
"passed": true,
"configs": {
"device": "desktop",
"window_size": "1920,1080",
"max_wait_time": "30",
"min_wait_time": 10
},
"steps": [
{
"action": {
"key": "",
"path": "/",
"type": "navigate",
"value": "",
"passed": true,
"element": "",
"exception": null,
"time_created": "2022-06-30 16:42:34.398921",
"time_completed": "2022-06-30 16:42:49.900984"
},
"assertion" :{
"type": "",
"value": "",
"passed": null,
"element": "",
"exception": null,
"time_created": null,
"time_completed": null
}
},
{
"action": {
"key": "",
"path": "",
"type": "change",
"value": "My Company inc",
"passed": true,
"element": "#leadCapCompany",
"exception": null,
"time_created": "2022-06-30 16:43:40.467322",
"time_completed": "2022-06-30 16:43:50.559047"
},
"assertion": {
"text": "Can we grab your info real quick?",
"type": "match",
"value": "Can we grab your info real quick?",
"passed": true,
"element": "#layoutDefault_content > main > header > div.page-header-content > div > div > div:nth-child(1) > h1",
"exception": null,
"time_created": "2022-06-30 16:43:50.568624",
"time_completed": "2022-06-30 16:43:50.579592"
}
},
# SHOETENED FOR DISPLAY PURPOSES
],
}
Retrieve many CaseRuns
This endpoint returns a paginated response with all CaseRuns
objects filtered by your account and ordered by time_created
. This endpoint is useful when needing to displaying your caseruns in a table view for example. The limit
parameter specifies the total number of objects you want returned per "group" (we recommend keeping this under 10 for best performance). The offset
parameter specfies which "group" to return. For example, limit=10&offset=10
in a total dataset of 30 objects would return 10 caseruns in range caserun #10 - caserun #20.
Tips
Additionally, an optional parameter is site_id=<site:id>
which would limit the objects filtering to the associated site.
GET - /caserun?limit=10&offset=0
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/caserun?limit=10&offset=0'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"count":30,
"next":"https://api.cursion.dev/v1/ops/caserun?limit=10&offset=20",
"previous":"https://api.cursion.dev/v1/ops/caserun?limit=10&offset=10",
"results":[
{
"id": "dd1f4670-8547-4fa8-8000-55c8e2dc20be",
"site": "c1ebc475-b214-4a31-99f2-cb875ea1c185",
"time_created": "2022-06-30T16:42:33.888151Z",
"time_completed": "2022-06-30T16:44:00.660156Z",
"case": "e458dbb0-0d29-4d01-a67a-b39899614504",
"title": "contact form1",
"tags": ["tag1", "tag2"],
"passed": true,
"configs": {
"device": "desktop",
"window_size": "1920,1080",
"max_wait_time": "30",
"min_wait_time": 10
},
"steps": [
{
"action": {
"key": "",
"path": "/",
"type": "navigate",
"value": "",
"passed": true,
"element": "",
"exception": null,
"time_created": "2022-06-30 16:42:34.398921",
"time_completed": "2022-06-30 16:42:49.900984"
},
"assertion" :{
"type": "",
"value": "",
"passed": null,
"element": "",
"exception": null,
"time_created": null,
"time_completed": null
}
},
{
"action": {
"key": "",
"path": "",
"type": "change",
"value": "My Company inc",
"passed": true,
"element": "#leadCapCompany",
"exception": null,
"time_created": "2022-06-30 16:43:40.467322",
"time_completed": "2022-06-30 16:43:50.559047"
},
"assertion": {
"text": "Can we grab your info real quick?",
"type": "match",
"value": "Can we grab your info real quick?",
"passed": true,
"element": "#layoutDefault_content > main > header > div.page-header-content > div > div > div:nth-child(1) > h1",
"exception": null,
"time_created": "2022-06-30 16:43:50.568624",
"time_completed": "2022-06-30 16:43:50.579592"
}
},
# SHOETENED FOR DISPLAY PURPOSES
],
}
{
"id": "dd1f4670-8547-4fa8-8000-55c8e2dc20be",
"site": "c1ebc475-b214-4a31-99f2-cb875ea1c185",
"time_created": "2022-06-30T16:42:33.888151Z",
"time_completed": "2022-06-30T16:44:00.660156Z",
"case": "e458dbb0-0d29-4d01-a67a-b39899614504",
"title": "contact form2",
"tags": ["tag1", "tag2"],
"passed": true,
"configs": {
"device": "desktop",
"window_size": "1920,1080",
"max_wait_time": "30",
"min_wait_time": 10
},
"steps": [
{
"action": {
"key": "",
"path": "/",
"type": "navigate",
"value": "",
"passed": true,
"element": "",
"exception": null,
"time_created": "2022-06-30 16:42:34.398921",
"time_completed": "2022-06-30 16:42:49.900984"
},
"assertion" :{
"type": "",
"value": "",
"passed": null,
"element": "",
"exception": null,
"time_created": null,
"time_completed": null
}
},
{
"action": {
"key": "",
"path": "",
"type": "change",
"value": "My Company inc",
"passed": true,
"element": "#leadCapCompany",
"exception": null,
"time_created": "2022-06-30 16:43:40.467322",
"time_completed": "2022-06-30 16:43:50.559047"
},
"assertion": {
"text": "Can we grab your info real quick?",
"type": "match",
"value": "Can we grab your info real quick?",
"passed": true,
"element": "#layoutDefault_content > main > header > div.page-header-content > div > div > div:nth-child(1) > h1",
"exception": null,
"time_created": "2022-06-30 16:43:50.568624",
"time_completed": "2022-06-30 16:43:50.579592"
}
},
# SHOETENED FOR DISPLAY PURPOSES
],
}
### SHORTENED FOR DISPLAY PURPOSES ###
]
}
Delete a CaseRun
Caution
Please use caution with this endpoint as it is irreversible.
DELETE - /caserun/<tescaset:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/caserun/<caserun:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.delete(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"message": "caserun deleted successfully"
}