@serenity-js/rest 3.0.0-rc.18 → 3.0.0-rc.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/model/DeleteRequest.d.ts +9 -9
  3. package/lib/model/DeleteRequest.js +8 -8
  4. package/lib/model/DeleteRequest.js.map +1 -1
  5. package/lib/model/GetRequest.d.ts +9 -9
  6. package/lib/model/GetRequest.js +8 -8
  7. package/lib/model/GetRequest.js.map +1 -1
  8. package/lib/model/HTTPRequest.d.ts +3 -3
  9. package/lib/model/HTTPRequest.js.map +1 -1
  10. package/lib/model/HeadRequest.d.ts +9 -9
  11. package/lib/model/HeadRequest.js +8 -8
  12. package/lib/model/HeadRequest.js.map +1 -1
  13. package/lib/model/OptionsRequest.d.ts +8 -8
  14. package/lib/model/OptionsRequest.js +7 -7
  15. package/lib/model/OptionsRequest.js.map +1 -1
  16. package/lib/model/PatchRequest.d.ts +7 -7
  17. package/lib/model/PatchRequest.js +6 -6
  18. package/lib/model/PatchRequest.js.map +1 -1
  19. package/lib/model/PostRequest.d.ts +18 -18
  20. package/lib/model/PostRequest.js +17 -17
  21. package/lib/model/PostRequest.js.map +1 -1
  22. package/lib/model/PutRequest.d.ts +8 -8
  23. package/lib/model/PutRequest.js +7 -7
  24. package/lib/model/PutRequest.js.map +1 -1
  25. package/lib/screenplay/abilities/CallAnApi.d.ts +2 -2
  26. package/lib/screenplay/abilities/CallAnApi.js.map +1 -1
  27. package/package.json +5 -5
  28. package/src/model/DeleteRequest.ts +10 -10
  29. package/src/model/GetRequest.ts +10 -10
  30. package/src/model/HTTPRequest.ts +2 -2
  31. package/src/model/HeadRequest.ts +10 -10
  32. package/src/model/OptionsRequest.ts +9 -9
  33. package/src/model/PatchRequest.ts +8 -8
  34. package/src/model/PostRequest.ts +19 -19
  35. package/src/model/PutRequest.ts +9 -9
  36. package/src/screenplay/abilities/CallAnApi.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-rc.19](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.18...v3.0.0-rc.19) (2022-06-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **rest:** updated Axios to 0.27.2 ([b54694b](https://github.com/serenity-js/serenity-js/commit/b54694ba3dd2b8e0316d94c44381f51b1ab79ad0)), closes [axios/axios#4124](https://github.com/axios/axios/issues/4124) [#1223](https://github.com/serenity-js/serenity-js/issues/1223)
12
+
13
+
14
+ ### Features
15
+
16
+ * **core:** Question.fromObject() generates questions from plain objects with nested Answerables ([3113f20](https://github.com/serenity-js/serenity-js/commit/3113f20ed5c86cb4bcf11479855d4ceaa5696970)), closes [#1219](https://github.com/serenity-js/serenity-js/issues/1219)
17
+
18
+
19
+
20
+
21
+
6
22
  # [3.0.0-rc.18](https://github.com/serenity-js/serenity-js/compare/v2.33.9...v3.0.0-rc.18) (2022-06-06)
7
23
 
8
24
 
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -8,13 +8,13 @@ import { HTTPRequest } from './HTTPRequest';
8
8
  * functionality.
9
9
  *
10
10
  * @example <caption>Create and remove a resource</caption>
11
- * import { Actor } from '@serenity-js/core';
12
- * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest'
11
+ * import { actorCalled } from '@serenity-js/core';
12
+ * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest';
13
13
  * import { Ensure, equals, startsWith } from '@serenity-js/assertions';
14
14
  *
15
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
16
- *
17
- * actor.attemptsTo(
15
+ * await actorCalled('Apisit')
16
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
17
+ * .attemptsTo(
18
18
  * // create a new test user account
19
19
  * Send.a(PostRequest.to('/users').with({
20
20
  * login: 'tester',
@@ -26,7 +26,7 @@ import { HTTPRequest } from './HTTPRequest';
26
26
  * // delete the test user account
27
27
  * Send.a(DeleteRequest.to(LastResponse.header('Location'))),
28
28
  * Ensure.that(LastResponse.status(), equals(200)),
29
- * );
29
+ * );
30
30
  *
31
31
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
32
32
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.5
@@ -54,10 +54,10 @@ export declare class DeleteRequest extends HTTPRequest {
54
54
  * Overrides the default Axios request configuration provided
55
55
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
56
56
  *
57
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
57
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
58
58
  * Axios request configuration overrides
59
59
  *
60
60
  * @returns {DeleteRequest}
61
61
  */
62
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): DeleteRequest;
62
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): DeleteRequest;
63
63
  }
@@ -10,13 +10,13 @@ const HTTPRequest_1 = require("./HTTPRequest");
10
10
  * functionality.
11
11
  *
12
12
  * @example <caption>Create and remove a resource</caption>
13
- * import { Actor } from '@serenity-js/core';
14
- * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest'
13
+ * import { actorCalled } from '@serenity-js/core';
14
+ * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest';
15
15
  * import { Ensure, equals, startsWith } from '@serenity-js/assertions';
16
16
  *
17
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
18
- *
19
- * actor.attemptsTo(
17
+ * await actorCalled('Apisit')
18
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
19
+ * .attemptsTo(
20
20
  * // create a new test user account
21
21
  * Send.a(PostRequest.to('/users').with({
22
22
  * login: 'tester',
@@ -28,7 +28,7 @@ const HTTPRequest_1 = require("./HTTPRequest");
28
28
  * // delete the test user account
29
29
  * Send.a(DeleteRequest.to(LastResponse.header('Location'))),
30
30
  * Ensure.that(LastResponse.status(), equals(200)),
31
- * );
31
+ * );
32
32
  *
33
33
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
34
34
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.5
@@ -58,13 +58,13 @@ class DeleteRequest extends HTTPRequest_1.HTTPRequest {
58
58
  * Overrides the default Axios request configuration provided
59
59
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
60
60
  *
61
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
61
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
62
62
  * Axios request configuration overrides
63
63
  *
64
64
  * @returns {DeleteRequest}
65
65
  */
66
66
  using(config) {
67
- return new DeleteRequest(this.resourceUri, undefined, core_1.Dictionary.of(config));
67
+ return new DeleteRequest(this.resourceUri, undefined, core_1.Question.fromObject(config));
68
68
  }
69
69
  }
70
70
  exports.DeleteRequest = DeleteRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteRequest.js","sourceRoot":"","sources":["../../src/model/DeleteRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,aAAc,SAAQ,yBAAW;IAE1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ;AAjCD,sCAiCC"}
1
+ {"version":3,"file":"DeleteRequest.js","sourceRoot":"","sources":["../../src/model/DeleteRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,aAAc,SAAQ,yBAAW;IAE1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACvF,CAAC;CACJ;AAjCD,sCAiCC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -15,8 +15,8 @@ import { HTTPRequest } from './HTTPRequest';
15
15
  * the server in the same state.
16
16
  *
17
17
  * @example <caption>Verify response to a GET request</caption>
18
- * import { Actor } from '@serenity-js/core';
19
- * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest'
18
+ * import { actorCalled } from '@serenity-js/core';
19
+ * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest';
20
20
  * import { Ensure, equals } from '@serenity-js/assertions';
21
21
  *
22
22
  * interface Book {
@@ -24,16 +24,16 @@ import { HTTPRequest } from './HTTPRequest';
24
24
  * author: string;
25
25
  * }
26
26
  *
27
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
28
- *
29
- * actor.attemptsTo(
27
+ * await actorCalled('Apisit')
28
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
29
+ * .attemptsTo(
30
30
  * Send.a(GetRequest.to('/books/0-688-00230-7')),
31
31
  * Ensure.that(LastResponse.status(), equals(200)),
32
32
  * Ensure.that(LastResponse.body<Book>(), equals({
33
33
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
34
34
  * author: 'Robert M. Pirsig',
35
35
  * })),
36
- * );
36
+ * );
37
37
  *
38
38
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
39
39
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.1
@@ -61,10 +61,10 @@ export declare class GetRequest extends HTTPRequest {
61
61
  * Overrides the default Axios request configuration provided
62
62
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
63
63
  *
64
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
64
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
65
65
  * Axios request configuration overrides
66
66
  *
67
67
  * @returns {GetRequest}
68
68
  */
69
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): GetRequest;
69
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): GetRequest;
70
70
  }
@@ -17,8 +17,8 @@ const HTTPRequest_1 = require("./HTTPRequest");
17
17
  * the server in the same state.
18
18
  *
19
19
  * @example <caption>Verify response to a GET request</caption>
20
- * import { Actor } from '@serenity-js/core';
21
- * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest'
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest';
22
22
  * import { Ensure, equals } from '@serenity-js/assertions';
23
23
  *
24
24
  * interface Book {
@@ -26,16 +26,16 @@ const HTTPRequest_1 = require("./HTTPRequest");
26
26
  * author: string;
27
27
  * }
28
28
  *
29
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
30
- *
31
- * actor.attemptsTo(
29
+ * await actorCalled('Apisit')
30
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
31
+ * .attemptsTo(
32
32
  * Send.a(GetRequest.to('/books/0-688-00230-7')),
33
33
  * Ensure.that(LastResponse.status(), equals(200)),
34
34
  * Ensure.that(LastResponse.body<Book>(), equals({
35
35
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
36
36
  * author: 'Robert M. Pirsig',
37
37
  * })),
38
- * );
38
+ * );
39
39
  *
40
40
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
41
41
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.1
@@ -65,13 +65,13 @@ class GetRequest extends HTTPRequest_1.HTTPRequest {
65
65
  * Overrides the default Axios request configuration provided
66
66
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
67
67
  *
68
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
68
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
69
69
  * Axios request configuration overrides
70
70
  *
71
71
  * @returns {GetRequest}
72
72
  */
73
73
  using(config) {
74
- return new GetRequest(this.resourceUri, undefined, core_1.Dictionary.of(config));
74
+ return new GetRequest(this.resourceUri, undefined, core_1.Question.fromObject(config));
75
75
  }
76
76
  }
77
77
  exports.GetRequest = GetRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"GetRequest.js","sourceRoot":"","sources":["../../src/model/GetRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,UAAW,SAAQ,yBAAW;IAEvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC;CACJ;AAjCD,gCAiCC"}
1
+ {"version":3,"file":"GetRequest.js","sourceRoot":"","sources":["../../src/model/GetRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,UAAW,SAAQ,yBAAW;IAEvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;CACJ;AAjCD,gCAiCC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core';
1
+ import { Answerable, AnswersQuestions, Question, UsesAbilities, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  /**
4
4
  * @desc
@@ -11,7 +11,7 @@ import { AxiosRequestConfig } from 'axios';
11
11
  export declare abstract class HTTPRequest extends Question<Promise<AxiosRequestConfig>> {
12
12
  protected readonly resourceUri?: Answerable<string>;
13
13
  protected readonly data?: Answerable<any>;
14
- protected readonly config?: Answerable<AxiosRequestConfig>;
14
+ protected readonly config?: Answerable<WithAnswerableProperties<AxiosRequestConfig>>;
15
15
  private subject;
16
16
  /**
17
17
  * @protected
@@ -26,7 +26,7 @@ export declare abstract class HTTPRequest extends Question<Promise<AxiosRequestC
26
26
  * Axios request configuration, which can be used to override the defaults
27
27
  * provided when the {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} is instantiated
28
28
  */
29
- protected constructor(resourceUri?: Answerable<string>, data?: Answerable<any>, config?: Answerable<AxiosRequestConfig>);
29
+ protected constructor(resourceUri?: Answerable<string>, data?: Answerable<any>, config?: Answerable<WithAnswerableProperties<AxiosRequestConfig>>);
30
30
  /**
31
31
  * @desc
32
32
  * Resolves the {@link Question} in the context of a given {@link @serenity-js/core/lib/screenplay/actor~Actor}
@@ -1 +1 @@
1
- {"version":3,"file":"HTTPRequest.js","sourceRoot":"","sources":["../../src/model/HTTPRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0F;AAC1F,iDAAqD;AAGrD;;;;;;;GAOG;AACH,MAAsB,WAAY,SAAQ,eAAqC;IAI3E;;;;;;;;;;;;OAYG;IACH,YACuB,WAAgC,EAChC,IAAsB,EACtB,MAAuC;QAE1D,KAAK,EAAE,CAAC;QAJW,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAkB;QACtB,WAAM,GAAN,MAAM,CAAiC;QAG1D,IAAI,CAAC,OAAO,GAAG,GAAI,IAAI,CAAC,kBAAkB,EAAG,OAAQ,IAAA,cAAS,EAAC,GAAI,IAAI,CAAC,WAAY,EAAG,EAAE,CAAC;IAC9F,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,KAAuC;QAC9C,OAAO,OAAO,CAAC,GAAG,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAQ,CAAC,CAAC,OAAO,CAAC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C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAI,IAAK,MAAO,UAAU,CAAC;IAC9E,CAAC;CACJ;AA7FD,kCA6FC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -8,17 +8,17 @@ import { HTTPRequest } from './HTTPRequest';
8
8
  * Such a request can be done before deciding to download a large resource to save bandwidth, for example.
9
9
  *
10
10
  * @example <caption>File download test</caption>
11
- * import { Actor } from '@serenity-js/core';
12
- * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest'
11
+ * import { actorCalled } from '@serenity-js/core';
12
+ * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest';
13
13
  * import { Ensure, equals } from '@serenity-js/assertions';
14
14
  *
15
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
16
- *
17
- * actor.attemptsTo(
15
+ * await actorCalled('Apisit')
16
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
17
+ * .attemptsTo(
18
18
  * Send.a(HeadRequest.to('/downloads/my-test-document.pdf')),
19
19
  * Ensure.that(LastResponse.status(), equals(200)),
20
20
  * Ensure.that(LastResponse.header('Content-Length'), equals(256)), // assuming we know the size of the document
21
- * );
21
+ * );
22
22
  *
23
23
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
24
24
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.2
@@ -46,10 +46,10 @@ export declare class HeadRequest extends HTTPRequest {
46
46
  * Overrides the default Axios request configuration provided
47
47
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
48
48
  *
49
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
49
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
50
50
  * Axios request configuration overrides
51
51
  *
52
52
  * @returns {HeadRequest}
53
53
  */
54
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): HeadRequest;
54
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): HeadRequest;
55
55
  }
@@ -10,17 +10,17 @@ const HTTPRequest_1 = require("./HTTPRequest");
10
10
  * Such a request can be done before deciding to download a large resource to save bandwidth, for example.
11
11
  *
12
12
  * @example <caption>File download test</caption>
13
- * import { Actor } from '@serenity-js/core';
14
- * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest'
13
+ * import { actorCalled } from '@serenity-js/core';
14
+ * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest';
15
15
  * import { Ensure, equals } from '@serenity-js/assertions';
16
16
  *
17
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
18
- *
19
- * actor.attemptsTo(
17
+ * await actorCalled('Apisit')
18
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
19
+ * .attemptsTo(
20
20
  * Send.a(HeadRequest.to('/downloads/my-test-document.pdf')),
21
21
  * Ensure.that(LastResponse.status(), equals(200)),
22
22
  * Ensure.that(LastResponse.header('Content-Length'), equals(256)), // assuming we know the size of the document
23
- * );
23
+ * );
24
24
  *
25
25
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
26
26
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.2
@@ -50,13 +50,13 @@ class HeadRequest extends HTTPRequest_1.HTTPRequest {
50
50
  * Overrides the default Axios request configuration provided
51
51
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
52
52
  *
53
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
53
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
54
54
  * Axios request configuration overrides
55
55
  *
56
56
  * @returns {HeadRequest}
57
57
  */
58
58
  using(config) {
59
- return new HeadRequest(this.resourceUri, undefined, core_1.Dictionary.of(config));
59
+ return new HeadRequest(this.resourceUri, undefined, core_1.Question.fromObject(config));
60
60
  }
61
61
  }
62
62
  exports.HeadRequest = HeadRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"HeadRequest.js","sourceRoot":"","sources":["../../src/model/HeadRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAExC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/E,CAAC;CACJ;AAjCD,kCAiCC"}
1
+ {"version":3,"file":"HeadRequest.js","sourceRoot":"","sources":["../../src/model/HeadRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAExC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,CAAC;CACJ;AAjCD,kCAiCC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -11,13 +11,13 @@ import { HTTPRequest } from './HTTPRequest';
11
11
  * resource action.
12
12
  *
13
13
  * @example <caption>File download test</caption>
14
- * import { Actor } from '@serenity-js/core';
15
- * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest'
14
+ * import { actorCalled } from '@serenity-js/core';
15
+ * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest';
16
16
  * import { Ensure, equals } from '@serenity-js/assertions';
17
17
  *
18
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
19
- *
20
- * actor.attemptsTo(
18
+ * await actorCalled('Apisit')
19
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
20
+ * .attemptsTo(
21
21
  * Send.a(OptionsRequest.to('/downloads/my-test-document.pdf')),
22
22
  * Ensure.that(LastResponse.status(), equals(200)),
23
23
  * Ensure.that(LastResponse.header('Allow'), equals('OPTIONS, GET, HEAD')),
@@ -49,10 +49,10 @@ export declare class OptionsRequest extends HTTPRequest {
49
49
  * Overrides the default Axios request configuration provided
50
50
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
51
51
  *
52
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
52
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
53
53
  * Axios request configuration overrides
54
54
  *
55
55
  * @returns {OptionsRequest}
56
56
  */
57
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): OptionsRequest;
57
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): OptionsRequest;
58
58
  }
@@ -13,13 +13,13 @@ const HTTPRequest_1 = require("./HTTPRequest");
13
13
  * resource action.
14
14
  *
15
15
  * @example <caption>File download test</caption>
16
- * import { Actor } from '@serenity-js/core';
17
- * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest'
16
+ * import { actorCalled } from '@serenity-js/core';
17
+ * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest';
18
18
  * import { Ensure, equals } from '@serenity-js/assertions';
19
19
  *
20
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
21
- *
22
- * actor.attemptsTo(
20
+ * await actorCalled('Apisit')
21
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
22
+ * .attemptsTo(
23
23
  * Send.a(OptionsRequest.to('/downloads/my-test-document.pdf')),
24
24
  * Ensure.that(LastResponse.status(), equals(200)),
25
25
  * Ensure.that(LastResponse.header('Allow'), equals('OPTIONS, GET, HEAD')),
@@ -53,13 +53,13 @@ class OptionsRequest extends HTTPRequest_1.HTTPRequest {
53
53
  * Overrides the default Axios request configuration provided
54
54
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
55
55
  *
56
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
56
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
57
57
  * Axios request configuration overrides
58
58
  *
59
59
  * @returns {OptionsRequest}
60
60
  */
61
61
  using(config) {
62
- return new OptionsRequest(this.resourceUri, undefined, core_1.Dictionary.of(config));
62
+ return new OptionsRequest(this.resourceUri, undefined, core_1.Question.fromObject(config));
63
63
  }
64
64
  }
65
65
  exports.OptionsRequest = OptionsRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsRequest.js","sourceRoot":"","sources":["../../src/model/OptionsRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,cAAe,SAAQ,yBAAW;IAE3C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,CAAC;CACJ;AAjCD,wCAiCC"}
1
+ {"version":3,"file":"OptionsRequest.js","sourceRoot":"","sources":["../../src/model/OptionsRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,cAAe,SAAQ,yBAAW;IAE3C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,CAAC;CACJ;AAjCD,wCAiCC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -8,12 +8,12 @@ import { HTTPRequest } from './HTTPRequest';
8
8
  *
9
9
  * @example <caption>Add new resource to a collection</caption>
10
10
  * import { Actor } from '@serenity-js/core';
11
- * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest'
11
+ * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest';
12
12
  * import { Ensure, equals } from '@serenity-js/assertions';
13
13
  *
14
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
15
- *
16
- * actor.attemptsTo(
14
+ * await actorCalled('Apisit')
15
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
16
+ * .attemptsTo(
17
17
  * Send.a(PatchRequest.to('/books/0-688-00230-7').with({
18
18
  * lastReadOn: '2016-06-16',
19
19
  * })),
@@ -56,10 +56,10 @@ export declare class PatchRequest extends HTTPRequest {
56
56
  * Overrides the default Axios request configuration provided
57
57
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
58
58
  *
59
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
59
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
60
60
  * Axios request configuration overrides
61
61
  *
62
62
  * @returns {PatchRequest}
63
63
  */
64
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PatchRequest;
64
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PatchRequest;
65
65
  }
@@ -10,12 +10,12 @@ const HTTPRequest_1 = require("./HTTPRequest");
10
10
  *
11
11
  * @example <caption>Add new resource to a collection</caption>
12
12
  * import { Actor } from '@serenity-js/core';
13
- * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest'
13
+ * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest';
14
14
  * import { Ensure, equals } from '@serenity-js/assertions';
15
15
  *
16
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
17
- *
18
- * actor.attemptsTo(
16
+ * await actorCalled('Apisit')
17
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
18
+ * .attemptsTo(
19
19
  * Send.a(PatchRequest.to('/books/0-688-00230-7').with({
20
20
  * lastReadOn: '2016-06-16',
21
21
  * })),
@@ -62,13 +62,13 @@ class PatchRequest extends HTTPRequest_1.HTTPRequest {
62
62
  * Overrides the default Axios request configuration provided
63
63
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
64
64
  *
65
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
65
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
66
66
  * Axios request configuration overrides
67
67
  *
68
68
  * @returns {PatchRequest}
69
69
  */
70
70
  using(config) {
71
- return new PatchRequest(this.resourceUri, this.data, core_1.Dictionary.of(config));
71
+ return new PatchRequest(this.resourceUri, this.data, core_1.Question.fromObject(config));
72
72
  }
73
73
  }
74
74
  exports.PatchRequest = PatchRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"PatchRequest.js","sourceRoot":"","sources":["../../src/model/PatchRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,YAAa,SAAQ,yBAAW;IAEzC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,CAAC;CACJ;AA9CD,oCA8CC"}
1
+ {"version":3,"file":"PatchRequest.js","sourceRoot":"","sources":["../../src/model/PatchRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,YAAa,SAAQ,yBAAW;IAEzC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACtF,CAAC;CACJ;AA9CD,oCA8CC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -16,13 +16,13 @@ import { HTTPRequest } from './HTTPRequest';
16
16
  * a correctly implemented HTTP REST API will create N resources with N different URIs.
17
17
  *
18
18
  * @example <caption>Add new resource to a collection</caption>
19
- * import { Actor } from '@serenity-js/core';
20
- * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
19
+ * import { actorCalled } from '@serenity-js/core';
20
+ * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest';
21
21
  * import { Ensure, equals } from '@serenity-js/assertions';
22
22
  *
23
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
24
- *
25
- * actor.attemptsTo(
23
+ * await actorCalled('Apisit')
24
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
25
+ * .attemptsTo(
26
26
  * Send.a(PostRequest.to('/books').with({
27
27
  * isbn: '0-688-00230-7',
28
28
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -32,21 +32,21 @@ import { HTTPRequest } from './HTTPRequest';
32
32
  * Ensure.that(LastResponse.header('Location'), equals('/books/0-688-00230-7')),
33
33
  * );
34
34
  *
35
- * @example <caption>Submit a HTML form</caption>
36
- * import { Actor } from '@serenity-js/core';
35
+ * @example <caption>Submit an HTML form</caption>
36
+ * import { actorCalled } from '@serenity-js/core';
37
37
  * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
38
38
  * import { Ensure, equals } from '@serenity-js/assertions';
39
39
  * import { stringify } from 'querystring';
40
40
  *
41
- * const
42
- * actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com')),
43
- * formData = stringify({
44
- * name: actor.name,
45
- * email: `${ actor.name }@example.com`,
46
- * text: 'Your website is great! Learnt a lot :-)'
47
- * });
41
+ * const formData = stringify({
42
+ * name: actor.name,
43
+ * email: `${ actor.name }@example.com`,
44
+ * text: 'Your website is great! Learnt a lot :-)'
45
+ * });
48
46
  *
49
- * actor.attemptsTo(
47
+ * await actorCalled('Apisit')
48
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
49
+ * .attemptsTo(
50
50
  * Send.a(PostRequest.to('/feedback').with(postData).using({
51
51
  * headers: {
52
52
  * 'Content-Type': 'application/x-www-form-urlencoded',
@@ -93,10 +93,10 @@ export declare class PostRequest extends HTTPRequest {
93
93
  * Overrides the default Axios request configuration provided
94
94
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
95
95
  *
96
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
96
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
97
97
  * Axios request configuration overrides
98
98
  *
99
99
  * @returns {PostRequest}
100
100
  */
101
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PostRequest;
101
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PostRequest;
102
102
  }
@@ -18,13 +18,13 @@ const HTTPRequest_1 = require("./HTTPRequest");
18
18
  * a correctly implemented HTTP REST API will create N resources with N different URIs.
19
19
  *
20
20
  * @example <caption>Add new resource to a collection</caption>
21
- * import { Actor } from '@serenity-js/core';
22
- * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
21
+ * import { actorCalled } from '@serenity-js/core';
22
+ * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest';
23
23
  * import { Ensure, equals } from '@serenity-js/assertions';
24
24
  *
25
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
26
- *
27
- * actor.attemptsTo(
25
+ * await actorCalled('Apisit')
26
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
27
+ * .attemptsTo(
28
28
  * Send.a(PostRequest.to('/books').with({
29
29
  * isbn: '0-688-00230-7',
30
30
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -34,21 +34,21 @@ const HTTPRequest_1 = require("./HTTPRequest");
34
34
  * Ensure.that(LastResponse.header('Location'), equals('/books/0-688-00230-7')),
35
35
  * );
36
36
  *
37
- * @example <caption>Submit a HTML form</caption>
38
- * import { Actor } from '@serenity-js/core';
37
+ * @example <caption>Submit an HTML form</caption>
38
+ * import { actorCalled } from '@serenity-js/core';
39
39
  * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
40
40
  * import { Ensure, equals } from '@serenity-js/assertions';
41
41
  * import { stringify } from 'querystring';
42
42
  *
43
- * const
44
- * actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com')),
45
- * formData = stringify({
46
- * name: actor.name,
47
- * email: `${ actor.name }@example.com`,
48
- * text: 'Your website is great! Learnt a lot :-)'
49
- * });
43
+ * const formData = stringify({
44
+ * name: actor.name,
45
+ * email: `${ actor.name }@example.com`,
46
+ * text: 'Your website is great! Learnt a lot :-)'
47
+ * });
50
48
  *
51
- * actor.attemptsTo(
49
+ * await actorCalled('Apisit')
50
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
51
+ * .attemptsTo(
52
52
  * Send.a(PostRequest.to('/feedback').with(postData).using({
53
53
  * headers: {
54
54
  * 'Content-Type': 'application/x-www-form-urlencoded',
@@ -99,13 +99,13 @@ class PostRequest extends HTTPRequest_1.HTTPRequest {
99
99
  * Overrides the default Axios request configuration provided
100
100
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
101
101
  *
102
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
102
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
103
103
  * Axios request configuration overrides
104
104
  *
105
105
  * @returns {PostRequest}
106
106
  */
107
107
  using(config) {
108
- return new PostRequest(this.resourceUri, this.data, core_1.Dictionary.of(config));
108
+ return new PostRequest(this.resourceUri, this.data, core_1.Question.fromObject(config));
109
109
  }
110
110
  }
111
111
  exports.PostRequest = PostRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"PostRequest.js","sourceRoot":"","sources":["../../src/model/PostRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAExC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/E,CAAC;CACJ;AA9CD,kCA8CC"}
1
+ {"version":3,"file":"PostRequest.js","sourceRoot":"","sources":["../../src/model/PostRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAExC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,CAAC;CACJ;AA9CD,kCA8CC"}
@@ -1,4 +1,4 @@
1
- import { Answerable, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { HTTPRequest } from './HTTPRequest';
4
4
  /**
@@ -15,13 +15,13 @@ import { HTTPRequest } from './HTTPRequest';
15
15
  * calling it once or several times successively has the same effect (that is no _side effect_).
16
16
  *
17
17
  * @example <caption>Create a new resource at a known location</caption>
18
- * import { Actor } from '@serenity-js/core';
19
- * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest'
18
+ * import { actorCalled } from '@serenity-js/core';
19
+ * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest';
20
20
  * import { Ensure, equals } from '@serenity-js/assertions';
21
21
  *
22
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
23
- *
24
- * actor.attemptsTo(
22
+ * await actorCalled('Apisit')
23
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
24
+ * .attemptsTo(
25
25
  * Send.a(PutRequest.to('/books/0-688-00230-7').with({
26
26
  * isbn: '0-688-00230-7',
27
27
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -66,10 +66,10 @@ export declare class PutRequest extends HTTPRequest {
66
66
  * Overrides the default Axios request configuration provided
67
67
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
68
68
  *
69
- * @param {@serenity-js/core/lib/screenplay/questions~DynamicRecord<AxiosRequestConfig>} config
69
+ * @param {WithAnswerableProperties<AxiosRequestConfig>} config
70
70
  * Axios request configuration overrides
71
71
  *
72
72
  * @returns {PutRequest}
73
73
  */
74
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PutRequest;
74
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PutRequest;
75
75
  }
@@ -17,13 +17,13 @@ const HTTPRequest_1 = require("./HTTPRequest");
17
17
  * calling it once or several times successively has the same effect (that is no _side effect_).
18
18
  *
19
19
  * @example <caption>Create a new resource at a known location</caption>
20
- * import { Actor } from '@serenity-js/core';
21
- * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest'
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest';
22
22
  * import { Ensure, equals } from '@serenity-js/assertions';
23
23
  *
24
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
25
- *
26
- * actor.attemptsTo(
24
+ * await actorCalled('Apisit')
25
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
26
+ * .attemptsTo(
27
27
  * Send.a(PutRequest.to('/books/0-688-00230-7').with({
28
28
  * isbn: '0-688-00230-7',
29
29
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -72,13 +72,13 @@ class PutRequest extends HTTPRequest_1.HTTPRequest {
72
72
  * Overrides the default Axios request configuration provided
73
73
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
74
74
  *
75
- * @param {@serenity-js/core/lib/screenplay/questions~DynamicRecord<AxiosRequestConfig>} config
75
+ * @param {WithAnswerableProperties<AxiosRequestConfig>} config
76
76
  * Axios request configuration overrides
77
77
  *
78
78
  * @returns {PutRequest}
79
79
  */
80
80
  using(config) {
81
- return new PutRequest(this.resourceUri, this.data, core_1.Dictionary.of(config));
81
+ return new PutRequest(this.resourceUri, this.data, core_1.Question.fromObject(config));
82
82
  }
83
83
  }
84
84
  exports.PutRequest = PutRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"PutRequest.js","sourceRoot":"","sources":["../../src/model/PutRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAG1E,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,UAAW,SAAQ,yBAAW;IAEvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAqD;QACvD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,iBAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC;CACJ;AA9CD,gCA8CC"}
1
+ {"version":3,"file":"PutRequest.js","sourceRoot":"","sources":["../../src/model/PutRequest.ts"],"names":[],"mappings":";;;AAAA,4CAAmF;AAGnF,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,UAAW,SAAQ,yBAAW;IAEvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,WAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAqB;QACtB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAgE;QAClE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;CACJ;AA9CD,gCA8CC"}
@@ -1,5 +1,5 @@
1
1
  import { Ability, UsesAbilities } from '@serenity-js/core';
2
- import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { AxiosDefaults, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
3
  /**
4
4
  * @desc
5
5
  * An {@link @serenity-js/core/lib/screenplay~Ability} that enables the {@link Actor} to call a HTTP API.
@@ -107,7 +107,7 @@ export declare class CallAnApi implements Ability {
107
107
  *
108
108
  * @see {@link AxiosRequestConfig}
109
109
  */
110
- modifyConfig(fn: (original: AxiosRequestConfig) => any): void;
110
+ modifyConfig(fn: (original: AxiosDefaults<any>) => any): void;
111
111
  /**
112
112
  * @desc
113
113
  * Sends a HTTP request to a specified url.
@@ -1 +1 @@
1
- {"version":3,"file":"CallAnApi.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/CallAnApi.ts"],"names":[],"mappings":";;;AAAA,4CAAiH;AACjH,iCAA0G;AAC1G,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAM,yDAAyD;AACzH,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAE,yDAAyD;AAEzH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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U,CAAC,sEAAsE,CAAC,CAAC;SAChG;QAED,OAAO,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAEO,iBAAiB,CAAC,gBAA8B;QACpD,OAAO,gBAAgB;aAClB,IAAI,CACD,YAAY,CAAC,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;YAEjC,OAAO,YAAY,CAAC;QACxB,CAAC,EACD,KAAK,CAAC,EAAE;YACJ,QAAQ,IAAI,EAAE;gBACV,KAAK,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;oBACxC,MAAM,IAAI,2BAAoB,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;gBACvE,KAAK,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;oBACpC,MAAM,IAAI,2BAAoB,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;gBAC1E,KAAK,KAAK,YAAY,SAAS;oBAC3B,MAAM,IAAI,yBAAkB,CAAC,wDAAwD,EAAE,KAAK,CAAC,CAAC;gBAClG,KAAK,CAAG,KAAoB,CAAC,QAAQ;oBACjC,MAAM,IAAI,2BAAoB,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC,CAAG,4BAA4B;gBACpG;oBACI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC;oBAEnC,OAAO,KAAK,CAAC,QAAQ,CAAC;aAC7B;QACL,CAAC,CACJ,CAAC;IACV,CAAC;CACJ;AA/JD,8BA+JC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenity-js/rest",
3
- "version": "3.0.0-rc.18",
3
+ "version": "3.0.0-rc.19",
4
4
  "description": "Test REST APIs with Serenity/JS",
5
5
  "author": {
6
6
  "name": "Jan Molak",
@@ -48,13 +48,13 @@
48
48
  "npm": "^6 || ^7 || ^8"
49
49
  },
50
50
  "dependencies": {
51
- "@serenity-js/core": "3.0.0-rc.18",
52
- "axios": "^0.21.4"
51
+ "@serenity-js/core": "3.0.0-rc.19",
52
+ "axios": "^0.27.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@documentation/esdoc-template": "3.0.0",
56
56
  "@integration/testing-tools": "3.0.0",
57
- "@serenity-js/assertions": "3.0.0-rc.18",
57
+ "@serenity-js/assertions": "3.0.0-rc.19",
58
58
  "@types/chai": "^4.3.1",
59
59
  "@types/mocha": "^9.1.1",
60
60
  "axios-mock-adapter": "^1.20.0",
@@ -62,5 +62,5 @@
62
62
  "ts-node": "^10.7.0",
63
63
  "typescript": "^4.7.2"
64
64
  },
65
- "gitHead": "e6b62850b6c59e661314e5675d1f196e7e4fce03"
65
+ "gitHead": "dda2a6eab593e2525aa67888f197e48f2e3ae148"
66
66
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -10,13 +10,13 @@ import { HTTPRequest } from './HTTPRequest';
10
10
  * functionality.
11
11
  *
12
12
  * @example <caption>Create and remove a resource</caption>
13
- * import { Actor } from '@serenity-js/core';
14
- * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest'
13
+ * import { actorCalled } from '@serenity-js/core';
14
+ * import { CallAnApi, DeleteRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest';
15
15
  * import { Ensure, equals, startsWith } from '@serenity-js/assertions';
16
16
  *
17
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
18
- *
19
- * actor.attemptsTo(
17
+ * await actorCalled('Apisit')
18
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
19
+ * .attemptsTo(
20
20
  * // create a new test user account
21
21
  * Send.a(PostRequest.to('/users').with({
22
22
  * login: 'tester',
@@ -28,7 +28,7 @@ import { HTTPRequest } from './HTTPRequest';
28
28
  * // delete the test user account
29
29
  * Send.a(DeleteRequest.to(LastResponse.header('Location'))),
30
30
  * Ensure.that(LastResponse.status(), equals(200)),
31
- * );
31
+ * );
32
32
  *
33
33
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
34
34
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.5
@@ -60,12 +60,12 @@ export class DeleteRequest extends HTTPRequest {
60
60
  * Overrides the default Axios request configuration provided
61
61
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
62
62
  *
63
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
63
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
64
64
  * Axios request configuration overrides
65
65
  *
66
66
  * @returns {DeleteRequest}
67
67
  */
68
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): DeleteRequest {
69
- return new DeleteRequest(this.resourceUri, undefined, Dictionary.of(config));
68
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): DeleteRequest {
69
+ return new DeleteRequest(this.resourceUri, undefined, Question.fromObject(config));
70
70
  }
71
71
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -17,8 +17,8 @@ import { HTTPRequest } from './HTTPRequest';
17
17
  * the server in the same state.
18
18
  *
19
19
  * @example <caption>Verify response to a GET request</caption>
20
- * import { Actor } from '@serenity-js/core';
21
- * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest'
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest';
22
22
  * import { Ensure, equals } from '@serenity-js/assertions';
23
23
  *
24
24
  * interface Book {
@@ -26,16 +26,16 @@ import { HTTPRequest } from './HTTPRequest';
26
26
  * author: string;
27
27
  * }
28
28
  *
29
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
30
- *
31
- * actor.attemptsTo(
29
+ * await actorCalled('Apisit')
30
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
31
+ * .attemptsTo(
32
32
  * Send.a(GetRequest.to('/books/0-688-00230-7')),
33
33
  * Ensure.that(LastResponse.status(), equals(200)),
34
34
  * Ensure.that(LastResponse.body<Book>(), equals({
35
35
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
36
36
  * author: 'Robert M. Pirsig',
37
37
  * })),
38
- * );
38
+ * );
39
39
  *
40
40
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
41
41
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.1
@@ -67,12 +67,12 @@ export class GetRequest extends HTTPRequest {
67
67
  * Overrides the default Axios request configuration provided
68
68
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
69
69
  *
70
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
70
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
71
71
  * Axios request configuration overrides
72
72
  *
73
73
  * @returns {GetRequest}
74
74
  */
75
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): GetRequest {
76
- return new GetRequest(this.resourceUri, undefined, Dictionary.of(config));
75
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): GetRequest {
76
+ return new GetRequest(this.resourceUri, undefined, Question.fromObject(config));
77
77
  }
78
78
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core';
1
+ import { Answerable, AnswersQuestions, Question, UsesAbilities, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { formatted } from '@serenity-js/core/lib/io';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
 
@@ -30,7 +30,7 @@ export abstract class HTTPRequest extends Question<Promise<AxiosRequestConfig>>
30
30
  protected constructor(
31
31
  protected readonly resourceUri?: Answerable<string>,
32
32
  protected readonly data?: Answerable<any>,
33
- protected readonly config?: Answerable<AxiosRequestConfig>,
33
+ protected readonly config?: Answerable<WithAnswerableProperties<AxiosRequestConfig>>,
34
34
  ) {
35
35
  super();
36
36
  this.subject = `${ this.requestDescription() } to ${ formatted `${ this.resourceUri }` }`;
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -10,17 +10,17 @@ import { HTTPRequest } from './HTTPRequest';
10
10
  * Such a request can be done before deciding to download a large resource to save bandwidth, for example.
11
11
  *
12
12
  * @example <caption>File download test</caption>
13
- * import { Actor } from '@serenity-js/core';
14
- * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest'
13
+ * import { actorCalled } from '@serenity-js/core';
14
+ * import { CallAnApi, HeadRequest, LastResponse, Send } from '@serenity-js/rest';
15
15
  * import { Ensure, equals } from '@serenity-js/assertions';
16
16
  *
17
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
18
- *
19
- * actor.attemptsTo(
17
+ * await actorCalled('Apisit')
18
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
19
+ * .attemptsTo(
20
20
  * Send.a(HeadRequest.to('/downloads/my-test-document.pdf')),
21
21
  * Ensure.that(LastResponse.status(), equals(200)),
22
22
  * Ensure.that(LastResponse.header('Content-Length'), equals(256)), // assuming we know the size of the document
23
- * );
23
+ * );
24
24
  *
25
25
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
26
26
  * @see https://tools.ietf.org/html/rfc7231#section-4.3.2
@@ -52,12 +52,12 @@ export class HeadRequest extends HTTPRequest {
52
52
  * Overrides the default Axios request configuration provided
53
53
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
54
54
  *
55
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
55
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
56
56
  * Axios request configuration overrides
57
57
  *
58
58
  * @returns {HeadRequest}
59
59
  */
60
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): HeadRequest {
61
- return new HeadRequest(this.resourceUri, undefined, Dictionary.of(config));
60
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): HeadRequest {
61
+ return new HeadRequest(this.resourceUri, undefined, Question.fromObject(config));
62
62
  }
63
63
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -13,13 +13,13 @@ import { HTTPRequest } from './HTTPRequest';
13
13
  * resource action.
14
14
  *
15
15
  * @example <caption>File download test</caption>
16
- * import { Actor } from '@serenity-js/core';
17
- * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest'
16
+ * import { actorCalled } from '@serenity-js/core';
17
+ * import { CallAnApi, OptionsRequest, LastResponse, Send } from '@serenity-js/rest';
18
18
  * import { Ensure, equals } from '@serenity-js/assertions';
19
19
  *
20
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
21
- *
22
- * actor.attemptsTo(
20
+ * await actorCalled('Apisit')
21
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
22
+ * .attemptsTo(
23
23
  * Send.a(OptionsRequest.to('/downloads/my-test-document.pdf')),
24
24
  * Ensure.that(LastResponse.status(), equals(200)),
25
25
  * Ensure.that(LastResponse.header('Allow'), equals('OPTIONS, GET, HEAD')),
@@ -55,12 +55,12 @@ export class OptionsRequest extends HTTPRequest {
55
55
  * Overrides the default Axios request configuration provided
56
56
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
57
57
  *
58
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
58
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
59
59
  * Axios request configuration overrides
60
60
  *
61
61
  * @returns {OptionsRequest}
62
62
  */
63
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): OptionsRequest {
64
- return new OptionsRequest(this.resourceUri, undefined, Dictionary.of(config));
63
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): OptionsRequest {
64
+ return new OptionsRequest(this.resourceUri, undefined, Question.fromObject(config));
65
65
  }
66
66
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -10,12 +10,12 @@ import { HTTPRequest } from './HTTPRequest';
10
10
  *
11
11
  * @example <caption>Add new resource to a collection</caption>
12
12
  * import { Actor } from '@serenity-js/core';
13
- * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest'
13
+ * import { CallAnApi, LastResponse, PatchRequest, Send } from '@serenity-js/rest';
14
14
  * import { Ensure, equals } from '@serenity-js/assertions';
15
15
  *
16
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
17
- *
18
- * actor.attemptsTo(
16
+ * await actorCalled('Apisit')
17
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
18
+ * .attemptsTo(
19
19
  * Send.a(PatchRequest.to('/books/0-688-00230-7').with({
20
20
  * lastReadOn: '2016-06-16',
21
21
  * })),
@@ -65,12 +65,12 @@ export class PatchRequest extends HTTPRequest {
65
65
  * Overrides the default Axios request configuration provided
66
66
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
67
67
  *
68
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
68
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
69
69
  * Axios request configuration overrides
70
70
  *
71
71
  * @returns {PatchRequest}
72
72
  */
73
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PatchRequest {
74
- return new PatchRequest(this.resourceUri, this.data, Dictionary.of(config));
73
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PatchRequest {
74
+ return new PatchRequest(this.resourceUri, this.data, Question.fromObject(config));
75
75
  }
76
76
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -18,13 +18,13 @@ import { HTTPRequest } from './HTTPRequest';
18
18
  * a correctly implemented HTTP REST API will create N resources with N different URIs.
19
19
  *
20
20
  * @example <caption>Add new resource to a collection</caption>
21
- * import { Actor } from '@serenity-js/core';
22
- * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
21
+ * import { actorCalled } from '@serenity-js/core';
22
+ * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest';
23
23
  * import { Ensure, equals } from '@serenity-js/assertions';
24
24
  *
25
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
26
- *
27
- * actor.attemptsTo(
25
+ * await actorCalled('Apisit')
26
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
27
+ * .attemptsTo(
28
28
  * Send.a(PostRequest.to('/books').with({
29
29
  * isbn: '0-688-00230-7',
30
30
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -34,21 +34,21 @@ import { HTTPRequest } from './HTTPRequest';
34
34
  * Ensure.that(LastResponse.header('Location'), equals('/books/0-688-00230-7')),
35
35
  * );
36
36
  *
37
- * @example <caption>Submit a HTML form</caption>
38
- * import { Actor } from '@serenity-js/core';
37
+ * @example <caption>Submit an HTML form</caption>
38
+ * import { actorCalled } from '@serenity-js/core';
39
39
  * import { CallAnApi, LastResponse, PostRequest, Send } from '@serenity-js/rest'
40
40
  * import { Ensure, equals } from '@serenity-js/assertions';
41
41
  * import { stringify } from 'querystring';
42
42
  *
43
- * const
44
- * actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com')),
45
- * formData = stringify({
46
- * name: actor.name,
47
- * email: `${ actor.name }@example.com`,
48
- * text: 'Your website is great! Learnt a lot :-)'
49
- * });
43
+ * const formData = stringify({
44
+ * name: actor.name,
45
+ * email: `${ actor.name }@example.com`,
46
+ * text: 'Your website is great! Learnt a lot :-)'
47
+ * });
50
48
  *
51
- * actor.attemptsTo(
49
+ * await actorCalled('Apisit')
50
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
51
+ * .attemptsTo(
52
52
  * Send.a(PostRequest.to('/feedback').with(postData).using({
53
53
  * headers: {
54
54
  * 'Content-Type': 'application/x-www-form-urlencoded',
@@ -102,12 +102,12 @@ export class PostRequest extends HTTPRequest {
102
102
  * Overrides the default Axios request configuration provided
103
103
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
104
104
  *
105
- * @param {Answerable<DynamicRecord<AxiosRequestConfig>>} config
105
+ * @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
106
106
  * Axios request configuration overrides
107
107
  *
108
108
  * @returns {PostRequest}
109
109
  */
110
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PostRequest {
111
- return new PostRequest(this.resourceUri, this.data, Dictionary.of(config));
110
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PostRequest {
111
+ return new PostRequest(this.resourceUri, this.data, Question.fromObject(config));
112
112
  }
113
113
  }
@@ -1,4 +1,4 @@
1
- import { Answerable, Dictionary, DynamicRecord } from '@serenity-js/core';
1
+ import { Answerable, Question, WithAnswerableProperties } from '@serenity-js/core';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
 
4
4
  import { HTTPRequest } from './HTTPRequest';
@@ -17,13 +17,13 @@ import { HTTPRequest } from './HTTPRequest';
17
17
  * calling it once or several times successively has the same effect (that is no _side effect_).
18
18
  *
19
19
  * @example <caption>Create a new resource at a known location</caption>
20
- * import { Actor } from '@serenity-js/core';
21
- * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest'
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { CallAnApi, LastResponse, PutRequest, Send } from '@serenity-js/rest';
22
22
  * import { Ensure, equals } from '@serenity-js/assertions';
23
23
  *
24
- * const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
25
- *
26
- * actor.attemptsTo(
24
+ * await actorCalled('Apisit')
25
+ * .whoCan(CallAnApi.at('https://myapp.com/api'))
26
+ * .attemptsTo(
27
27
  * Send.a(PutRequest.to('/books/0-688-00230-7').with({
28
28
  * isbn: '0-688-00230-7',
29
29
  * title: 'Zen and the Art of Motorcycle Maintenance: An Inquiry into Values',
@@ -75,12 +75,12 @@ export class PutRequest extends HTTPRequest {
75
75
  * Overrides the default Axios request configuration provided
76
76
  * when {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} was instantiated.
77
77
  *
78
- * @param {@serenity-js/core/lib/screenplay/questions~DynamicRecord<AxiosRequestConfig>} config
78
+ * @param {WithAnswerableProperties<AxiosRequestConfig>} config
79
79
  * Axios request configuration overrides
80
80
  *
81
81
  * @returns {PutRequest}
82
82
  */
83
- using(config: Answerable<DynamicRecord<AxiosRequestConfig>>): PutRequest {
84
- return new PutRequest(this.resourceUri, this.data, Dictionary.of(config));
83
+ using(config: Answerable<WithAnswerableProperties<AxiosRequestConfig>>): PutRequest {
84
+ return new PutRequest(this.resourceUri, this.data, Question.fromObject(config));
85
85
  }
86
86
  }
@@ -1,5 +1,5 @@
1
1
  import { Ability, ConfigurationError, LogicError, TestCompromisedError, UsesAbilities } from '@serenity-js/core';
2
- import axios, { AxiosError, AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import axios, { AxiosDefaults, AxiosError, AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
3
3
  const mergeConfig = require('axios/lib/core/mergeConfig'); // eslint-disable-line @typescript-eslint/no-var-requires
4
4
  const buildFullPath = require('axios/lib/core/buildFullPath'); // eslint-disable-line @typescript-eslint/no-var-requires
5
5
 
@@ -126,7 +126,7 @@ export class CallAnApi implements Ability {
126
126
  *
127
127
  * @see {@link AxiosRequestConfig}
128
128
  */
129
- modifyConfig(fn: (original: AxiosRequestConfig) => any): void {
129
+ modifyConfig(fn: (original: AxiosDefaults<any>) => any): void {
130
130
  fn(this.axiosInstance.defaults);
131
131
  }
132
132