codeceptjs 4.0.0-rc.17 → 4.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 (240) hide show
  1. package/bin/codecept.js +15 -2
  2. package/bin/codeceptq.js +49 -0
  3. package/bin/mcp-server.js +733 -196
  4. package/docs/advanced.md +201 -0
  5. package/docs/agents.md +159 -0
  6. package/docs/ai.md +537 -0
  7. package/docs/aitrace.md +266 -0
  8. package/docs/api.md +332 -0
  9. package/docs/assertions.md +415 -0
  10. package/docs/auth.md +318 -0
  11. package/docs/basics.md +424 -0
  12. package/docs/bdd.md +539 -0
  13. package/docs/best.md +240 -0
  14. package/docs/bootstrap.md +132 -0
  15. package/docs/commands.md +352 -0
  16. package/docs/community-helpers.md +63 -0
  17. package/docs/configuration.md +230 -0
  18. package/docs/continuous-integration.md +497 -0
  19. package/docs/custom-helpers.md +297 -0
  20. package/docs/data.md +448 -0
  21. package/docs/debugging.md +332 -0
  22. package/docs/detox.md +235 -0
  23. package/docs/docker.md +136 -0
  24. package/docs/effects.md +179 -0
  25. package/docs/element-based-testing.md +295 -0
  26. package/docs/element-selection.md +125 -0
  27. package/docs/els.md +328 -0
  28. package/docs/examples.md +161 -0
  29. package/docs/heal.md +213 -0
  30. package/docs/helpers/ApiDataFactory.md +267 -0
  31. package/docs/helpers/Appium.md +1405 -0
  32. package/docs/helpers/Detox.md +665 -0
  33. package/docs/helpers/ExpectHelper.md +275 -0
  34. package/docs/helpers/FileSystem.md +152 -0
  35. package/docs/helpers/GraphQL.md +152 -0
  36. package/docs/helpers/GraphQLDataFactory.md +226 -0
  37. package/docs/helpers/JSONResponse.md +255 -0
  38. package/docs/helpers/Mochawesome.md +8 -0
  39. package/docs/helpers/MockRequest.md +377 -0
  40. package/docs/helpers/MockServer.md +212 -0
  41. package/docs/helpers/Playwright.md +2969 -0
  42. package/docs/helpers/Polly.md +44 -0
  43. package/docs/helpers/Protractor.md +1769 -0
  44. package/docs/helpers/Puppeteer-firefox.md +86 -0
  45. package/docs/helpers/Puppeteer.md +2690 -0
  46. package/docs/helpers/REST.md +289 -0
  47. package/docs/helpers/SoftExpectHelper.md +352 -0
  48. package/docs/helpers/WebDriver.md +2682 -0
  49. package/docs/hooks.md +339 -0
  50. package/docs/index.md +111 -0
  51. package/docs/installation.md +83 -0
  52. package/docs/internal-api.md +265 -0
  53. package/docs/internal-test-server.md +89 -0
  54. package/docs/locators.md +355 -0
  55. package/docs/mcp.md +485 -0
  56. package/docs/migration-4.md +556 -0
  57. package/docs/mobile.md +338 -0
  58. package/docs/pageobjects.md +399 -0
  59. package/docs/parallel.md +585 -0
  60. package/docs/playwright.md +714 -0
  61. package/docs/plugins.md +866 -0
  62. package/docs/puppeteer.md +314 -0
  63. package/docs/quickstart.md +120 -0
  64. package/docs/react.md +70 -0
  65. package/docs/reports.md +483 -0
  66. package/docs/retry.md +274 -0
  67. package/docs/secrets.md +150 -0
  68. package/docs/sessions.md +80 -0
  69. package/docs/shadow.md +68 -0
  70. package/docs/test-structure.md +275 -0
  71. package/docs/timeouts.md +183 -0
  72. package/docs/translation.md +247 -0
  73. package/docs/tutorial.md +271 -0
  74. package/docs/typescript.md +374 -0
  75. package/docs/web-element.md +251 -0
  76. package/docs/webdriver.md +708 -0
  77. package/docs/within.md +55 -0
  78. package/lib/aria.js +260 -0
  79. package/lib/command/dryRun.js +23 -3
  80. package/lib/command/init.js +247 -266
  81. package/lib/command/list.js +150 -10
  82. package/lib/command/query.js +218 -0
  83. package/lib/config.js +77 -4
  84. package/lib/container.js +34 -2
  85. package/lib/element/WebElement.js +37 -0
  86. package/lib/globals.js +11 -10
  87. package/lib/helper/Playwright.js +5 -6
  88. package/lib/helper/extras/PlaywrightReactVueLocator.js +45 -36
  89. package/lib/html.js +90 -16
  90. package/lib/index.js +9 -1
  91. package/lib/locator.js +2 -2
  92. package/lib/mocha/factory.js +5 -1
  93. package/lib/mocha/inject.js +1 -1
  94. package/lib/parser.js +2 -2
  95. package/lib/pause.js +38 -4
  96. package/lib/plugin/aiTrace.js +72 -84
  97. package/lib/plugin/browser.js +77 -0
  98. package/lib/plugin/expose.js +159 -0
  99. package/lib/plugin/heal.js +44 -1
  100. package/lib/plugin/pageInfo.js +51 -48
  101. package/lib/plugin/pause.js +131 -0
  102. package/lib/plugin/pauseOnFail.js +10 -34
  103. package/lib/plugin/screencast.js +287 -0
  104. package/lib/plugin/screenshot.js +563 -0
  105. package/lib/plugin/screenshotOnFail.js +8 -170
  106. package/lib/utils/pluginParser.js +151 -0
  107. package/lib/utils/trace.js +297 -0
  108. package/lib/utils.js +25 -0
  109. package/lib/workers.js +1 -15
  110. package/package.json +12 -10
  111. package/typings/index.d.ts +0 -5
  112. package/docs/webapi/amOnPage.mustache +0 -11
  113. package/docs/webapi/appendField.mustache +0 -16
  114. package/docs/webapi/attachFile.mustache +0 -24
  115. package/docs/webapi/blur.mustache +0 -18
  116. package/docs/webapi/checkOption.mustache +0 -13
  117. package/docs/webapi/clearCookie.mustache +0 -9
  118. package/docs/webapi/clearField.mustache +0 -14
  119. package/docs/webapi/click.mustache +0 -29
  120. package/docs/webapi/clickLink.mustache +0 -8
  121. package/docs/webapi/closeCurrentTab.mustache +0 -7
  122. package/docs/webapi/closeOtherTabs.mustache +0 -8
  123. package/docs/webapi/dontSee.mustache +0 -11
  124. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +0 -10
  125. package/docs/webapi/dontSeeCookie.mustache +0 -8
  126. package/docs/webapi/dontSeeCurrentPathEquals.mustache +0 -10
  127. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +0 -10
  128. package/docs/webapi/dontSeeElement.mustache +0 -12
  129. package/docs/webapi/dontSeeElementInDOM.mustache +0 -8
  130. package/docs/webapi/dontSeeInCurrentUrl.mustache +0 -4
  131. package/docs/webapi/dontSeeInField.mustache +0 -16
  132. package/docs/webapi/dontSeeInSource.mustache +0 -8
  133. package/docs/webapi/dontSeeInTitle.mustache +0 -8
  134. package/docs/webapi/dontSeeTraffic.mustache +0 -13
  135. package/docs/webapi/doubleClick.mustache +0 -13
  136. package/docs/webapi/downloadFile.mustache +0 -12
  137. package/docs/webapi/dragAndDrop.mustache +0 -9
  138. package/docs/webapi/dragSlider.mustache +0 -11
  139. package/docs/webapi/executeAsyncScript.mustache +0 -24
  140. package/docs/webapi/executeScript.mustache +0 -26
  141. package/docs/webapi/fillField.mustache +0 -21
  142. package/docs/webapi/flushNetworkTraffics.mustache +0 -5
  143. package/docs/webapi/focus.mustache +0 -13
  144. package/docs/webapi/forceClick.mustache +0 -28
  145. package/docs/webapi/forceRightClick.mustache +0 -18
  146. package/docs/webapi/grabAllWindowHandles.mustache +0 -7
  147. package/docs/webapi/grabAttributeFrom.mustache +0 -10
  148. package/docs/webapi/grabAttributeFromAll.mustache +0 -9
  149. package/docs/webapi/grabBrowserLogs.mustache +0 -9
  150. package/docs/webapi/grabCookie.mustache +0 -11
  151. package/docs/webapi/grabCssPropertyFrom.mustache +0 -11
  152. package/docs/webapi/grabCssPropertyFromAll.mustache +0 -10
  153. package/docs/webapi/grabCurrentUrl.mustache +0 -9
  154. package/docs/webapi/grabCurrentWindowHandle.mustache +0 -6
  155. package/docs/webapi/grabDataFromPerformanceTiming.mustache +0 -20
  156. package/docs/webapi/grabElementBoundingRect.mustache +0 -20
  157. package/docs/webapi/grabGeoLocation.mustache +0 -8
  158. package/docs/webapi/grabHTMLFrom.mustache +0 -10
  159. package/docs/webapi/grabHTMLFromAll.mustache +0 -9
  160. package/docs/webapi/grabNumberOfOpenTabs.mustache +0 -8
  161. package/docs/webapi/grabNumberOfVisibleElements.mustache +0 -9
  162. package/docs/webapi/grabPageScrollPosition.mustache +0 -8
  163. package/docs/webapi/grabPopupText.mustache +0 -5
  164. package/docs/webapi/grabRecordedNetworkTraffics.mustache +0 -10
  165. package/docs/webapi/grabSource.mustache +0 -8
  166. package/docs/webapi/grabTextFrom.mustache +0 -10
  167. package/docs/webapi/grabTextFromAll.mustache +0 -9
  168. package/docs/webapi/grabTitle.mustache +0 -8
  169. package/docs/webapi/grabValueFrom.mustache +0 -9
  170. package/docs/webapi/grabValueFromAll.mustache +0 -8
  171. package/docs/webapi/grabWebElement.mustache +0 -9
  172. package/docs/webapi/grabWebElements.mustache +0 -9
  173. package/docs/webapi/moveCursorTo.mustache +0 -16
  174. package/docs/webapi/openNewTab.mustache +0 -7
  175. package/docs/webapi/pressKey.mustache +0 -12
  176. package/docs/webapi/pressKeyDown.mustache +0 -12
  177. package/docs/webapi/pressKeyUp.mustache +0 -12
  178. package/docs/webapi/pressKeyWithKeyNormalization.mustache +0 -60
  179. package/docs/webapi/refreshPage.mustache +0 -6
  180. package/docs/webapi/resizeWindow.mustache +0 -6
  181. package/docs/webapi/rightClick.mustache +0 -14
  182. package/docs/webapi/saveElementScreenshot.mustache +0 -10
  183. package/docs/webapi/saveScreenshot.mustache +0 -12
  184. package/docs/webapi/say.mustache +0 -10
  185. package/docs/webapi/scrollIntoView.mustache +0 -11
  186. package/docs/webapi/scrollPageToBottom.mustache +0 -6
  187. package/docs/webapi/scrollPageToTop.mustache +0 -6
  188. package/docs/webapi/scrollTo.mustache +0 -12
  189. package/docs/webapi/see.mustache +0 -11
  190. package/docs/webapi/seeAttributesOnElements.mustache +0 -9
  191. package/docs/webapi/seeCheckboxIsChecked.mustache +0 -10
  192. package/docs/webapi/seeCookie.mustache +0 -8
  193. package/docs/webapi/seeCssPropertiesOnElements.mustache +0 -9
  194. package/docs/webapi/seeCurrentPathEquals.mustache +0 -10
  195. package/docs/webapi/seeCurrentUrlEquals.mustache +0 -11
  196. package/docs/webapi/seeElement.mustache +0 -12
  197. package/docs/webapi/seeElementInDOM.mustache +0 -8
  198. package/docs/webapi/seeInCurrentUrl.mustache +0 -8
  199. package/docs/webapi/seeInField.mustache +0 -17
  200. package/docs/webapi/seeInPopup.mustache +0 -8
  201. package/docs/webapi/seeInSource.mustache +0 -7
  202. package/docs/webapi/seeInTitle.mustache +0 -8
  203. package/docs/webapi/seeNumberOfElements.mustache +0 -11
  204. package/docs/webapi/seeNumberOfVisibleElements.mustache +0 -10
  205. package/docs/webapi/seeTextEquals.mustache +0 -9
  206. package/docs/webapi/seeTitleEquals.mustache +0 -8
  207. package/docs/webapi/seeTraffic.mustache +0 -36
  208. package/docs/webapi/selectOption.mustache +0 -26
  209. package/docs/webapi/setCookie.mustache +0 -16
  210. package/docs/webapi/setGeoLocation.mustache +0 -12
  211. package/docs/webapi/startRecordingTraffic.mustache +0 -8
  212. package/docs/webapi/startRecordingWebSocketMessages.mustache +0 -8
  213. package/docs/webapi/stopRecordingTraffic.mustache +0 -5
  214. package/docs/webapi/stopRecordingWebSocketMessages.mustache +0 -7
  215. package/docs/webapi/switchTo.mustache +0 -9
  216. package/docs/webapi/switchToNextTab.mustache +0 -10
  217. package/docs/webapi/switchToPreviousTab.mustache +0 -10
  218. package/docs/webapi/type.mustache +0 -21
  219. package/docs/webapi/uncheckOption.mustache +0 -13
  220. package/docs/webapi/wait.mustache +0 -8
  221. package/docs/webapi/waitForClickable.mustache +0 -11
  222. package/docs/webapi/waitForCookie.mustache +0 -9
  223. package/docs/webapi/waitForDetached.mustache +0 -10
  224. package/docs/webapi/waitForDisabled.mustache +0 -6
  225. package/docs/webapi/waitForElement.mustache +0 -11
  226. package/docs/webapi/waitForEnabled.mustache +0 -6
  227. package/docs/webapi/waitForFunction.mustache +0 -17
  228. package/docs/webapi/waitForInvisible.mustache +0 -10
  229. package/docs/webapi/waitForNumberOfTabs.mustache +0 -9
  230. package/docs/webapi/waitForText.mustache +0 -13
  231. package/docs/webapi/waitForValue.mustache +0 -10
  232. package/docs/webapi/waitForVisible.mustache +0 -10
  233. package/docs/webapi/waitInUrl.mustache +0 -9
  234. package/docs/webapi/waitNumberOfVisibleElements.mustache +0 -10
  235. package/docs/webapi/waitToHide.mustache +0 -10
  236. package/docs/webapi/waitUrlEquals.mustache +0 -10
  237. package/lib/helper/AI.js +0 -214
  238. package/lib/plugin/pauseOn.js +0 -167
  239. package/lib/plugin/stepByStepReport.js +0 -432
  240. package/lib/plugin/subtitles.js +0 -89
