2.0.21 • Published 9 years ago
playr-json-scenario v2.0.21
playr-json-scenario
plays back request scenarios defined in a json file
let Playr = require('playr');
let JSONScenario = require('playr-json-scenario');
let playbook = new Playr();
playbook.run(new JSONScenario({
path: __dirname+'/scenario.json'
, url: 'http://master.cornercard.joinbox.com'
, log: true
}));
playbook.use(new JSONScenario.ResponseValidator());
playbook.play().then((stats) => {
done();
}).catch(log);
Example Scenario
{
"author": "chrome-extension"
, "description": "requests on all available apis"
, "created": "2015-06-14 21:11:16"
, "updated": "2015-10-14 20:40:56"
, "version": "0.5.7"
, "protocolVersion": "0.1.x"
, "scenario": [{
"kind": "request"
, "id": "event-1"
, "request": {
"method": "GET"
, "url": "https://www.emotions.cornercard.ch/event"
, "headers": {
"accept": "application/json"
, "accept-language": "de,fr,it,en"
, "range": "0-60"
, "select": "*, eventData.*"
, "api-version": "1"
}
}
, "response": {
"status": 200
, "body": [{
"kind": "type"
, "type": "string"
}]
, "headers": {
"date": {
"kind": "type"
, "type": "date"
}
, "content-length": {
"kind": "comparator"
, "comparator": ">"
, "value": 200
, "type": "number"
}
}
, "content": {
"kind": "array"
, "length": {
"kind": "comparator"
, "comparator": "<"
, "type": "number"
, "value": 5000000
}
, "data": [{
"kind": "object"
, "data": {
"id": {
"kind": "comparator"
, "comparator": "<"
, "type": "number"
, "value": 500
, "optional": true
}
, "eventData": {
"kind": "array"
, "optional": false
, "data": {
"kind": "object"
, "data": {
"id": {
"kind": "comparator"
, "comparator": "<"
, "type": "number"
, "value": 50000000
}
}
}
}
}
}]
}
, "responseTime": {
"kind": "comparator"
, "comparator": "<"
, "type": "number"
, "value": 1000
}
}
}, {
"kind": "pause"
, "duration": 200
}, {
"kind": "request"
, "id": "event-2"
, "request": {
"method": "GET"
, "url": "https://www.emotions.cornercard.ch/event/{event-1[50].id}"
, "headers": {
"accept": "application/json"
, "accept-language": "de,fr,it,en"
, "range": "100-110"
, "select": "*, eventData.*"
, "api-version": "1"
}
}
, "response": {
"status": 200
, "body": [{
"kind": "regexp"
, "match": "presaleWebsiteUrl"
, "flags": "gi"
}, {
"kind": "type"
, "type": "string"
}]
, "headers": {
"date": {
"kind": "type"
, "type": "date"
}
, "content-length": {
"kind": "comparator"
, "comparator": "<"
, "value": 2000
, "type": "number"
}
}
, "content": {
"kind": "object"
, "data": {
"id": {
"kind": "comparator"
, "comparator": "<"
, "type": "number"
, "value": 500
, "optional": true
}
}
}
}
}]
}
2.0.21
9 years ago
2.0.20
9 years ago
2.0.19
9 years ago
2.0.18
9 years ago
2.0.17
9 years ago
2.0.16
9 years ago
2.0.15
9 years ago
2.0.14
10 years ago
2.0.13
10 years ago
2.0.12
10 years ago
2.0.11
10 years ago
2.0.10
10 years ago
2.0.9
10 years ago
2.0.8
10 years ago
2.0.7
10 years ago
2.0.5
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago