@serenity-js/core 3.23.2 → 3.24.0

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 (137) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/lib/errors/ErrorFactory.js +4 -4
  3. package/lib/errors/ErrorFactory.js.map +1 -1
  4. package/lib/errors/RaiseErrors.d.ts +2 -2
  5. package/lib/errors/RaiseErrors.js +2 -2
  6. package/lib/io/index.d.ts +0 -1
  7. package/lib/io/index.d.ts.map +1 -1
  8. package/lib/io/index.js +0 -1
  9. package/lib/io/index.js.map +1 -1
  10. package/lib/io/inspectedObject.js +1 -1
  11. package/lib/io/inspectedObject.js.map +1 -1
  12. package/lib/io/reflection/ValueInspector.d.ts +56 -0
  13. package/lib/io/reflection/ValueInspector.d.ts.map +1 -0
  14. package/lib/io/reflection/ValueInspector.js +149 -0
  15. package/lib/io/reflection/ValueInspector.js.map +1 -0
  16. package/lib/io/reflection/index.d.ts +1 -2
  17. package/lib/io/reflection/index.d.ts.map +1 -1
  18. package/lib/io/reflection/index.js +1 -2
  19. package/lib/io/reflection/index.js.map +1 -1
  20. package/lib/io/stringified.js +7 -90
  21. package/lib/io/stringified.js.map +1 -1
  22. package/lib/screenplay/Activity.d.ts +5 -12
  23. package/lib/screenplay/Activity.d.ts.map +1 -1
  24. package/lib/screenplay/Activity.js +3 -14
  25. package/lib/screenplay/Activity.js.map +1 -1
  26. package/lib/screenplay/Actor.js +1 -1
  27. package/lib/screenplay/Actor.js.map +1 -1
  28. package/lib/screenplay/Interaction.d.ts +4 -3
  29. package/lib/screenplay/Interaction.d.ts.map +1 -1
  30. package/lib/screenplay/Interaction.js +2 -2
  31. package/lib/screenplay/Interaction.js.map +1 -1
  32. package/lib/screenplay/Question.d.ts +73 -21
  33. package/lib/screenplay/Question.d.ts.map +1 -1
  34. package/lib/screenplay/Question.js +237 -30
  35. package/lib/screenplay/Question.js.map +1 -1
  36. package/lib/screenplay/Task.d.ts +16 -15
  37. package/lib/screenplay/Task.d.ts.map +1 -1
  38. package/lib/screenplay/Task.js +14 -14
  39. package/lib/screenplay/Task.js.map +1 -1
  40. package/lib/screenplay/abilities/Ability.d.ts +8 -6
  41. package/lib/screenplay/abilities/Ability.d.ts.map +1 -1
  42. package/lib/screenplay/abilities/Ability.js +8 -6
  43. package/lib/screenplay/abilities/Ability.js.map +1 -1
  44. package/lib/screenplay/abilities/AbilityType.d.ts +3 -3
  45. package/lib/screenplay/abilities/AnswerQuestions.d.ts +0 -1
  46. package/lib/screenplay/abilities/AnswerQuestions.d.ts.map +1 -1
  47. package/lib/screenplay/abilities/AnswerQuestions.js +2 -4
  48. package/lib/screenplay/abilities/AnswerQuestions.js.map +1 -1
  49. package/lib/screenplay/abilities/PerformActivities.d.ts +5 -3
  50. package/lib/screenplay/abilities/PerformActivities.d.ts.map +1 -1
  51. package/lib/screenplay/abilities/PerformActivities.js +12 -10
  52. package/lib/screenplay/abilities/PerformActivities.js.map +1 -1
  53. package/lib/screenplay/artifacts/CollectsArtifacts.d.ts +2 -2
  54. package/lib/screenplay/notes/NotepadAdapter.d.ts.map +1 -1
  55. package/lib/screenplay/notes/NotepadAdapter.js +44 -4
  56. package/lib/screenplay/notes/NotepadAdapter.js.map +1 -1
  57. package/lib/screenplay/questions/Describable.d.ts +27 -0
  58. package/lib/screenplay/questions/Describable.d.ts.map +1 -0
  59. package/lib/screenplay/questions/Describable.js +40 -0
  60. package/lib/screenplay/questions/Describable.js.map +1 -0
  61. package/lib/screenplay/questions/DescriptionFormattingOptions.d.ts +14 -0
  62. package/lib/screenplay/questions/DescriptionFormattingOptions.d.ts.map +1 -0
  63. package/lib/screenplay/questions/DescriptionFormattingOptions.js +3 -0
  64. package/lib/screenplay/questions/DescriptionFormattingOptions.js.map +1 -0
  65. package/lib/screenplay/questions/Expectation.d.ts +6 -10
  66. package/lib/screenplay/questions/Expectation.d.ts.map +1 -1
  67. package/lib/screenplay/questions/Expectation.js +12 -15
  68. package/lib/screenplay/questions/Expectation.js.map +1 -1
  69. package/lib/screenplay/questions/List.d.ts +1 -3
  70. package/lib/screenplay/questions/List.d.ts.map +1 -1
  71. package/lib/screenplay/questions/List.js +6 -31
  72. package/lib/screenplay/questions/List.js.map +1 -1
  73. package/lib/screenplay/questions/Unanswered.d.ts +1 -0
  74. package/lib/screenplay/questions/Unanswered.d.ts.map +1 -1
  75. package/lib/screenplay/questions/Unanswered.js +3 -0
  76. package/lib/screenplay/questions/Unanswered.js.map +1 -1
  77. package/lib/screenplay/questions/expectations/ExpectationDetails.js +1 -1
  78. package/lib/screenplay/questions/expectations/ExpectationDetails.js.map +1 -1
  79. package/lib/screenplay/questions/index.d.ts +3 -1
  80. package/lib/screenplay/questions/index.d.ts.map +1 -1
  81. package/lib/screenplay/questions/index.js +3 -1
  82. package/lib/screenplay/questions/index.js.map +1 -1
  83. package/lib/screenplay/questions/tag-functions.d.ts +228 -0
  84. package/lib/screenplay/questions/tag-functions.d.ts.map +1 -0
  85. package/lib/screenplay/questions/tag-functions.js +115 -0
  86. package/lib/screenplay/questions/tag-functions.js.map +1 -0
  87. package/lib/screenplay/time/activities/Wait.d.ts.map +1 -1
  88. package/lib/screenplay/time/activities/Wait.js +4 -3
  89. package/lib/screenplay/time/activities/Wait.js.map +1 -1
  90. package/package.json +4 -4
  91. package/src/errors/ErrorFactory.ts +5 -5
  92. package/src/errors/RaiseErrors.ts +2 -2
  93. package/src/io/index.ts +0 -1
  94. package/src/io/inspectedObject.ts +2 -2
  95. package/src/io/reflection/ValueInspector.ts +165 -0
  96. package/src/io/reflection/index.ts +1 -2
  97. package/src/io/stringified.ts +7 -103
  98. package/src/screenplay/Activity.ts +6 -17
  99. package/src/screenplay/Actor.ts +2 -2
  100. package/src/screenplay/Interaction.ts +5 -4
  101. package/src/screenplay/Question.ts +299 -49
  102. package/src/screenplay/Task.ts +18 -17
  103. package/src/screenplay/abilities/Ability.ts +8 -6
  104. package/src/screenplay/abilities/AbilityType.ts +3 -3
  105. package/src/screenplay/abilities/AnswerQuestions.ts +2 -5
  106. package/src/screenplay/abilities/PerformActivities.ts +35 -18
  107. package/src/screenplay/artifacts/CollectsArtifacts.ts +2 -2
  108. package/src/screenplay/notes/NotepadAdapter.ts +57 -6
  109. package/src/screenplay/questions/Describable.ts +48 -0
  110. package/src/screenplay/questions/DescriptionFormattingOptions.ts +13 -0
  111. package/src/screenplay/questions/Expectation.ts +19 -19
  112. package/src/screenplay/questions/List.ts +7 -41
  113. package/src/screenplay/questions/Unanswered.ts +4 -0
  114. package/src/screenplay/questions/expectations/ExpectationDetails.ts +2 -2
  115. package/src/screenplay/questions/index.ts +3 -1
  116. package/src/screenplay/questions/tag-functions.ts +313 -0
  117. package/src/screenplay/time/activities/Wait.ts +4 -3
  118. package/lib/io/isPlainObject.d.ts +0 -7
  119. package/lib/io/isPlainObject.d.ts.map +0 -1
  120. package/lib/io/isPlainObject.js +0 -25
  121. package/lib/io/isPlainObject.js.map +0 -1
  122. package/lib/io/reflection/isPrimitive.d.ts +0 -8
  123. package/lib/io/reflection/isPrimitive.d.ts.map +0 -1
  124. package/lib/io/reflection/isPrimitive.js +0 -24
  125. package/lib/io/reflection/isPrimitive.js.map +0 -1
  126. package/lib/io/reflection/typeOf.d.ts +0 -7
  127. package/lib/io/reflection/typeOf.d.ts.map +0 -1
  128. package/lib/io/reflection/typeOf.js +0 -35
  129. package/lib/io/reflection/typeOf.js.map +0 -1
  130. package/lib/screenplay/questions/q.d.ts +0 -66
  131. package/lib/screenplay/questions/q.d.ts.map +0 -1
  132. package/lib/screenplay/questions/q.js +0 -77
  133. package/lib/screenplay/questions/q.js.map +0 -1
  134. package/src/io/isPlainObject.ts +0 -24
  135. package/src/io/reflection/isPrimitive.ts +0 -20
  136. package/src/io/reflection/typeOf.ts +0 -31
  137. package/src/screenplay/questions/q.ts +0 -82
@@ -53,7 +53,7 @@ import type { UsesAbilities } from './UsesAbilities';
53
53
  * Note how {@apilink BrowseTheWebWithPlaywright}, {@apilink BrowseTheWebWithWebdriverIO}, and {@apilink BrowseTheWebWithProtractor}
54
54
  * all **extend** the base ability to {@apilink BrowseTheWeb}.
55
55
  *
56
- * #### Playwright Test
56
+ * #### Playwright
57
57
  *
58
58
  * ```typescript
59
59
  * import { actorCalled } from '@serenity-js/core'
@@ -62,7 +62,7 @@ import type { UsesAbilities } from './UsesAbilities';
62
62
  *
63
63
  * const browser = await chromium.launch({ headless: true }) // integration library
64
64
  *
65
- * actorCalled('Trevor') // generic actor
65
+ * await actorCalled('Trevor') // generic actor
66
66
  * .whoCan(BrowseTheWebWithPlaywright.using(browser)) // tool-specific ability
67
67
  * ```
68
68
  *
@@ -72,7 +72,7 @@ import type { UsesAbilities } from './UsesAbilities';
72
72
  * import { actorCalled } from '@serenity-js/core'
73
73
  * import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio' // Serenity/JS integration module
74
74
  *
75
- * actorCalled('Trevor') // generic actor
75
+ * await actorCalled('Trevor') // generic actor
76
76
  * .whoCan(BrowseTheWebWithWebdriverIO.using(browser)) // tool-specific ability
77
77
  * ```
78
78
  *
@@ -83,7 +83,7 @@ import type { UsesAbilities } from './UsesAbilities';
83
83
  * import { BrowseTheWebWithProtractor } from '@serenity-js/protractor' // Serenity/JS integration module
84
84
  * import { protractor } from 'protractor' // integration library
85
85
  *
86
- * actorCalled('Trevor') // generic actor
86
+ * await actorCalled('Trevor') // generic actor
87
87
  * .whoCan(BrowseTheWebWithProtractor.using(protractor.browser)) // tool-specific ability
88
88
  * ```
89
89
  *
@@ -241,9 +241,11 @@ import type { UsesAbilities } from './UsesAbilities';
241
241
  * ### Defining a custom interaction using the custom ability
242
242
  *
243
243
  * ```ts
244
+ * import { Answerable, Interaction, the } from '@serenity-js/core'
245
+ *
244
246
  * // A custom interaction using the actor's ability:
245
- * const Call = (phoneNumber: string) =>
246
- * Interaction.where(`#actor calls ${ phoneNumber }`, async actor => {
247
+ * const Call = (phoneNumber: Answerable<string>) =>
248
+ * Interaction.where(the`#actor calls ${ phoneNumber }`, async actor => {
247
249
  * await MakePhoneCalls.as(actor).dial(phoneNumber)
248
250
  * })
249
251
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"Ability.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/Ability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiWG;AACH,8BAAsB,OAAO;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,OAAO,EACvB,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,aAAa,GACrB,CAAC;CAGP"}
1
+ {"version":3,"file":"Ability.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/Ability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmWG;AACH,8BAAsB,OAAO;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,OAAO,EACvB,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,aAAa,GACrB,CAAC;CAGP"}
@@ -54,7 +54,7 @@ exports.Ability = void 0;
54
54
  * Note how {@apilink BrowseTheWebWithPlaywright}, {@apilink BrowseTheWebWithWebdriverIO}, and {@apilink BrowseTheWebWithProtractor}
55
55
  * all **extend** the base ability to {@apilink BrowseTheWeb}.
56
56
  *
57
- * #### Playwright Test
57
+ * #### Playwright
58
58
  *
59
59
  * ```typescript
60
60
  * import { actorCalled } from '@serenity-js/core'
@@ -63,7 +63,7 @@ exports.Ability = void 0;
63
63
  *
64
64
  * const browser = await chromium.launch({ headless: true }) // integration library
65
65
  *
66
- * actorCalled('Trevor') // generic actor
66
+ * await actorCalled('Trevor') // generic actor
67
67
  * .whoCan(BrowseTheWebWithPlaywright.using(browser)) // tool-specific ability
68
68
  * ```
69
69
  *
@@ -73,7 +73,7 @@ exports.Ability = void 0;
73
73
  * import { actorCalled } from '@serenity-js/core'
74
74
  * import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio' // Serenity/JS integration module
75
75
  *
76
- * actorCalled('Trevor') // generic actor
76
+ * await actorCalled('Trevor') // generic actor
77
77
  * .whoCan(BrowseTheWebWithWebdriverIO.using(browser)) // tool-specific ability
78
78
  * ```
79
79
  *
@@ -84,7 +84,7 @@ exports.Ability = void 0;
84
84
  * import { BrowseTheWebWithProtractor } from '@serenity-js/protractor' // Serenity/JS integration module
85
85
  * import { protractor } from 'protractor' // integration library
86
86
  *
87
- * actorCalled('Trevor') // generic actor
87
+ * await actorCalled('Trevor') // generic actor
88
88
  * .whoCan(BrowseTheWebWithProtractor.using(protractor.browser)) // tool-specific ability
89
89
  * ```