@@ -0,0 +1,289 @@
1
+ ---
2
+ permalink: /helpers/REST
3
+ editLink: false
4
+ sidebar: auto
5
+ title: REST
6
+ ---
7
+
8
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
9
+
10
+ ## REST
11
+
12
+ **Extends Helper**
13
+
14
+ REST helper allows to send additional requests to the REST API during acceptance tests.
15
+ [Axios][1] library is used to perform requests.
16
+
17
+
18
+
19
+ ## Configuration
20
+
21
+ Type: [object][4]
22
+
23
+ ### Properties
24
+
25
+ * `endpoint` **[string][3]?** API base URL
26
+ * `prettyPrintJson` **[boolean][6]?** pretty print json for response/request on console logs.
27
+ * `printCurl` **[boolean][6]?** print cURL request on console logs. False by default.
28
+ * `timeout` **[number][5]?** timeout for requests in milliseconds. 10000ms by default.
29
+ * `defaultHeaders` **[object][4]?** a list of default headers.
30
+ * `httpAgent` **[object][4]?** create an agent with SSL certificate
31
+ * `onRequest` **[function][7]?** an async function which can update request object.
32
+ * `onResponse` **[function][7]?** an async function which can update response object.
33
+ * `maxUploadFileSize` **[number][5]?** set the max content file size in MB when performing api calls.
34
+
35
+
36
+
37
+ ## Example
38
+
39
+ ```js
40
+ {
41
+ helpers: {
42
+ REST: {
43
+ endpoint: 'http://site.com/api',
44
+ prettyPrintJson: true,
45
+ onRequest: (request) => {
46
+ request.headers.auth = '123';
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ With httpAgent
54
+
55
+ ```js
56
+ {
57
+ helpers: {
58
+ REST: {
59
+ endpoint: 'http://site.com/api',
60
+ prettyPrintJson: true,
61
+ httpAgent: {
62
+ key: fs.readFileSync(__dirname + '/path/to/keyfile.key'),
63
+ cert: fs.readFileSync(__dirname + '/path/to/certfile.cert'),
64
+ rejectUnauthorized: false,
65
+ keepAlive: true
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ ```js
73
+ {
74
+ helpers: {
75
+ REST: {
76
+ endpoint: 'http://site.com/api',
77
+ prettyPrintJson: true,
78
+ httpAgent: {
79
+ ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
80
+ rejectUnauthorized: false,
81
+ keepAlive: true
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## Access From Helpers
89
+
90
+ Send REST requests by accessing `_executeRequest` method:
91
+
92
+ ```js
93
+ this.helpers['REST']._executeRequest({
94
+ url,
95
+ data,
96
+ });
97
+ ```
98
+
99
+ ## Methods
100
+
101
+ ### Parameters
102
+
103
+ * `config` &#x20;
104
+
105
+ ### _executeRequest
106
+
107
+ Executes axios request
108
+
109
+ #### Parameters
110
+
111
+ * `request` **any**&#x20;
112
+
113
+ Returns **[Promise][2]<any>** response
114
+
115
+ ### _url
116
+
117
+ Generates url based on format sent (takes endpoint + url if latter lacks 'http')
118
+
119
+ #### Parameters
120
+
121
+ * `url` **any**&#x20;
122
+
123
+ ### amBearerAuthenticated
124
+
125
+ Adds a header for Bearer authentication
126
+
127
+ ```js
128
+ // we use secret function to hide token from logs
129
+ I.amBearerAuthenticated(secret('heregoestoken'))
130
+ ```
131
+
132
+ #### Parameters
133
+
134
+ * `accessToken` **([string][3] | CodeceptJS.Secret)** Bearer access token
135
+
136
+ ### haveRequestHeaders
137
+
138
+ Sets request headers for all requests of this test
139
+
140
+ #### Parameters
141
+
142
+ * `headers` **[object][4]** headers list
143
+
144
+ ### sendDeleteRequest
145
+
146
+ Sends DELETE request to API.
147
+
148
+ ```js
149
+ I.sendDeleteRequest('/api/users/1');
150
+ ```
151
+
152
+ #### Parameters
153
+
154
+ * `url` **any**&#x20;
155
+ * `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
156
+
157
+ Returns **[Promise][2]<any>** response
158
+
159
+ ### sendDeleteRequestWithPayload
160
+
161
+ Sends DELETE request to API with payload.
162
+
163
+ ```js
164
+ I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
165
+ ```
166
+
167
+ #### Parameters
168
+
169
+ * `url` **any**&#x20;
170
+ * `payload` **any** the payload to be sent. By default it is sent as an empty object
171
+ * `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
172
+
173
+ Returns **[Promise][2]<any>** response
174
+
175
+ ### sendGetRequest
176
+
177
+ Send GET request to REST API
178
+
179
+ ```js
180
+ I.sendGetRequest('/api/users.json');
181
+ ```
182
+
183
+ #### Parameters
184
+
185
+ * `url` **any**&#x20;
186
+ * `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
187
+
188
+ Returns **[Promise][2]<any>** response
189
+
190
+ ### sendHeadRequest
191
+
192
+ Send HEAD request to REST API
193
+
194
+ ```js
195
+ I.sendHeadRequest('/api/users.json');
196
+ ```
197
+
198
+ #### Parameters
199
+
200
+ * `url` **any**&#x20;
201
+ * `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
202
+
203
+ Returns **[Promise][2]<any>** response
204
+
205
+ ### sendPatchRequest
206
+
207
+ Sends PATCH request to API.
208
+
209
+ ```js
210
+ I.sendPatchRequest('/api/users.json', { "email": "user@user.com" });
211
+
212
+ // To mask the payload in logs
213
+ I.sendPatchRequest('/api/users.json', secret({ "email": "user@user.com" }));
214
+
215
+ ```
216
+
217
+ #### Parameters
218
+
219
+ * `url` **[string][3]**&#x20;
220
+ * `payload` **any** the payload to be sent. By default it is sent as an empty object
221
+ * `headers` **[object][4]** the headers object to be sent. By default it is sent as an empty object
222
+
223
+ Returns **[Promise][2]<any>** response
224
+
225
+ ### sendPostRequest
226
+
227
+ Sends POST request to API.
228
+
229
+ ```js
230
+ I.sendPostRequest('/api/users.json', { "email": "user@user.com" });
231
+
232
+ // To mask the payload in logs
233
+ I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" }));
234
+
235
+ ```
236
+
237
+ #### Parameters
238
+
239
+ * `url` **any**&#x20;
240
+ * `payload` **any** the payload to be sent. By default, it is sent as an empty object
241
+ * `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
242
+
243
+ Returns **[Promise][2]<any>** response
244
+
245
+ ### sendPutRequest
246
+
247
+ Sends PUT request to API.
248
+
249
+ ```js
250
+ I.sendPutRequest('/api/users.json', { "email": "user@user.com" });
251
+
252
+ // To mask the payload in logs
253
+ I.sendPutRequest('/api/users.json', secret({ "email": "user@user.com" }));
254
+
255
+ ```
256
+
257
+ #### Parameters
258
+
259
+ * `url` **[string][3]**&#x20;
260
+ * `payload` **any** the payload to be sent. By default it is sent as an empty object
261
+ * `headers` **[object][4]** the headers object to be sent. By default it is sent as an empty object
262
+
263
+ Returns **[Promise][2]<any>** response
264
+
265
+ ### setRequestTimeout
266
+
267
+ Set timeout for the request
268
+
269
+ ```js
270
+ I.setRequestTimeout(10000); // In milliseconds
271
+ ```
272
+
273
+ #### Parameters
274
+
275
+ * `newTimeout` **[number][5]** timeout in milliseconds
276
+
277
+ [1]: https://github.com/axios/axios
278
+
279
+ [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
280
+
281
+ [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
282
+
283
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
284
+
285
+ [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
286
+
287
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
288
+
289
+ [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
@@ -0,0 +1,352 @@
1
+ ---
2
+ permalink: /helpers/SoftExpectHelper
3
+ editLink: false
4
+ sidebar: auto
5
+ title: SoftExpectHelper
6
+ ---
7
+
8
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
9
+
10
+ ## SoftAssertHelper
11
+
12
+ **Extends ExpectHelper**
13
+
14
+ SoftAssertHelper is a utility class for performing soft assertions.
15
+ Unlike traditional assertions that stop the execution on failure,
16
+ soft assertions allow the execution to continue and report all failures at the end.
17
+
18
+ ### Examples
19
+
20
+ Zero-configuration when paired with other helpers like REST, Playwright:
21
+
22
+ ```js
23
+ // inside codecept.conf.js
24
+ {
25
+ helpers: {
26
+ Playwright: {...},
27
+ SoftExpectHelper: {},
28
+ }
29
+ }
30
+ ```
31
+
32
+ ```js
33
+ // in scenario
34
+ I.softExpectEqual('a', 'b')
35
+ I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
36
+ ```
37
+
38
+ ## Methods
39
+
40
+ ### flushSoftAssertions
41
+
42
+ Throws an error if any soft assertions have failed.
43
+ The error message contains all the accumulated failures.
44
+
45
+ - Throws **[Error][1]** If there are any soft assertion failures.
46
+
47
+ ### softAssert
48
+
49
+ Performs a soft assertion by executing the provided assertion function.
50
+ If the assertion fails, the error is caught and stored without halting the execution.
51
+
52
+ #### Parameters
53
+
54
+ - `assertionFn` **[Function][2]** The assertion function to execute.
55
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
56
+
57
+ ### softExpectAbove
58
+
59
+ Softly asserts that the target data is above a specified value.
60
+
61
+ #### Parameters
62
+
63
+ - `targetData` **any** The data to check.
64
+ - `aboveThan` **any** The value that the target data should be above.
65
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
66
+
67
+ ### softExpectBelow
68
+
69
+ Softly asserts that the target data is below a specified value.
70
+
71
+ #### Parameters
72
+
73
+ - `targetData` **any** The data to check.
74
+ - `belowThan` **any** The value that the target data should be below.
75
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
76
+
77
+ ### softExpectContain
78
+
79
+ Softly asserts that a value contains the expected value.
80
+
81
+ #### Parameters
82
+
83
+ - `actualValue` **any** The actual value.
84
+ - `expectedValueToContain` **any** The value that should be contained within the actual value.
85
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
86
+
87
+ ### softExpectDeepEqual
88
+
89
+ Softly asserts that two values are deeply equal.
90
+
91
+ #### Parameters
92
+
93
+ - `actualValue` **any** The actual value.
94
+ - `expectedValue` **any** The expected value.
95
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
96
+
97
+ ### softExpectDeepEqualExcluding
98
+
99
+ Softly asserts that two objects are deeply equal, excluding specified fields.
100
+
101
+ #### Parameters
102
+
103
+ - `actualValue` **[Object][4]** The actual object.
104
+ - `expectedValue` **[Object][4]** The expected object.
105
+ - `fieldsToExclude` **[Array][5]<[string][3]>** The fields to exclude from the comparison.
106
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
107
+
108
+ ### softExpectDeepIncludeMembers
109
+
110
+ Softly asserts that an array (superset) deeply includes all members of another array (set).
111
+
112
+ #### Parameters
113
+
114
+ - `superset` **[Array][5]** The array that should contain the expected members.
115
+ - `set` **[Array][5]** The array with members that should be included.
116
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
117
+
118
+ ### softExpectDeepMembers
119
+
120
+ Softly asserts that two arrays have deep equality, considering members in any order.
121
+
122
+ #### Parameters
123
+
124
+ - `actualValue` **[Array][5]** The actual array.
125
+ - `expectedValue` **[Array][5]** The expected array.
126
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
127
+
128
+ ### softExpectEmpty
129
+
130
+ Softly asserts that the target data is empty.
131
+
132
+ #### Parameters
133
+
134
+ - `targetData` **any** The data to check.
135
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
136
+
137
+ ### softExpectEndsWith
138
+
139
+ Softly asserts that a value ends with the expected value.
140
+
141
+ #### Parameters
142
+
143
+ - `actualValue` **any** The actual value.
144
+ - `expectedValueToEndWith` **any** The value that the actual value should end with.
145
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
146
+
147
+ ### softExpectEqual
148
+
149
+ Softly asserts that two values are equal.
150
+
151
+ #### Parameters
152
+
153
+ - `actualValue` **any** The actual value.
154
+ - `expectedValue` **any** The expected value.
155
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
156
+
157
+ ### softExpectEqualIgnoreCase
158
+
159
+ Softly asserts that two values are equal, ignoring case.
160
+
161
+ #### Parameters
162
+
163
+ - `actualValue` **[string][3]** The actual string value.
164
+ - `expectedValue` **[string][3]** The expected string value.
165
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
166
+
167
+ ### softExpectFalse
168
+
169
+ Softly asserts that the target data is false.
170
+
171
+ #### Parameters
172
+
173
+ - `targetData` **any** The data to check.
174
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
175
+
176
+ ### softExpectHasAProperty
177
+
178
+ Softly asserts that the target data has a property with the specified name.
179
+
180
+ #### Parameters
181
+
182
+ - `targetData` **any** The data to check.
183
+ - `propertyName` **[string][3]** The property name to check for.
184
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
185
+
186
+ ### softExpectHasProperty
187
+
188
+ Softly asserts that the target data has the specified property.
189
+
190
+ #### Parameters
191
+
192
+ - `targetData` **any** The data to check.
193
+ - `propertyName` **[string][3]** The property name to check for.
194
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion
195
+ fails.
196
+
197
+ ### softExpectJsonSchema
198
+
199
+ Softly asserts that the target data matches the given JSON schema.
200
+
201
+ #### Parameters
202
+
203
+ - `targetData` **any** The data to validate.
204
+ - `jsonSchema` **[Object][4]** The JSON schema to validate against.
205
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
206
+
207
+ ### softExpectJsonSchemaUsingAJV
208
+
209
+ Softly asserts that the target data matches the given JSON schema using AJV.
210
+
211
+ #### Parameters
212
+
213
+ - `targetData` **any** The data to validate.
214
+ - `jsonSchema` **[Object][4]** The JSON schema to validate against.
215
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
216
+ - `ajvOptions` **[Object][4]** Options to pass to AJV.
217
+
218
+ ### softExpectLengthAboveThan
219
+
220
+ Softly asserts that the length of the target data is above a specified value.
221
+
222
+ #### Parameters
223
+
224
+ - `targetData` **any** The data to check.
225
+ - `lengthAboveThan` **[number][6]** The length that the target data should be above.
226
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
227
+
228
+ ### softExpectLengthBelowThan
229
+
230
+ Softly asserts that the length of the target data is below a specified value.
231
+
232
+ #### Parameters
233
+
234
+ - `targetData` **any** The data to check.
235
+ - `lengthBelowThan` **[number][6]** The length that the target data should be below.
236
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
237
+
238
+ ### softExpectLengthOf
239
+
240
+ Softly asserts that the target data has a specified length.
241
+
242
+ #### Parameters
243
+
244
+ - `targetData` **any** The data to check.
245
+ - `length` **[number][6]** The expected length.
246
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
247
+
248
+ ### softExpectMatchesPattern
249
+
250
+ Softly asserts that a value matches the expected pattern.
251
+
252
+ #### Parameters
253
+
254
+ - `actualValue` **any** The actual value.
255
+ - `expectedPattern` **any** The pattern the value should match.
256
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
257
+
258
+ ### softExpectNotContain
259
+
260
+ Softly asserts that a value does not contain the expected value.
261
+
262
+ #### Parameters
263
+
264
+ - `actualValue` **any** The actual value.
265
+ - `expectedValueToNotContain` **any** The value that should not be contained within the actual value.
266
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
267
+
268
+ ### softExpectNotDeepEqual
269
+
270
+ Softly asserts that two values are not deeply equal.
271
+
272
+ #### Parameters
273
+
274
+ - `actualValue` **any** The actual value.
275
+ - `expectedValue` **any** The expected value.
276
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
277
+
278
+ ### softExpectNotEndsWith
279
+
280
+ Softly asserts that a value does not end with the expected value.
281
+
282
+ #### Parameters
283
+
284
+ - `actualValue` **any** The actual value.
285
+ - `expectedValueToNotEndWith` **any** The value that the actual value should not end with.
286
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
287
+
288
+ ### softExpectNotEqual
289
+
290
+ Softly asserts that two values are not equal.
291
+
292
+ #### Parameters
293
+
294
+ - `actualValue` **any** The actual value.
295
+ - `expectedValue` **any** The expected value.
296
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
297
+
298
+ ### softExpectNotStartsWith
299
+
300
+ Softly asserts that a value does not start with the expected value.
301
+
302
+ #### Parameters
303
+
304
+ - `actualValue` **any** The actual value.
305
+ - `expectedValueToNotStartWith` **any** The value that the actual value should not start with.
306
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
307
+
308
+ ### softExpectStartsWith
309
+
310
+ Softly asserts that a value starts with the expected value.
311
+
312
+ #### Parameters
313
+
314
+ - `actualValue` **any** The actual value.
315
+ - `expectedValueToStartWith` **any** The value that the actual value should start with.
316
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
317
+
318
+ ### softExpectToBeA
319
+
320
+ Softly asserts that the target data is of a specific type.
321
+
322
+ #### Parameters
323
+
324
+ - `targetData` **any** The data to check.
325
+ - `type` **[string][3]** The expected type (e.g., 'string', 'number').
326
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
327
+
328
+ ### softExpectToBeAn
329
+
330
+ Softly asserts that the target data is of a specific type (alternative for articles).
331
+
332
+ #### Parameters
333
+
334
+ - `targetData` **any** The data to check.
335
+ - `type` **[string][3]** The expected type (e.g., 'string', 'number').
336
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
337
+
338
+ ### softExpectTrue
339
+
340
+ Softly asserts that the target data is true.
341
+
342
+ #### Parameters
343
+
344
+ - `targetData` **any** The data to check.
345
+ - `customErrorMsg` **[string][3]** A custom error message to display if the assertion fails.
346
+
347
+ [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
348
+ [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
349
+ [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
350
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
351
+ [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
352
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number