We are pleased to announce today some new features available immediately via the Ghost Inspector API! You now have the ability to duplicate a test or duplicate a suite simply by calling an endpoint on our API.
Here are some examples:
Duplicating a test
Here is an example of an API call using curl
to duplicate a test:
$ curl -s "https://api.ghostinspector.com/v1/tests/{{testId}}/duplicate/?apiKey={{apiKey}}"
The resulting test will be duplicated into the same suite and organization as the original. The API response will contain the duplicated test which will be an exact copy of the original except for the name
and _id
:
{
"code": "SUCCESS",
"data": {
"user": "59fcf3db937eed176d5d28dc",
"startUrl": "http://ghostinspector.com/docs/",
"suite": {
"_id": "59fcf3e9937eed176d5d28e0",
"name": "API Samples"
},
"organization": {
"_id": "59fcf3dc937eed176d5d28dd",
"name": "Sample Organization"
},
"__v": 0,
"_id": "59fcf45e13df81176e885d29",
"dateCreated": "2017-11-03T22:57:34.733Z",
"dateUpdated": "2017-11-03T22:57:34.733Z",
"dateExecutionFinished": "1970-01-01T00:00:00.000Z",
"dateExecutionStarted": "1970-01-01T00:00:00.000Z",
"dateExecutionTriggered": "1970-01-01T00:00:00.000Z",
"screenshotComparePassing": null,
"screenshotCompareThreshold": 0.1,
"screenshotCompareEnabled": null,
"passing": null,
"filters": [],
"steps": [
{
"command": "assign",
"target": ".header-search-input",
"value": "frames",
"variableName": "",
"optional": false,
"private": false,
"sequence": 0
},
{
"command": "click",
"target": ".header-search-button",
"value": "",
"variableName": "",
"optional": false,
"private": false,
"sequence": 1
},
{
"command": "assertTextPresent",
"target": ".content .search-input",
"value": "frames",
"variableName": "",
"optional": false,
"private": false,
"sequence": 2
}
],
"failOnJavaScriptError": null,
"autoRetry": null,
"finalDelay": 5000,
"maxAjaxDelay": 10000,
"maxWaitDelay": 15000,
"globalStepDelay": 250,
"httpHeaders": [],
"testFrequencyAdvanced": [],
"testFrequency": 0,
"name": "Test #2 (Copy)"
}
}
Duplicating a suite
Here is an example of an API call using curl
to duplicate a suite:
$ curl -s "https://api.ghostinspector.com/v1/suites/{{suiteId}}/duplicate/?apiKey={{apiKey}}"
The resulting suite will also be duplicated into the same organization as the original. The API response will contain the duplicated suite which will also be an exact copy of the original except for the name
and _id
:
{
"code": "SUCCESS",
"data": {
"_id": "5a00bab816ff5929f6219918",
"organization": {
"_id": "52df0d27fbaced54db000006",
"name": "Organization Name"
},
"dateCreated": "2017-11-04T10:29:05.645Z",
"variables": [
{
"name": "firstName",
"value": "justin",
"private": false
},
"screenshotCompareThreshold": 0.1,
"screenshotCompareEnabled": true,
"viewportSize": {
"height": 768,
"width": 1024
},
"failOnJavaScriptError": false,
"autoRetry": true,
"browser": "slimerjs",
"region": "us-east-1",
"httpHeaders": [],
"maxConcurrentTests": 0,
"testFrequencyAdvanced": [],
"testFrequency": 0,
"testCount": 2,
"name": "Sample Suite (Copy)"
}
}
And that’s it!
Feel free to check out the API documentation to see more features of the Ghost Inspector API. If you run into any problems, feel free to drop us a line at Support or click the little chat bubble down below any time and we’ll be happy to help you out.
Happy Ghosting!