90
90
  *
@@ -242,9 +242,11 @@ exports.Ability = void 0;
242
242
  * ### Defining a custom interaction using the custom ability
243
243
  *
244
244
  * ```ts
245
+ * import { Answerable, Interaction, the } from '@serenity-js/core'
246
+ *
245
247
  * // A custom interaction using the actor's ability:
246
- * const Call = (phoneNumber: string) =>
247
- * Interaction.where(`#actor calls ${ phoneNumber }`, async actor => {
248
+ * const Call = (phoneNumber: Answerable<string>) =>
249
+ * Interaction.where(the`#actor calls ${ phoneNumber }`, async actor => {
248
250
  * await MakePhoneCalls.as(actor).dial(phoneNumber)
249
251
  * })
250
252
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"Ability.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/Ability.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiWG;AACH,MAAsB,OAAO;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,MAAM,CAAC,EAAE,CAEL,KAAoB;QAEpB,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAM,CAAC;IACtC,CAAC;CACJ;AA7CD,0BA6CC"}
1
+ {"version":3,"file":"Ability.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/Ability.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmWG;AACH,MAAsB,OAAO;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,MAAM,CAAC,EAAE,CAEL,KAAoB;QAEpB,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAM,CAAC;IACtC,CAAC;CACJ;AA7CD,0BA6CC"}
@@ -6,7 +6,7 @@ import type { Ability } from './Ability';
6
6
  * #### Retrieving an ability from an interaction
7
7
  *
8
8
  * ```ts
9
- * import { Ability, actorCalled, Interaction } from '@serenity-js/core';
9
+ * import { Ability, Answerable, actorCalled, Interaction, the } from '@serenity-js/core';
10
10
  *
11
11
  * class MakePhoneCalls extends Ability {
12
12
  * static using(phone: Phone) {
@@ -22,8 +22,8 @@ import type { Ability } from './Ability';
22
22
  * }
23
23
  * }
24
24
  *
25
- * const Call = (phoneNumber: string) =>
26
- * Interaction.where(`#actor calls ${ phoneNumber }`, async actor => {
25
+ * const Call = (phoneNumber: Answerable<string>) =>
26
+ * Interaction.where(the`#actor calls ${ phoneNumber }`, async actor => {
27
27
  * await MakePhoneCalls.as(actor).dial(phoneNumber)
28
28
  * });
29
29
  *
@@ -15,7 +15,6 @@ export declare class AnswerQuestions extends Ability {
15
15
  protected readonly actor: AnswersQuestions & UsesAbilities;
16
16
  constructor(actor: AnswersQuestions & UsesAbilities);
17
17
  answer<T>(answerable: Answerable<T>): Promise<T>;
18
- private static isAPromise;
19
18
  private static isDefined;
20
19
  }
21
20
  //# sourceMappingURL=AnswerQuestions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnswerQuestions.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/AnswerQuestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC5B,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa;gBAAvC,KAAK,EAAE,gBAAgB,GAAG,aAAa;IAItE,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAahD,OAAO,CAAC,MAAM,CAAC,UAAU;IAIzB,OAAO,CAAC,MAAM,CAAC,SAAS;CAG3B"}
