insomnia/packages/insomnia-smoke-test/fixtures/after-response-collection.yaml

111 lines
3.5 KiB
YAML
Raw Normal View History

feat: enable major features of the after-response script (#7411) * feat: update data model and request-pane to support post-req-script * fix: unit test failed * feat: integrate post-request script to the engine - INS-3785,INS-3786 (#7329) * feat: integrate post-request script to the engine * refactor: some minor improvements * fix: lint error * chore: clean up typings * refactor: separate transforming into sync and async parts * use named args * fix: renaming pre-req vars, functions and 2 minor fixes * fix: the error message is updated * feat: add snippets for post-request scripting (#7395) * feat: enable extended assertion chains on `insomnia.response` (#7396) * feat: add snippets for post-request scripting * feat(sdk): support response.to.have assertion for verifying response * chore: fix lint error --------- Co-authored-by: jackkav <jackkav@gmail.com> * test: add tests for post-request scripts and post-request scripts - INS-3786 (#7331) * test: add some tests for post-req script and script engine * fix: incorrect script type * chore: refresh package-lock after merging * chore: clean up package-lock.json * fix: failed tests after rebasing * feat: support importing post-req script from Postman (#7423) * feat: support importing post-req script from Postman * fix: introduce post-req script property for merged changes * test: add a test case for importing scripts * fix: add missing fixture * chore: remove row after merging * chore: rename to after-response-script * fix test * refresh lock * update snapshot * extract pre request logic to function * refresh lock again * throw on base env * fix: revert the logic which rejects the case of unselected environment --------- Co-authored-by: jackkav <jackkav@gmail.com>
2024-05-23 07:25:35 +00:00
_type: export
__export_format: 4
__export_date: 2024-02-13T07:27:17.322Z
__export_source: insomnia.desktop.app:v8.6.1
resources:
- _id: wrk_6b9b8455fd784462ae19cd51d7156f86
parentId: null
modified: 1707808692801
created: 1707808692801
name: After-response Scripts
description: ""
scope: collection
_type: workspace
- _id: req_244fe815da6c4342a17f0cfd98cf648c
parentId: wrk_6b9b8455fd784462ae19cd51d7156f86
modified: 1707809218855
created: 1707808697304
url: http://127.0.0.1:4010/echo
name: tests with expect and test
description: ""
method: POST
afterResponseScript: |-
insomnia.test('happy tests', () => {
insomnia.expect(200).to.eql(200);
insomnia.expect('uname').to.be.a('string');
insomnia.expect('a').to.have.lengthOf(1);
insomnia.expect('xxx_customer_id_yyy').to.include("customer_id");
insomnia.expect(201).to.be.oneOf([201,202]);
insomnia.expect(199).to.be.below(200);
// test objects
insomnia.expect({a: 1, b: 2}).to.have.all.keys('a', 'b');
insomnia.expect({a: 1, b: 2}).to.have.any.keys('a', 'b');
insomnia.expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');
insomnia.expect({a: 1}).to.have.property('a');
insomnia.expect({a: 1, b: 2}).to.be.a('object')
.that.has.all.keys('a', 'b');
});
insomnia.test('unhappy tests', () => {
insomnia.expect(199).to.eql(200);
insomnia.expect(199).to.be.oneOf([201,202]);
});
body:
mimeType: "application/json"
text: |-
{}
parameters: []
headers:
- name: 'Content-Type'
value: 'application/json'
authentication: {}
metaSortKey: -1707809028499
isPrivate: false
pathParameters: []
settingStoreCookies: true
settingSendCookies: true
settingDisableRenderRequestBody: false
settingEncodeUrl: true
settingRebuildPath: true
settingFollowRedirects: global
_type: request
- _id: req_244fe815da6c4342a17f0cfd98cf6401
parentId: wrk_6b9b8455fd784462ae19cd51d7156f86
modified: 1707809218855
created: 1707808697304
url: http://127.0.0.1:4010/echo
name: persist environments
description: ""
method: POST
afterResponseScript: |-
insomnia.environment.set('__fromAfterScript', 'environment');
insomnia.baseEnvironment.set('__fromAfterScript1', 'baseEnvironment');
insomnia.collectionVariables.set('__fromAfterScript2', 'collection');
insomnia.environment.replaceIn('{{ $timestamp }}');
feat: enable major features of the after-response script (#7411) * feat: update data model and request-pane to support post-req-script * fix: unit test failed * feat: integrate post-request script to the engine - INS-3785,INS-3786 (#7329) * feat: integrate post-request script to the engine * refactor: some minor improvements * fix: lint error * chore: clean up typings * refactor: separate transforming into sync and async parts * use named args * fix: renaming pre-req vars, functions and 2 minor fixes * fix: the error message is updated * feat: add snippets for post-request scripting (#7395) * feat: enable extended assertion chains on `insomnia.response` (#7396) * feat: add snippets for post-request scripting * feat(sdk): support response.to.have assertion for verifying response * chore: fix lint error --------- Co-authored-by: jackkav <jackkav@gmail.com> * test: add tests for post-request scripts and post-request scripts - INS-3786 (#7331) * test: add some tests for post-req script and script engine * fix: incorrect script type * chore: refresh package-lock after merging * chore: clean up package-lock.json * fix: failed tests after rebasing * feat: support importing post-req script from Postman (#7423) * feat: support importing post-req script from Postman * fix: introduce post-req script property for merged changes * test: add a test case for importing scripts * fix: add missing fixture * chore: remove row after merging * chore: rename to after-response-script * fix test * refresh lock * update snapshot * extract pre request logic to function * refresh lock again * throw on base env * fix: revert the logic which rejects the case of unselected environment --------- Co-authored-by: jackkav <jackkav@gmail.com>
2024-05-23 07:25:35 +00:00
body:
mimeType: "application/json"
text: |-
{}
parameters: []
headers:
- name: 'Content-Type'
value: 'application/json'
authentication: {}
metaSortKey: -1707809028499
isPrivate: false
pathParameters: []
settingStoreCookies: true
settingSendCookies: true
settingDisableRenderRequestBody: false
settingEncodeUrl: true
settingRebuildPath: true
settingFollowRedirects: global
_type: request
- _id: env_f9ef1d097c5e00986051fcb4f7a921eea1a86916
parentId: wrk_6b9b8455fd784462ae19cd51d7156f86
modified: 1707808692805
created: 1707808692805
name: Base Environment
data: {}
dataPropertyOrder: null
color: null
isPrivate: false
metaSortKey: 1707808692805
_type: environment
- _id: jar_f9ef1d097c5e00986051fcb4f7a921eea1a86916
parentId: wrk_6b9b8455fd784462ae19cd51d7156f86
modified: 1707808692807
created: 1707808692807
name: Default Jar
cookies: []
_type: cookie_jar