1
+ {"version":3,"file":"AnswerQuestions.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/AnswerQuestions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC5B,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa;gBAAvC,KAAK,EAAE,gBAAgB,GAAG,aAAa;IAItE,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAahD,OAAO,CAAC,MAAM,CAAC,SAAS;CAG3B"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AnswerQuestions = void 0;
4
+ const io_1 = require("../../io");
4
5
  const Question_1 = require("../Question");
5
6
  const Ability_1 = require("./Ability");
6
7
  /**
@@ -19,7 +20,7 @@ class AnswerQuestions extends Ability_1.Ability {
19
20
  this.actor = actor;
20
21
  }
21
22
  answer(answerable) {
22
- if (AnswerQuestions.isDefined(answerable) && AnswerQuestions.isAPromise(answerable)) {
23
+ if (AnswerQuestions.isDefined(answerable) && io_1.ValueInspector.isPromise(answerable)) {
23
24
  return answerable;
24
25
  }
25
26
  if (AnswerQuestions.isDefined(answerable) && Question_1.Question.isAQuestion(answerable)) {
@@ -27,9 +28,6 @@ class AnswerQuestions extends Ability_1.Ability {
27
28
  }
28
29
  return Promise.resolve(answerable);
29
30
  }
30
- static isAPromise(v) {
31
- return Object.prototype.hasOwnProperty.call(v, 'then');
32
- }
33
31
  static isDefined(v) {
34
32
  return !(v === undefined || v === null);
35
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AnswerQuestions.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/AnswerQuestions.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AAEvC,uCAAoC;AAGpC;;;;;;;;GAQG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C,UAAU,CAAC,EAAE;YAC/E,OAAO,UAAU,CAAC;SACrB;QAED,IAAI,eAAe,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,mBAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;YAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SACzD;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,UAAe,CAAC,CAAC;IAC5C,CAAC;IAEO,MAAM,CAAC,SAAS,CAAI,CAAgB;QACxC,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IAC5C,CAAC;CACJ;AArBD,0CAqBC"}
@@ -2,7 +2,9 @@ import type { EmitsDomainEvents } from '../../events';
2
2
  import type { Outcome } from '../../model';
3
3
  import type { PerformsActivities } from '../activities/PerformsActivities';
4
4
  import type { Activity } from '../Activity';
5
- import { Ability } from './index';
5
+ import type { AnswersQuestions } from '../questions';
6
+ import { Ability } from './Ability';
7
+ import type { UsesAbilities } from './UsesAbilities';
6
8
  /**
7
9
  * An {@apilink Ability} that enables an {@apilink Actor} to perform a given {@apilink Activity}.
8
10
  *
@@ -13,11 +15,11 @@ import { Ability } from './index';
13
15
  * @group Abilities
14
16
  */
15
17
  export declare class PerformActivities extends Ability {
16
- protected readonly actor: PerformsActivities & {
18
+ protected readonly actor: AnswersQuestions & UsesAbilities & PerformsActivities & {
17
19
  name: string;
18
20
  };
19
21
  protected readonly stage: EmitsDomainEvents;
20
- constructor(actor: PerformsActivities & {
22
+ constructor(actor: AnswersQuestions & UsesAbilities & PerformsActivities & {
21
23
  name: string;
22
24
  }, stage: EmitsDomainEvents);
23
25
  perform(activity: Activity): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"PerformActivities.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/PerformActivities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,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OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAEtC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa,GAAG,kBAAkB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAClG,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB;gBADxB,KAAK,EAAE,gBAAgB,GAAG,aAAa,GAAG,kBAAkB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAC/E,KAAK,EAAE,iBAAiB;IAKzC,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAyChD,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,OAAO;IAYjD,OAAO,CAAC,SAAS;IAOjB,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;CAO/C"}
@@ -4,9 +4,10 @@ exports.PerformActivities = void 0;
4
4
  const tiny_types_1 = require("tiny-types");
5
5
  const errors_1 = require("../../errors");
6
6
  const events_1 = require("../../events");
7
+ const io_1 = require("../../io");
7
8
  const model_1 = require("../../model");
8
9
  const Interaction_1 = require("../Interaction");
9
- const index_1 = require("./index");
10
+ const Ability_1 = require("./Ability");
10
11
  /**
11
12
  * An {@apilink Ability} that enables an {@apilink Actor} to perform a given {@apilink Activity}.
12
13
  *
@@ -16,7 +17,7 @@ const index_1 = require("./index");
16
17
  *
17
18
  * @group Abilities
18
19
  */
19
- class PerformActivities extends index_1.Ability {
20
+ class PerformActivities extends Ability_1.Ability {
20
21
  actor;
21
22
  stage;
22
23
  constructor(actor, stage) {
@@ -26,7 +27,7 @@ class PerformActivities extends index_1.Ability {
26
27
  }
27
28
  async perform(activity) {
28
29
  const sceneId = this.stage.currentSceneId();
29
- const details = this.detailsOf(activity);
30
+ const details = this.detailsOf(this.nameOf(activity), activity.instantiationLocation());
30
31
  const activityId = this.stage.assignNewActivityId(details);
31
32
  const [activityStarts, activityFinished] = activity instanceof Interaction_1.Interaction
32
33
  ? [events_1.InteractionStarts, events_1.InteractionFinished]
@@ -34,7 +35,8 @@ class PerformActivities extends index_1.Ability {
34
35
  try {
35
36
  this.stage.announce(new activityStarts(sceneId, activityId, details, this.stage.currentTime()));
36
37
  await activity.performAs(this.actor);
37
- this.stage.announce(new activityFinished(sceneId, activityId, details, new model_1.ExecutionSuccessful(), this.stage.currentTime()));
38
+ const name = await activity.describedBy(this.actor);
39
+ this.stage.announce(new activityFinished(sceneId, activityId, this.detailsOf(name, activity.instantiationLocation()), new model_1.ExecutionSuccessful(), this.stage.currentTime()));
38
40
  }
39
41
  catch (error) {
40
42
  this.stage.announce(new activityFinished(sceneId, activityId, details, this.outcomeFor(error), this.stage.currentTime()));
@@ -54,14 +56,14 @@ class PerformActivities extends index_1.Ability {
54
56
  : new model_1.ExecutionFailedWithError(error))
55
57
  .else(_ => new model_1.ExecutionFailedWithError(error));
56
58
  }
57
- detailsOf(activity) {
58
- return new model_1.ActivityDetails(new model_1.Name(this.nameOf(activity)), activity.instantiationLocation());
59
+ detailsOf(name, instantiationLocation) {
60
+ return new model_1.ActivityDetails(new model_1.Name(name), instantiationLocation);
59
61
  }
60
62
  nameOf(activity) {
61
- const template = activity.toString() === ({}).toString()
62
- ? `#actor performs ${activity.constructor.name}`
63
- : activity.toString();
64
- return template.replace('#actor', this.actor.name);
63
+ const template = io_1.ValueInspector.hasItsOwnToString(activity)
64
+ ? activity.toString()
65
+ : `#actor performs ${activity.constructor.name}`;
66
+ return template.replaceAll('#actor', this.actor.name);
65
67
  }
66
68
  }
67
69
  exports.PerformActivities = PerformActivities;
@@ -1 +1 @@
1
- {"version":3,"file":"PerformActivities.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/PerformActivities.ts"],"names":[],"mappings":";;;AAAA,2CAAmC;AAEnC,yCAAgG;AAEh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QAAQ;YAClD,CAAC,CAAC,IAAI,yCAAiC,CAAC,KAAK,CAAC;YAC9C,CAAC,CAAC,IAAI,gCAAwB,CAAC,KAAK,CAAC,CAAC;aAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,gCAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;IAEO,SAAS,CAAC,IAAY,EAAE,qBAAyC;QACrE,OAAO,IAAI,uBAAe,CACtB,IAAI,YAAI,CAAC,IAAI,CAAC,EACd,qBAAqB,CACxB,CAAA;IACL,CAAC;IAES,MAAM,CAAC,QAAkB;QAC/B,MAAM,QAAQ,GAAG,mBAAc,CAAC,iBAAiB,CAAC,QAAQ,CAAC;YACvD,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACrB,CAAC,CAAC,mBAAoB,QAAQ,CAAC,WAAW,CAAC,IAAK,EAAE,CAAC;QAEvD,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;CACJ;AA3ED,8CA2EC"}
@@ -17,7 +17,7 @@ export interface CollectsArtifacts {
17
17
  *
18
18
  * ```ts
19
19
  * import * as fs from 'node:fs'
20
- * import { Answerable, Interaction } from '@serenity-js/core'
20
+ * import { Answerable, Interaction, the } from '@serenity-js/core'
21
21
  * import { Path } from '@serenity-js/core/lib/io'
22
22
  * import { Name, TextData } from '@serenity-js/core/lib/model'
23
23
  *
@@ -34,7 +34,7 @@ export interface CollectsArtifacts {
34
34
  * })
35
35
  *
36
36
  * static textData = (contents: Answerable<string>, name?: string): Interaction =>
37
- * Interaction.where(`#actor attaches text data`, async actor => {
37
+ * Interaction.where(the`#actor attaches text data`, async actor => {
38
38
  * const data = await actor.answer(contents);
39
39
  *
40
40
  * actor.collect(
@@ -1 +1 @@
1
- {"version":3,"file":"NotepadAdapter.d.ts","sourceRoot":"","sources":["../../../src/screenplay/notes/NotepadAdapter.ts"],"names":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ACH,MAAM,CAAC,OAAO,SAAS,MAAM,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;IAM/E;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,IAAI,WAAW;IAMpB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC;IAM/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,IAAI,eAAe,CAAC,UAAU,CAAC;IAMrC;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
@@ -4,6 +4,7 @@ exports.NotepadAdapter = void 0;
4
4
  const io_1 = require("../../io");
5
5
  const Interaction_1 = require("../Interaction");
6
6
  const Question_1 = require("../Question");
7
+ const questions_1 = require("../questions");
7
8
  const TakeNotes_1 = require("./TakeNotes");
8
9
  /**
9
10
  * Serenity/JS Screenplay Pattern-style adapter for the {@apilink Notepad},
@@ -50,7 +51,7 @@ class NotepadAdapter {
50
51
  get(subject) {
51
52
  return Question_1.Question.about(`a note of ${String(subject)}`, actor => {
52
53
  return TakeNotes_1.TakeNotes.as(actor).notepad.get(subject);
53
- });
54
+ }).describedAs(Question_1.Question.formattedValue());
54
55
  }
55
56
  /**
56
57
  * Resolves a given `Answerable<value>` and stores it in the notepad,
@@ -197,7 +198,7 @@ class NotepadAdapter {
197
198
  * - {@apilink Notepad.clear}
198
199
  */
199
200
  clear() {
200
- return Interaction_1.Interaction.where('#actor clears their notepad', actor => {
201
+ return Interaction_1.Interaction.where((0, questions_1.the) `#actor clears ${new NumberOfNotes()} from their notepad`, actor => {
201
202
  return TakeNotes_1.TakeNotes.as(actor).notepad.clear();
202
203
  });
203
204
  }
@@ -225,7 +226,7 @@ class NotepadAdapter {
225
226
  * - {@apilink Notepad.size}
226
227
  */
227
228
  size() {
228
- return Question_1.Question.about('number of notes', async (actor) => {
229
+ return Question_1.Question.about((0, questions_1.the) `${new NumberOfNotes()}`, async (actor) => {
229
230
  return TakeNotes_1.TakeNotes.as(actor).notepad.size();
230
231
  });
231
232
  }
@@ -279,7 +280,7 @@ exports.NotepadAdapter = NotepadAdapter;
279
280
  class ChainableNoteSetter extends Interaction_1.Interaction {
280
281
  notes;
281
282
  constructor(notes) {
282
- super(`#actor takes note of ${(0, io_1.commaSeparated)(Object.keys(notes))}`);
283
+ super(new DescriptionOfNotes(notes));
283
284
  this.notes = notes;
284
285
  }
285
286
  set(subject, value) {
@@ -296,4 +297,43 @@ class ChainableNoteSetter extends Interaction_1.Interaction {
296
297
  }
297
298
  }
298
299
  }
300
+ class DescriptionOfNotes extends Question_1.Question {
301
+ notes;
302
+ options;
303
+ constructor(notes, options) {
304
+ super(`#actor takes notes: ${Object.keys(notes).join(', ')}`);
305
+ this.notes = notes;
306
+ this.options = options;
307
+ }
308
+ async answeredBy(actor) {
309
+ const noteNames = Object.keys(this.notes);
310
+ const maxWidth = noteNames.reduce((max, name) => Math.max(max, name.length), 0);
311
+ const list = await (0, io_1.asyncMap)(noteNames, async (noteName) => {
312
+ const label = `${noteName}:`.padEnd(maxWidth + 1);
313
+ const noteDescription = await actor.answer(Question_1.Question.formattedValue(this.options).of(this.notes[noteName]));
314
+ return `- ${label} ${noteDescription}`;
315
+ });
316
+ return [
317
+ `#actor takes notes:`,
318
+ ...list,
319
+ ].join('\n');
320
+ }
321
+ async describedBy(actor) {
322
+ return this.answeredBy(actor);
323
+ }
324
+ }
325
+ class NumberOfNotes extends Question_1.Question {
326
+ constructor() {
327
+ super('notes');
328
+ }
329
+ async answeredBy(actor) {
330
+ return TakeNotes_1.TakeNotes.as(actor).notepad.size();
331
+ }
332
+ async describedBy(actor) {
333
+ const count = await this.answeredBy(actor);
334
+ return count === 1
335
+ ? '1 note'
336
+ : `${count} notes`;
337
+ }
338
+ }
299
339
  //# sourceMappingURL=NotepadAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotepadAdapter.js","sourceRoot":"","sources":["../../../src/screenplay/not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AAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAE3C,OAAO,KAAK,KAAK,CAAC;YACd,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,GAAI,KAAM,QAAQ,CAAC;IAC7B,CAAC;CACJ"}
@@ -0,0 +1,27 @@
1
+ import type { UsesAbilities } from '../abilities/UsesAbilities';
2
+ import type { Answerable } from '../Answerable';
3
+ import type { AnswersQuestions } from './AnswersQuestions';
4
+ declare const descriptionField: unique symbol;
5
+ /**
6
+ * @group Questions
7
+ */
8
+ export declare abstract class Describable {
9
+ private [descriptionField];
10
+ protected constructor(description: Answerable<string>);
11
+ /**
12
+ * Resolves the description of this object in the context of the provided `actor`.
13
+ *
14
+ * @param actor
15
+ */
16
+ describedBy(actor: AnswersQuestions & UsesAbilities & {
17
+ name: string;
18
+ }): Promise<string>;
19
+ protected setDescription(description: Answerable<string>): void;
20
+ protected getDescription(): Answerable<string>;
21
+ /**
22
+ * Returns a human-readable description of this object.
23
+ */
24
+ toString(): string;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=Describable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Describable.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Describable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,QAAA,MAAM,gBAAgB,eAAwB,CAAC;AAE/C;;GAEG;AACH,8BAAsB,WAAW;IAE7B,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAqB;IAE/C,SAAS,aAAa,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAIrD;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAM9F,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI;IAI/D,SAAS,CAAC,cAAc,IAAI,UAAU,CAAC,MAAM,CAAC;IAI9C;;OAEG;IACH,QAAQ,IAAI,MAAM;CAOrB"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Describable = void 0;
4
+ const ValueInspector_1 = require("../../io/reflection/ValueInspector");
5
+ const descriptionField = Symbol('description');
6
+ /**
7
+ * @group Questions
8
+ */
9
+ class Describable {
10
+ [descriptionField];
11
+ constructor(description) {
12
+ this[descriptionField] = description;
13
+ }
14
+ /**
15
+ * Resolves the description of this object in the context of the provided `actor`.
16
+ *
17
+ * @param actor
18
+ */
19
+ async describedBy(actor) {
20
+ const description = await actor.answer(this[descriptionField]);
21
+ return description.replaceAll('#actor', actor.name);
22
+ }
23
+ setDescription(description) {
24
+ this[descriptionField] = description;
25
+ }
26
+ getDescription() {
27
+ return this[descriptionField];
28
+ }
29
+ /**
30
+ * Returns a human-readable description of this object.
31
+ */
32
+ toString() {
33
+ if (ValueInspector_1.ValueInspector.isPromise(this[descriptionField])) {
34
+ return 'Promise';
35
+ }
36
+ return String(this[descriptionField]);
37
+ }
38
+ }
39
+ exports.Describable = Describable;
40
+ //# sourceMappingURL=Describable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Describable.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Describable.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAKpE,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAsB,WAAW;IAErB,CAAC,gBAAgB,CAAC,CAAqB;IAE/C,YAAsB,WAA+B;QACjD,IAAI,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,KAA0D;QACxE,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAE/D,OAAO,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAES,cAAc,CAAC,WAA+B;QACpD,IAAI,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC;IACzC,CAAC;IAES,cAAc;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,QAAQ;QACJ,IAAI,+BAAc,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE;YAClD,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ;AArCD,kCAqCC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Configuration options for {@apilink Question.formattedValue} and
3
+ * the [`the`](/api/core/function/the/) function.
4
+ *
5
+ * @group Questions
6
+ */
7
+ export interface DescriptionFormattingOptions {
8
+ /**
9
+ * The maximum length of the string representation of the value.
10
+ * String representations longer than this value will be truncated and appended with an ellipsis.
11
+ */
12
+ maxLength: number;
13
+ }
14
+ //# sourceMappingURL=DescriptionFormattingOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DescriptionFormattingOptions.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/DescriptionFormattingOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IACzC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DescriptionFormattingOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DescriptionFormattingOptions.js","sourceRoot":"","sources":["../../../src/screenplay/questions/DescriptionFormattingOptions.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import type { Answerable, AnswersQuestions, QuestionAdapter } from '../';
1
+ import type { Answerable, AnswersQuestions, QuestionAdapter } from '../index';
2
+ import { Describable } from '../questions';
2
3
  import type { ExpectationOutcome } from './expectations';
3
4
  /**
4
5
  * @group Expectations
@@ -13,9 +14,8 @@ type AnswerableArguments<Arguments extends Array<unknown>> = {
13
14
  *
14
15
  * @group Expectations
15
16
  */
16
- export declare class Expectation<Actual> {
17
+ export declare class Expectation<Actual> extends Describable {
17
18
  private readonly functionName;
18
- private description;
19
19
  private readonly predicate;
20
20
  /**
21
21
  * A factory method to that makes defining custom {@apilink Expectation|expectations} easier
@@ -102,7 +102,7 @@ export declare class Expectation<Actual> {
102
102
  *
103
103
  * @param predicate
104
104
  */
105
- static define<Actual_Type, PredicateArguments extends Array<unknown>>(functionName: string, relationship: ((...answerableArguments: AnswerableArguments<PredicateArguments>) => string) | string, predicate: (actual: Actual_Type, ...predicateArguments: PredicateArguments) => Promise<boolean> | boolean): (...answerableArguments: AnswerableArguments<PredicateArguments>) => Expectation<Actual_Type>;
105
+ static define<Actual_Type, PredicateArguments extends Array<unknown>>(functionName: string, relationship: ((...answerableArguments: AnswerableArguments<PredicateArguments>) => Answerable<string>) | Answerable<string>, predicate: (actual: Actual_Type, ...predicateArguments: PredicateArguments) => Promise<boolean> | boolean): (...answerableArguments: AnswerableArguments<PredicateArguments>) => Expectation<Actual_Type>;
106
106
  /**
107
107
  * Used to define a simple {@apilink Expectation}
108
108
  *
@@ -165,7 +165,7 @@ export declare class Expectation<Actual> {
165
165
  static to<Actual_Type>(relationshipName: string): {
166
166
  soThatActual: (expectation: Expectation<Actual_Type>) => Expectation<Actual_Type>;
167
167
  };
168
- protected constructor(functionName: string, description: string, predicate: Predicate<Actual>);
168
+ protected constructor(functionName: string, description: Answerable<string>, predicate: Predicate<Actual>);
169
169
  /**
170
170
  * Returns a {@apilink QuestionAdapter} that resolves to {@apilink ExpectationOutcome}
171
171
  * indicating that the {@apilink ExpectationMet|expectation was met}
@@ -177,11 +177,7 @@ export declare class Expectation<Actual> {
177
177
  /**
178
178
  * @inheritDoc
179
179
  */
180
- describedAs(subject: string): this;
181
- /**
182
- * @inheritDoc
183
- */
184
- toString(): string;
180
+ describedAs(description: Answerable<string>): this;
185
181
  }
186
182
  export {};
187
183
  //# sourceMappingURL=Expectation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Expectation.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Expectation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,KAChF,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AAErD,KAAK,mBAAmB,CAAC,SAAS,SAAS,KAAK,CAAC,OAAO,CAAC,IAAI;KAAG,KAAK,IAAI,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;CAAE,CAAC;AAE1H;;;;;GAKG;AACH,qBAAa,WAAW,CAAC,MAAM;IA+NvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,QAAQ,CAAC,SAAS;IA/N9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoFG;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,kBAAkB,SAAS,KAAK,CAAC,OAAO,CAAC,EAChE,YAAY,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