@serenity-js/webdriverio-8 3.31.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 (285) hide show
  1. package/CHANGELOG.md +1232 -0
  2. package/LICENSE.md +201 -0
  3. package/NOTICE.md +1 -0
  4. package/README.md +234 -0
  5. package/esm/adapter/TestRunnerLoader.d.ts +17 -0
  6. package/esm/adapter/TestRunnerLoader.d.ts.map +1 -0
  7. package/esm/adapter/TestRunnerLoader.js +63 -0
  8. package/esm/adapter/TestRunnerLoader.js.map +1 -0
  9. package/esm/adapter/WebdriverIOFrameworkAdapter.d.ts +25 -0
  10. package/esm/adapter/WebdriverIOFrameworkAdapter.d.ts.map +1 -0
  11. package/esm/adapter/WebdriverIOFrameworkAdapter.js +90 -0
  12. package/esm/adapter/WebdriverIOFrameworkAdapter.js.map +1 -0
  13. package/esm/adapter/WebdriverIOFrameworkAdapterFactory.d.ts +18 -0
  14. package/esm/adapter/WebdriverIOFrameworkAdapterFactory.d.ts.map +1 -0
  15. package/esm/adapter/WebdriverIOFrameworkAdapterFactory.js +18 -0
  16. package/esm/adapter/WebdriverIOFrameworkAdapterFactory.js.map +1 -0
  17. package/esm/adapter/WebdriverIONotifier.d.ts +71 -0
  18. package/esm/adapter/WebdriverIONotifier.d.ts.map +1 -0
  19. package/esm/adapter/WebdriverIONotifier.js +390 -0
  20. package/esm/adapter/WebdriverIONotifier.js.map +1 -0
  21. package/esm/adapter/index.d.ts +2 -0
  22. package/esm/adapter/index.d.ts.map +1 -0
  23. package/esm/adapter/index.js +2 -0
  24. package/esm/adapter/index.js.map +1 -0
  25. package/esm/adapter/reporter/BrowserCapabilitiesReporter.d.ts +18 -0
  26. package/esm/adapter/reporter/BrowserCapabilitiesReporter.d.ts.map +1 -0
  27. package/esm/adapter/reporter/BrowserCapabilitiesReporter.js +42 -0
  28. package/esm/adapter/reporter/BrowserCapabilitiesReporter.js.map +1 -0
  29. package/esm/adapter/reporter/InitialisesReporters.d.ts +8 -0
  30. package/esm/adapter/reporter/InitialisesReporters.d.ts.map +1 -0
  31. package/esm/adapter/reporter/InitialisesReporters.js +2 -0
  32. package/esm/adapter/reporter/InitialisesReporters.js.map +1 -0
  33. package/esm/adapter/reporter/OutputStreamBuffer.d.ts +13 -0
  34. package/esm/adapter/reporter/OutputStreamBuffer.d.ts.map +1 -0
  35. package/esm/adapter/reporter/OutputStreamBuffer.js +25 -0
  36. package/esm/adapter/reporter/OutputStreamBuffer.js.map +1 -0
  37. package/esm/adapter/reporter/OutputStreamBufferPrinter.d.ts +16 -0
  38. package/esm/adapter/reporter/OutputStreamBufferPrinter.d.ts.map +1 -0
  39. package/esm/adapter/reporter/OutputStreamBufferPrinter.js +24 -0
  40. package/esm/adapter/reporter/OutputStreamBufferPrinter.js.map +1 -0
  41. package/esm/adapter/reporter/ProvidesWriteStream.d.ts +8 -0
  42. package/esm/adapter/reporter/ProvidesWriteStream.d.ts.map +1 -0
  43. package/esm/adapter/reporter/ProvidesWriteStream.js +2 -0
  44. package/esm/adapter/reporter/ProvidesWriteStream.js.map +1 -0
  45. package/esm/adapter/reporter/TagPrinter.d.ts +17 -0
  46. package/esm/adapter/reporter/TagPrinter.d.ts.map +1 -0
  47. package/esm/adapter/reporter/TagPrinter.js +52 -0
  48. package/esm/adapter/reporter/TagPrinter.js.map +1 -0
  49. package/esm/adapter/reporter/index.d.ts +6 -0
  50. package/esm/adapter/reporter/index.d.ts.map +1 -0
  51. package/esm/adapter/reporter/index.js +6 -0
  52. package/esm/adapter/reporter/index.js.map +1 -0
  53. package/esm/api.d.ts +3 -0
  54. package/esm/api.d.ts.map +1 -0
  55. package/esm/api.js +2 -0
  56. package/esm/api.js.map +1 -0
  57. package/esm/config/WebdriverIOConfig.d.ts +95 -0
  58. package/esm/config/WebdriverIOConfig.d.ts.map +1 -0
  59. package/esm/config/WebdriverIOConfig.js +2 -0
  60. package/esm/config/WebdriverIOConfig.js.map +1 -0
  61. package/esm/config/index.d.ts +2 -0
  62. package/esm/config/index.d.ts.map +1 -0
  63. package/esm/config/index.js +2 -0
  64. package/esm/config/index.js.map +1 -0
  65. package/esm/index.d.ts +16 -0
  66. package/esm/index.d.ts.map +1 -0
  67. package/esm/index.js +14 -0
  68. package/esm/index.js.map +1 -0
  69. package/esm/screenplay/abilities/BrowseTheWebWithWebdriverIO.d.ts +40 -0
  70. package/esm/screenplay/abilities/BrowseTheWebWithWebdriverIO.d.ts.map +1 -0
  71. package/esm/screenplay/abilities/BrowseTheWebWithWebdriverIO.js +43 -0
  72. package/esm/screenplay/abilities/BrowseTheWebWithWebdriverIO.js.map +1 -0
  73. package/esm/screenplay/abilities/index.d.ts +2 -0
  74. package/esm/screenplay/abilities/index.d.ts.map +1 -0
  75. package/esm/screenplay/abilities/index.js +2 -0
  76. package/esm/screenplay/abilities/index.js.map +1 -0
  77. package/esm/screenplay/index.d.ts +3 -0
  78. package/esm/screenplay/index.d.ts.map +1 -0
  79. package/esm/screenplay/index.js +3 -0
  80. package/esm/screenplay/index.js.map +1 -0
  81. package/esm/screenplay/models/WebdriverIOBrowsingSession.d.ts +25 -0
  82. package/esm/screenplay/models/WebdriverIOBrowsingSession.d.ts.map +1 -0
  83. package/esm/screenplay/models/WebdriverIOBrowsingSession.js +125 -0
  84. package/esm/screenplay/models/WebdriverIOBrowsingSession.js.map +1 -0
  85. package/esm/screenplay/models/WebdriverIOCookie.d.ts +15 -0
  86. package/esm/screenplay/models/WebdriverIOCookie.d.ts.map +1 -0
  87. package/esm/screenplay/models/WebdriverIOCookie.js +42 -0
  88. package/esm/screenplay/models/WebdriverIOCookie.js.map +1 -0
  89. package/esm/screenplay/models/WebdriverIOErrorHandler.d.ts +9 -0
  90. package/esm/screenplay/models/WebdriverIOErrorHandler.d.ts.map +1 -0
  91. package/esm/screenplay/models/WebdriverIOErrorHandler.js +20 -0
  92. package/esm/screenplay/models/WebdriverIOErrorHandler.js.map +1 -0
  93. package/esm/screenplay/models/WebdriverIOModalDialogHandler.d.ts +27 -0
  94. package/esm/screenplay/models/WebdriverIOModalDialogHandler.d.ts.map +1 -0
  95. package/esm/screenplay/models/WebdriverIOModalDialogHandler.js +74 -0
  96. package/esm/screenplay/models/WebdriverIOModalDialogHandler.js.map +1 -0
  97. package/esm/screenplay/models/WebdriverIOPage.d.ts +50 -0
  98. package/esm/screenplay/models/WebdriverIOPage.d.ts.map +1 -0
  99. package/esm/screenplay/models/WebdriverIOPage.js +219 -0
  100. package/esm/screenplay/models/WebdriverIOPage.js.map +1 -0
  101. package/esm/screenplay/models/WebdriverIOPageElement.d.ts +34 -0
  102. package/esm/screenplay/models/WebdriverIOPageElement.d.ts.map +1 -0
  103. package/esm/screenplay/models/WebdriverIOPageElement.js +220 -0
  104. package/esm/screenplay/models/WebdriverIOPageElement.js.map +1 -0
  105. package/esm/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.d.ts +30 -0
  106. package/esm/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.d.ts.map +1 -0
  107. package/esm/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.js +77 -0
  108. package/esm/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.js.map +1 -0
  109. package/esm/screenplay/models/WebdriverProtocolErrorCode.d.ts +39 -0
  110. package/esm/screenplay/models/WebdriverProtocolErrorCode.d.ts.map +1 -0
  111. package/esm/screenplay/models/WebdriverProtocolErrorCode.js +40 -0
  112. package/esm/screenplay/models/WebdriverProtocolErrorCode.js.map +1 -0
  113. package/esm/screenplay/models/index.d.ts +5 -0
  114. package/esm/screenplay/models/index.d.ts.map +1 -0
  115. package/esm/screenplay/models/index.js +5 -0
  116. package/esm/screenplay/models/index.js.map +1 -0
  117. package/esm/screenplay/models/locators/WebdriverIOLocator.d.ts +33 -0
  118. package/esm/screenplay/models/locators/WebdriverIOLocator.d.ts.map +1 -0
  119. package/esm/screenplay/models/locators/WebdriverIOLocator.js +123 -0
  120. package/esm/screenplay/models/locators/WebdriverIOLocator.js.map +1 -0
  121. package/esm/screenplay/models/locators/WebdriverIORootLocator.d.ts +17 -0
  122. package/esm/screenplay/models/locators/WebdriverIORootLocator.d.ts.map +1 -0
  123. package/esm/screenplay/models/locators/WebdriverIORootLocator.js +30 -0
  124. package/esm/screenplay/models/locators/WebdriverIORootLocator.js.map +1 -0
  125. package/esm/screenplay/models/locators/index.d.ts +3 -0
  126. package/esm/screenplay/models/locators/index.d.ts.map +1 -0
  127. package/esm/screenplay/models/locators/index.js +3 -0
  128. package/esm/screenplay/models/locators/index.js.map +1 -0
  129. package/lib/adapter/TestRunnerLoader.d.ts +17 -0
  130. package/lib/adapter/TestRunnerLoader.d.ts.map +1 -0
  131. package/lib/adapter/TestRunnerLoader.js +67 -0
  132. package/lib/adapter/TestRunnerLoader.js.map +1 -0
  133. package/lib/adapter/WebdriverIOFrameworkAdapter.d.ts +25 -0
  134. package/lib/adapter/WebdriverIOFrameworkAdapter.d.ts.map +1 -0
  135. package/lib/adapter/WebdriverIOFrameworkAdapter.js +127 -0
  136. package/lib/adapter/WebdriverIOFrameworkAdapter.js.map +1 -0
  137. package/lib/adapter/WebdriverIOFrameworkAdapterFactory.d.ts +18 -0
  138. package/lib/adapter/WebdriverIOFrameworkAdapterFactory.d.ts.map +1 -0
  139. package/lib/adapter/WebdriverIOFrameworkAdapterFactory.js +22 -0
  140. package/lib/adapter/WebdriverIOFrameworkAdapterFactory.js.map +1 -0
  141. package/lib/adapter/WebdriverIONotifier.d.ts +71 -0
  142. package/lib/adapter/WebdriverIONotifier.d.ts.map +1 -0
  143. package/lib/adapter/WebdriverIONotifier.js +394 -0
  144. package/lib/adapter/WebdriverIONotifier.js.map +1 -0
  145. package/lib/adapter/index.d.ts +2 -0
  146. package/lib/adapter/index.d.ts.map +1 -0
  147. package/lib/adapter/index.js +18 -0
  148. package/lib/adapter/index.js.map +1 -0
  149. package/lib/adapter/reporter/BrowserCapabilitiesReporter.d.ts +18 -0
  150. package/lib/adapter/reporter/BrowserCapabilitiesReporter.d.ts.map +1 -0
  151. package/lib/adapter/reporter/BrowserCapabilitiesReporter.js +49 -0
  152. package/lib/adapter/reporter/BrowserCapabilitiesReporter.js.map +1 -0
  153. package/lib/adapter/reporter/InitialisesReporters.d.ts +8 -0
  154. package/lib/adapter/reporter/InitialisesReporters.d.ts.map +1 -0
  155. package/lib/adapter/reporter/InitialisesReporters.js +3 -0
  156. package/lib/adapter/reporter/InitialisesReporters.js.map +1 -0
  157. package/lib/adapter/reporter/OutputStreamBuffer.d.ts +13 -0
  158. package/lib/adapter/reporter/OutputStreamBuffer.d.ts.map +1 -0
  159. package/lib/adapter/reporter/OutputStreamBuffer.js +29 -0
  160. package/lib/adapter/reporter/OutputStreamBuffer.js.map +1 -0
  161. package/lib/adapter/reporter/OutputStreamBufferPrinter.d.ts +16 -0
  162. package/lib/adapter/reporter/OutputStreamBufferPrinter.d.ts.map +1 -0
  163. package/lib/adapter/reporter/OutputStreamBufferPrinter.js +28 -0
  164. package/lib/adapter/reporter/OutputStreamBufferPrinter.js.map +1 -0
  165. package/lib/adapter/reporter/ProvidesWriteStream.d.ts +8 -0
  166. package/lib/adapter/reporter/ProvidesWriteStream.d.ts.map +1 -0
  167. package/lib/adapter/reporter/ProvidesWriteStream.js +3 -0
  168. package/lib/adapter/reporter/ProvidesWriteStream.js.map +1 -0
  169. package/lib/adapter/reporter/TagPrinter.d.ts +17 -0
  170. package/lib/adapter/reporter/TagPrinter.d.ts.map +1 -0
  171. package/lib/adapter/reporter/TagPrinter.js +56 -0
  172. package/lib/adapter/reporter/TagPrinter.js.map +1 -0
  173. package/lib/adapter/reporter/index.d.ts +6 -0
  174. package/lib/adapter/reporter/index.d.ts.map +1 -0
  175. package/lib/adapter/reporter/index.js +22 -0
  176. package/lib/adapter/reporter/index.js.map +1 -0
  177. package/lib/api.d.ts +3 -0
  178. package/lib/api.d.ts.map +1 -0
  179. package/lib/api.js +18 -0
  180. package/lib/api.js.map +1 -0
  181. package/lib/config/WebdriverIOConfig.d.ts +95 -0
  182. package/lib/config/WebdriverIOConfig.d.ts.map +1 -0
  183. package/lib/config/WebdriverIOConfig.js +3 -0
  184. package/lib/config/WebdriverIOConfig.js.map +1 -0
  185. package/lib/config/index.d.ts +2 -0
  186. package/lib/config/index.d.ts.map +1 -0
  187. package/lib/config/index.js +18 -0
  188. package/lib/config/index.js.map +1 -0
  189. package/lib/index.d.ts +16 -0
  190. package/lib/index.d.ts.map +1 -0
  191. package/lib/index.js +52 -0
  192. package/lib/index.js.map +1 -0
  193. package/lib/package.json +1 -0
  194. package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.d.ts +40 -0
  195. package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.d.ts.map +1 -0
  196. package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js +47 -0
  197. package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js.map +1 -0
  198. package/lib/screenplay/abilities/index.d.ts +2 -0
  199. package/lib/screenplay/abilities/index.d.ts.map +1 -0
  200. package/lib/screenplay/abilities/index.js +18 -0
  201. package/lib/screenplay/abilities/index.js.map +1 -0
  202. package/lib/screenplay/index.d.ts +3 -0
  203. package/lib/screenplay/index.d.ts.map +1 -0
  204. package/lib/screenplay/index.js +19 -0
  205. package/lib/screenplay/index.js.map +1 -0
  206. package/lib/screenplay/models/WebdriverIOBrowsingSession.d.ts +25 -0
  207. package/lib/screenplay/models/WebdriverIOBrowsingSession.d.ts.map +1 -0
  208. package/lib/screenplay/models/WebdriverIOBrowsingSession.js +129 -0
  209. package/lib/screenplay/models/WebdriverIOBrowsingSession.js.map +1 -0
  210. package/lib/screenplay/models/WebdriverIOCookie.d.ts +15 -0
  211. package/lib/screenplay/models/WebdriverIOCookie.d.ts.map +1 -0
  212. package/lib/screenplay/models/WebdriverIOCookie.js +46 -0
  213. package/lib/screenplay/models/WebdriverIOCookie.js.map +1 -0
  214. package/lib/screenplay/models/WebdriverIOErrorHandler.d.ts +9 -0
  215. package/lib/screenplay/models/WebdriverIOErrorHandler.d.ts.map +1 -0
  216. package/lib/screenplay/models/WebdriverIOErrorHandler.js +24 -0
  217. package/lib/screenplay/models/WebdriverIOErrorHandler.js.map +1 -0
  218. package/lib/screenplay/models/WebdriverIOModalDialogHandler.d.ts +27 -0
  219. package/lib/screenplay/models/WebdriverIOModalDialogHandler.d.ts.map +1 -0
  220. package/lib/screenplay/models/WebdriverIOModalDialogHandler.js +78 -0
  221. package/lib/screenplay/models/WebdriverIOModalDialogHandler.js.map +1 -0
  222. package/lib/screenplay/models/WebdriverIOPage.d.ts +50 -0
  223. package/lib/screenplay/models/WebdriverIOPage.d.ts.map +1 -0
  224. package/lib/screenplay/models/WebdriverIOPage.js +256 -0
  225. package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
  226. package/lib/screenplay/models/WebdriverIOPageElement.d.ts +34 -0
  227. package/lib/screenplay/models/WebdriverIOPageElement.d.ts.map +1 -0
  228. package/lib/screenplay/models/WebdriverIOPageElement.js +257 -0
  229. package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
  230. package/lib/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.d.ts +30 -0
  231. package/lib/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.d.ts.map +1 -0
  232. package/lib/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.js +81 -0
  233. package/lib/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.js.map +1 -0
  234. package/lib/screenplay/models/WebdriverProtocolErrorCode.d.ts +39 -0
  235. package/lib/screenplay/models/WebdriverProtocolErrorCode.d.ts.map +1 -0
  236. package/lib/screenplay/models/WebdriverProtocolErrorCode.js +43 -0
  237. package/lib/screenplay/models/WebdriverProtocolErrorCode.js.map +1 -0
  238. package/lib/screenplay/models/index.d.ts +5 -0
  239. package/lib/screenplay/models/index.d.ts.map +1 -0
  240. package/lib/screenplay/models/index.js +21 -0
  241. package/lib/screenplay/models/index.js.map +1 -0
  242. package/lib/screenplay/models/locators/WebdriverIOLocator.d.ts +33 -0
  243. package/lib/screenplay/models/locators/WebdriverIOLocator.d.ts.map +1 -0
  244. package/lib/screenplay/models/locators/WebdriverIOLocator.js +128 -0
  245. package/lib/screenplay/models/locators/WebdriverIOLocator.js.map +1 -0
  246. package/lib/screenplay/models/locators/WebdriverIORootLocator.d.ts +17 -0
  247. package/lib/screenplay/models/locators/WebdriverIORootLocator.d.ts.map +1 -0
  248. package/lib/screenplay/models/locators/WebdriverIORootLocator.js +34 -0
  249. package/lib/screenplay/models/locators/WebdriverIORootLocator.js.map +1 -0
  250. package/lib/screenplay/models/locators/index.d.ts +3 -0
  251. package/lib/screenplay/models/locators/index.d.ts.map +1 -0
  252. package/lib/screenplay/models/locators/index.js +19 -0
  253. package/lib/screenplay/models/locators/index.js.map +1 -0
  254. package/package.json +122 -0
  255. package/src/adapter/TestRunnerLoader.ts +90 -0
  256. package/src/adapter/WebdriverIOFrameworkAdapter.ts +130 -0
  257. package/src/adapter/WebdriverIOFrameworkAdapterFactory.ts +39 -0
  258. package/src/adapter/WebdriverIONotifier.ts +480 -0
  259. package/src/adapter/index.ts +1 -0
  260. package/src/adapter/reporter/BrowserCapabilitiesReporter.ts +63 -0
  261. package/src/adapter/reporter/InitialisesReporters.ts +8 -0
  262. package/src/adapter/reporter/OutputStreamBuffer.ts +30 -0
  263. package/src/adapter/reporter/OutputStreamBufferPrinter.ts +30 -0
  264. package/src/adapter/reporter/ProvidesWriteStream.ts +8 -0
  265. package/src/adapter/reporter/TagPrinter.ts +69 -0
  266. package/src/adapter/reporter/index.ts +5 -0
  267. package/src/api.ts +2 -0
  268. package/src/config/WebdriverIOConfig.ts +94 -0
  269. package/src/config/index.ts +1 -0
  270. package/src/index.ts +32 -0
  271. package/src/screenplay/abilities/BrowseTheWebWithWebdriverIO.ts +46 -0
  272. package/src/screenplay/abilities/index.ts +1 -0
  273. package/src/screenplay/index.ts +2 -0
  274. package/src/screenplay/models/WebdriverIOBrowsingSession.ts +176 -0
  275. package/src/screenplay/models/WebdriverIOCookie.ts +51 -0
  276. package/src/screenplay/models/WebdriverIOErrorHandler.ts +25 -0
  277. package/src/screenplay/models/WebdriverIOModalDialogHandler.ts +99 -0
  278. package/src/screenplay/models/WebdriverIOPage.ts +311 -0
  279. package/src/screenplay/models/WebdriverIOPageElement.ts +280 -0
  280. package/src/screenplay/models/WebdriverIOPuppeteerModalDialogHandler.ts +100 -0
  281. package/src/screenplay/models/WebdriverProtocolErrorCode.ts +38 -0
  282. package/src/screenplay/models/index.ts +4 -0
  283. package/src/screenplay/models/locators/WebdriverIOLocator.ts +176 -0
  284. package/src/screenplay/models/locators/WebdriverIORootLocator.ts +34 -0
  285. package/src/screenplay/models/locators/index.ts +2 -0
package/LICENSE.md ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE.md ADDED
@@ -0,0 +1 @@
1
+ Copyright 2016- Jan Molak, smartcode ltd.
package/README.md ADDED
@@ -0,0 +1,234 @@
1
+ # Serenity/JS with WebdriverIO 8 🚀
2
+
3
+ [![Follow Serenity/JS on LinkedIn](https://img.shields.io/badge/Follow-Serenity%2FJS%20-0077B5?logo=linkedin)](https://www.linkedin.com/company/serenity-js)
4
+ [![Watch Serenity/JS on YouTube](https://img.shields.io/badge/Watch-@serenity--js-E62117?logo=youtube)](https://www.youtube.com/@serenity-js)
5
+ [![Join Serenity/JS Community Chat](https://img.shields.io/badge/Chat-Serenity%2FJS%20Community-FBD30B?logo=matrix)](https://matrix.to/#/#serenity-js:gitter.im)
6
+ [![GitHub stars](https://img.shields.io/github/stars/serenity-js/serenity-js?label=Serenity%2FJS&logo=github&style=badge)](https://github.com/serenity-js/serenity-js)
7
+ [![Support Serenity/JS on GitHub](https://img.shields.io/badge/Support-@serenity--js-703EC8?logo=github)](https://github.com/sponsors/serenity-js)
8
+
9
+ [Serenity/JS](https://serenity-js.org) revolutionises automated testing by enabling your team to write **expressive**, **maintainable tests** that align
10
+ with **your unique domain**. Seamlessly integrating with [WebdriverIO](https://webdriver.io) and test runners like
11
+ [**Mocha**](https://serenity-js.org/handbook/test-runners/mocha/),
12
+ [**Cucumber**](https://serenity-js.org/handbook/test-runners/cucumber/),
13
+ and [**Jasmine**](https://serenity-js.org/handbook/test-runners/jasmine/),
14
+ Serenity/JS also offers **advanced reporting** that provides clear insights into test results,
15
+ helping both technical teams and business stakeholders understand the quality of the system under test.
16
+
17
+ Serenity/JS WebdriverIO 8 module is intended for existing projects that can't yet upgrade to WebdriverIO 9.
18
+ If you're starting a new project, we recommend using the [Serenity/JS WebdriverIO module](https://serenity-js.org/api/webdriverio/).
19
+
20
+ ## 🚀 Why choose Serenity/JS?
21
+
22
+ - Write **expressive**, **maintainable** tests that align with your unique domain using the [**Serenity/JS Screenplay Pattern**](https://serenity-js.org/handbook/design/screenplay-pattern) APIs.
23
+ - **Leverage advanced reporting** to track progress, detect failures, and share results with both technical and business stakeholders.
24
+ - Build on flexible, modular, and extensible architecture that supports a wide range of test automation needs.
25
+ - Integrate with WebdriverIO 8 and modern test automation tools.
26
+
27
+ ## 🛠️ Integrate WebdriverIO 8 with Serenity/JS in 4 steps
28
+
29
+ ### 1. Installing Serenity/JS modules
30
+
31
+ To add Serenity/JS to an existing WebdriverIO 8 project, install the following Serenity/JS modules from NPM:
32
+
33
+ ```sh
34
+ npm install --save-dev @serenity-js/core @serenity-js/web @serenity-js/webdriverio-8 @serenity-js/assertions @serenity-js/rest @serenity-js/console-reporter @serenity-js/serenity-bdd
35
+ ```
36
+
37
+ Learn more about Serenity/JS modules:
38
+ - [`@serenity-js/core`](/api/core/)
39
+ - [`@serenity-js/web`](/api/web/)
40
+ - [`@serenity-js/webdriverio-8`](/api/webdriverio-8/)
41
+ - [`@serenity-js/assertions`](/api/assertions/)
42
+ - [`@serenity-js/rest`](/api/rest/)
43
+ - [`@serenity-js/console-reporter`](/api/console-reporter/)
44
+ - [`@serenity-js/serenity-bdd`](/api/serenity-bdd/)
45
+
46
+ If you prefer to review a reference implementation first, clone a [Serenity/JS Project Template](https://serenity-js.org/handbook/getting-started/project-templates/) for your preferred test runner.
47
+
48
+ ### 2. Configuring Serenity/JS
49
+
50
+ To enable integration with Serenity/JS, configure WebdriverIO as follows:
51
+
52
+ ```ts
53
+ // wdio.conf.ts
54
+ import { WebdriverIOConfig } from '@serenity-js/webdriverio-8';
55
+
56
+ export const config: WebdriverIOConfig = {
57
+
58
+ // Tell WebdriverIO to use Serenity/JS framework with the WebdriverIO 8 adapter
59
+ // When you're ready to upgrade to WebdriverIO 9, switch to '@serenity-js/webdriverio'
60
+ framework: '@serenity-js/webdriverio-8',
61
+
62
+ // Serenity/JS configuration
63
+ serenity: {
64
+ // Configure Serenity/JS to use the appropriate adapter
65
+ // for your test runner
66
+ runner: 'cucumber', // or 'mocha', or 'jasmine'
67
+
68
+ // Register Serenity/JS reporting services, a.k.a. the "stage crew"
69
+ crew: [
70
+ // Optional, print test execution results to standard output
71
+ '@serenity-js/console-reporter',
72
+
73
+ // Optional, produce Serenity BDD reports
74
+ // and living documentation (HTML)
75
+ '@serenity-js/serenity-bdd',
76
+ [ '@serenity-js/core:ArtifactArchiver', {
77
+ outputDirectory: 'target/site/serenity'
78
+ } ],
79
+
80
+ // Optional, automatically capture screenshots
81
+ // upon interaction failure
82
+ [ '@serenity-js/web:Photographer', {
83
+ strategy: 'TakePhotosOfFailures'
84
+ } ],
85
+ ]
86
+ },
87
+
88
+ // Location of your test files
89
+ specs: [
90
+ './test/specs/**/*.spec.ts', // for Mocha or Jasmine
91
+ // './features/**/*.feature', // for Cucumber
92
+ ],
93
+
94
+ // Configure your Cucumber runner
95
+ cucumberOpts: {
96
+ // see Cucumber configuration options below
97
+ },
98
+
99
+
100
+ // ... or Jasmine runner
101
+ jasmineOpts: {
102
+ // see Jasmine configuration options below
103
+ },
104
+
105
+ // ... or Mocha runner
106
+ mochaOpts: {
107
+ // see Mocha configuration options below
108
+ },
109
+
110
+ runner: 'local',
111
+
112
+ // Enable TypeScript in-memory compilation
113
+ autoCompileOpts: {
114
+ autoCompile: true,
115
+ tsNodeOpts: {
116
+ transpileOnly: true,
117
+ project: 'tsconfig.json'
118
+ }
119
+ },
120
+
121
+ // Any other WebdriverIO configuration
122
+ };
123
+ ```
124
+
125
+ Learn more about:
126
+ - [Serenity/JS Cucumber configuration options](/api/cucumber-adapter/interface/CucumberConfig/)
127
+ - [Serenity/JS Jasmine configuration options](/api/jasmine-adapter/interface/JasmineConfig/)
128
+ - [Serenity/JS Mocha configuration options](/api/mocha-adapter/interface/MochaConfig/)
129
+ - [WebdriverIO configuration file](https://webdriver.io/docs/configurationfile/)
130
+
131
+ ### 3. Generating Serenity BDD reports and living documentation
132
+
133
+ [Serenity BDD reports and living documentation](https://serenity-bdd.github.io/docs/reporting/the_serenity_reports) are generated by [Serenity BDD CLI](https://github.com/serenity-bdd/serenity-core/tree/main/serenity-cli),
134
+ a Java program provided by the [`@serenity-js/serenity-bdd`](/api/serenity-bdd/) module.
135
+
136
+ To produce Serenity BDD reports, your test suite must:
137
+ - produce intermediate Serenity BDD `.json` reports, by registering [`SerenityBDDReporter`](/api/serenity-bdd/class/SerenityBDDReporter/) as per the [configuration instructions](#configuring-serenityjs-and-webdriverio)
138
+ - invoke the Serenity BDD CLI when you want to produce the report, by calling `serenity-bdd run`
139
+
140
+ The pattern used by all the [Serenity/JS Project Templates](/handbook/getting-started/project-templates/) relies
141
+ on using the following Node modules:
142
+ - [`npm-failsafe`](https://www.npmjs.com/package/npm-failsafe) to run the reporting process even if the test suite itself has failed (which is precisely when you need test reports the most...).
143
+ - [`rimraf`](https://www.npmjs.com/package/rimraf) as a convenience method to remove any test reports left over from the previous run
144
+
145
+ ```json title="package.json"
146
+ {
147
+ "scripts": {
148
+ "test": "failsafe test:clean test:wdio test:report",
149
+ "test:clean": "rimraf target",
150
+ "test:wdio": "wdio run ./wdio.conf.ts",
151
+ "test:report": "serenity-bdd run"
152
+ }
153
+ }
154
+ ```
155
+
156
+ To learn more about the `SerenityBDDReporter`, please consult:
157
+ - installation instructions in [`@serenity-js/serenity-bdd` documentation](/api/serenity-bdd/),
158
+ - configuration examples in [`SerenityBDDReporter` API docs](/api/serenity-bdd/class/SerenityBDDReporter/),
159
+ - [Serenity/JS examples on GitHub](https://github.com/serenity-js/serenity-js/tree/main/examples).
160
+
161
+ ### 4. Writing a test scenario
162
+
163
+ Assuming you're using WebdriverIO 8 with Mocha, create a test file under `./test/specs/example.spec.ts` with the following contents:
164
+
165
+ ```ts
166
+ // ./test/specs/example.spec.ts
167
+ import { describe, it } from 'mocha'
168
+
169
+ import { Ensure, equals } from '@serenity-js/assertions'
170
+ import { actorCalled } from '@serenity-js/core'
171
+ import { By, Navigate, PageElement, Text } from '@serenity-js/web'
172
+
173
+ describe('Example', () => {
174
+
175
+ it('interacts with a web page', async () => {
176
+
177
+ await actorCalled('Alice').attemptsTo(
178
+ Navigate.to('https://serenity-js.org'),
179
+ Ensure.that(
180
+ Text.of(PageElement.located(By.id('cta-start-automating'))),
181
+ equals('Start automating 🚀')
182
+ ),
183
+ )
184
+ })
185
+ })
186
+ ```
187
+
188
+ You'll notice that the example test file uses:
189
+ - [`@serenity-js/assertions`](https://serenity-js.org/api/assertions/) - to make assertions about the state of the system under test
190
+ - [`@serenity-js/core`](https://serenity-js.org/api/core/) - to create and manage actors
191
+ - [`@serenity-js/web`](https://serenity-js.org/api/web/) - to interact with web pages
192
+
193
+ You'll also notice that the file **does not** use the `@serenity-js/webdriverio-8` module directly.
194
+ This is because the `@serenity-js/web` module provides a higher-level API for interacting with web pages,
195
+ allowing you to switch to `@serenity-js/webdriverio` whenever you're ready to upgrade to WebdriverIO 9 without changing your test scenarios.
196
+
197
+ You can learn more about these and other Serenity/JS modules in the [Serenity/JS API documentation](https://serenity-js.org/api/).
198
+ You might also want to check out the [Serenity/JS WebdriverIO integration guide](https://serenity-js.org/handbook/test-runners/webdriverio/) for more details on configuring your framework.
199
+
200
+ ### 4. Running your tests and generating reports
201
+
202
+ To run your tests and generate Serenity/JS reports, execute the following command in your terminal:
203
+
204
+ ```sh
205
+ npm test
206
+ ```
207
+
208
+ Your test results will be available in the `target/site/serenity` directory.
209
+ To view them, open the `index.html` file in your preferred web browser.
210
+
211
+ ## 💡️ Learn Serenity/JS
212
+
213
+ - [Serenity/JS WebdriverIO integration guide](https://serenity-js.org/handbook/test-runners/webdriverio/) - Integrate Serenity/JS with your WebdriverIO test suite, enable Serenity BDD reports, and start using the Screenplay Pattern
214
+ - [Serenity/JS Handbook](https://serenity-js.org/handbook/) - Write high-quality automated acceptance tests with Serenity/JS
215
+ - [Serenity/JS API documentation](https://serenity-js.org/api/) - Explore Serenity/JS modules and features
216
+ - [Serenity/JS Project Templates](https://serenity-js.org/handbook/getting-started/project-templates/) - Kickstart your projects with best practices built right in
217
+
218
+ ## 👋 Join the Serenity/JS Community
219
+
220
+ - [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im) - Meet Serenity/JS developers and maintainers
221
+ - [Serenity/JS Forum](https://github.com/orgs/serenity-js/discussions/categories/how-to) - Find answers to your Serenity/JS questions
222
+ - [Contribute to Serenity/JS](https://serenity-js.org/community/contributing/) - Learn how to propose features, report bugs, and contribute to the Serenity/JS codebase
223
+
224
+ ## 📣 Stay up to date
225
+
226
+ - [Serenity/JS on YouTube](https://www.youtube.com/@serenity-js) - Subscribe for tutorials, demos, conference talks, and more
227
+ - [Serenity/JS on LinkedIn](https://www.linkedin.com/company/serenity-js) - Follow for release and community event announcements
228
+ - [Serenity/JS on GitHub](https://github.com/serenity-js/serenity-js) - Star Serenity/JS to help others discover the framework!
229
+
230
+ ## 💛 Support Serenity/JS
231
+
232
+ Support our mission to make test automation collaborative and easier to scale. Become a Serenity/JS GitHub Sponsor today!
233
+
234
+ [![GitHub Sponsors](https://img.shields.io/badge/Sponsor%20@serenity%2FJS-703EC8?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sponsors/serenity-js)
@@ -0,0 +1,17 @@
1
+ import type { TestRunnerAdapter } from '@serenity-js/core/lib/adapter/index.js';
2
+ import type { ModuleLoader } from '@serenity-js/core/lib/io/index.js';
3
+ import { Path } from '@serenity-js/core/lib/io/index.js';
4
+ import type { WebdriverIOConfig } from '../config/index.js';
5
+ export declare class TestRunnerLoader {
6
+ private readonly loader;
7
+ private readonly cwd;
8
+ private readonly cid;
9
+ private readonly fileSystem;
10
+ private readonly finder;
11
+ constructor(loader: ModuleLoader, cwd: Path, cid: string);
12
+ runnerAdapterFor(config: WebdriverIOConfig): TestRunnerAdapter;
13
+ private cucumberAdapter;
14
+ private jasmineAdapter;
15
+ private mochaAdapter;
16
+ }
17
+ //# sourceMappingURL=TestRunnerLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestRunnerLoader.d.ts","sourceRoot":"","sources":["../../src/adapter/TestRunnerLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAC,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAkC,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQ5D,qBAAa,gBAAgB;IAKrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IANxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAGf,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,MAAM;IAMhC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB;IAiB9D,OAAO,CAAC,eAAe;IAoCvB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,YAAY;CAKvB"}
@@ -0,0 +1,63 @@
1
+ import { ConfigurationError } from '@serenity-js/core';
2
+ import { Config, FileFinder, FileSystem, Path } from '@serenity-js/core/lib/io/index.js';
3
+ export class TestRunnerLoader {
4
+ loader;
5
+ cwd;
6
+ cid;
7
+ fileSystem;
8
+ finder;
9
+ constructor(loader, cwd, cid) {
10
+ this.loader = loader;
11
+ this.cwd = cwd;
12
+ this.cid = cid;
13
+ this.fileSystem = new FileSystem(cwd);
14
+ this.finder = new FileFinder(cwd);
15
+ }
16
+ runnerAdapterFor(config) {
17
+ switch (config?.serenity?.runner) {
18
+ case 'cucumber':
19
+ return this.cucumberAdapter(config?.cucumberOpts);
20
+ case 'jasmine':
21
+ return this.jasmineAdapter(config?.jasmineOpts);
22
+ case 'mocha':
23
+ case undefined:
24
+ return this.mochaAdapter(config?.mochaOpts);
25
+ default:
26
+ throw new ConfigurationError(`"${config?.serenity?.runner}" is not a supported test runner. Please use "mocha", "jasmine", or "cucumber"`);
27
+ }
28
+ }
29
+ cucumberAdapter(cucumberOptions) {
30
+ const { CucumberCLIAdapter, CucumberFormat, StandardOutput, TempFileOutput } = this.loader.require('@serenity-js/cucumber/lib/adapter/index.js');
31
+ delete cucumberOptions?.timeout; // todo: support setting a timeout via config?
32
+ delete cucumberOptions?.parallel; // WebdriverIO handles that already
33
+ const cleanedCucumberOptions = new Config(cucumberOptions)
34
+ .where('format', values => [].concat(values).map(value => {
35
+ const format = new CucumberFormat(value);
36
+ if (format.output === '') {
37
+ return format.value;
38
+ }
39
+ const basename = Path.from(format.output).basename();
40
+ const filenameParts = basename.split('.');
41
+ if (filenameParts[0] === basename) {
42
+ return `${format.formatter}:${format.output}.${this.cid}`;
43
+ }
44
+ filenameParts.splice(-1, 0, `${this.cid}`);
45
+ return `${format.formatter}:${format.output.replace(basename, filenameParts.join('.'))}`;
46
+ })).object();
47
+ // check if we need to free up stdout for any native reporters
48
+ const output = cleanedCucumberOptions?.format?.some(format => new CucumberFormat(format).output === '')
49
+ ? new TempFileOutput(this.fileSystem)
50
+ : new StandardOutput();
51
+ return new CucumberCLIAdapter(cleanedCucumberOptions, this.loader, this.fileSystem, output);
52
+ }
53
+ jasmineAdapter(jasmineOptions) {
54
+ const { JasmineAdapter } = this.loader.require('@serenity-js/jasmine/adapter');
55
+ return new JasmineAdapter(jasmineOptions, this.loader);
56
+ }
57
+ mochaAdapter(mochaOptions) {
58
+ // todo: update path to mocha adapter too
59
+ const { MochaAdapter } = this.loader.require('@serenity-js/mocha/lib/adapter/index.js');
60
+ return new MochaAdapter(mochaOptions, this.loader);
61
+ }
62
+ }
63
+ //# sourceMappingURL=TestRunnerLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestRunnerLoader.js","sourceRoot":"","sources":["../../src/adapter/TestRunnerLoader.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,25 @@
1
+ import 'webdriverio';
2
+ import type { Serenity } from '@serenity-js/core';
3
+ import type { ModuleLoader } from '@serenity-js/core/lib/io/index.js';
4
+ import { Path } from '@serenity-js/core/lib/io/index.js';
5
+ import type { Capabilities } from '@wdio/types';
6
+ import type { EventEmitter } from 'events';
7
+ import type { WebdriverIOConfig } from '../config/index.js';
8
+ import type { InitialisesReporters, ProvidesWriteStream } from './reporter/index.js';
9
+ export declare class WebdriverIOFrameworkAdapter {
10
+ private readonly serenity;
11
+ private readonly loader;
12
+ private readonly cwd;
13
+ private readonly cid;
14
+ private readonly specs;
15
+ private readonly capabilities;
16
+ private readonly reporter;
17
+ private adapter;
18
+ private notifier;
19
+ constructor(serenity: Serenity, loader: ModuleLoader, cwd: Path, cid: string, webdriverIOConfig: WebdriverIOConfig, specs: string[], capabilities: Capabilities.RemoteCapability, reporter: EventEmitter & ProvidesWriteStream & InitialisesReporters);
20
+ init(): Promise<WebdriverIOFrameworkAdapter>;
21
+ hasTests(): boolean;
22
+ run(): Promise<number>;
23
+ private defaultConfig;
24
+ }
25
+ //# sourceMappingURL=WebdriverIOFrameworkAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebdriverIOFrameworkAdapter.d.ts","sourceRoot":"","sources":["../../src/adapter/WebdriverIOFrameworkAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAMrF,qBAAa,2BAA2B;IAMhC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAX7B,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,QAAQ,CAAsB;gBAGjB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,MAAM,EAC5B,iBAAiB,EAAE,iBAAiB,EACnB,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,YAAY,CAAC,gBAAgB,EAC3C,QAAQ,EAAE,YAAY,GAAG,mBAAmB,GAAG,oBAAoB;IAwDlF,IAAI,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAqBlD,QAAQ,IAAI,OAAO;IAIb,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IAK5B,OAAO,CAAC,aAAa;CASxB"}
@@ -0,0 +1,90 @@
1
+ import 'webdriverio';
2
+ import { AnsiDiffFormatter, ArtifactArchiver, Cast, TakeNotes } from '@serenity-js/core';
3
+ import { Path } from '@serenity-js/core/lib/io/index.js';
4
+ import { CallAnApi } from '@serenity-js/rest';
5
+ import * as deepmerge from 'deepmerge';
6
+ import { isRecord } from 'tiny-types/lib/objects/isRecord.js';
7
+ import { BrowseTheWebWithWebdriverIO } from '../screenplay/index.js';
8
+ import { BrowserCapabilitiesReporter, OutputStreamBuffer } from './reporter/index.js';
9
+ import { OutputStreamBufferPrinter } from './reporter/OutputStreamBufferPrinter.js';
10
+ import { TestRunnerLoader } from './TestRunnerLoader.js';
11
+ import { WebdriverIONotifier } from './WebdriverIONotifier.js';
12
+ export class WebdriverIOFrameworkAdapter {
13
+ serenity;
14
+ loader;
15
+ cwd;
16
+ cid;
17
+ specs;
18
+ capabilities;
19
+ reporter;
20
+ adapter;
21
+ notifier;
22
+ constructor(serenity, loader, cwd, cid, webdriverIOConfig, specs, capabilities, reporter) {
23
+ this.serenity = serenity;
24
+ this.loader = loader;
25
+ this.cwd = cwd;
26
+ this.cid = cid;
27
+ this.specs = specs;
28
+ this.capabilities = capabilities;
29
+ this.reporter = reporter;
30
+ const config = deepmerge.default(this.defaultConfig(), webdriverIOConfig, {
31
+ isMergeableObject: isRecord,
32
+ });
33
+ // SauceLabs service serialises the config object for debugging.
34
+ // However, since Serenity/JS Stage is a pub/sub mechanism,
35
+ // it contains cyclic references which are not serialisable.
36
+ // We get rid of them from the config object to avoid confusing other services.
37
+ delete webdriverIOConfig.serenity;
38
+ this.adapter = new TestRunnerLoader(this.loader, this.cwd, this.cid)
39
+ .runnerAdapterFor(config);
40
+ this.notifier = new WebdriverIONotifier(config, capabilities, reporter, this.adapter.successThreshold(), cid, this.specs);
41
+ const outputStreamBuffer = new OutputStreamBuffer(`[${this.cid}]`);
42
+ const outputStreamBufferPrinter = new OutputStreamBufferPrinter(outputStreamBuffer, reporter.getWriteStreamObject('@serenity-js/webdriverio-8'));
43
+ this.serenity.configure({
44
+ outputStream: outputStreamBuffer,
45
+ cueTimeout: config.serenity.cueTimeout,
46
+ interactionTimeout: config.serenity.interactionTimeout,
47
+ diffFormatter: config.serenity.diffFormatter ?? new AnsiDiffFormatter(),
48
+ actors: config.serenity.actors || Cast.where(actor => actor.whoCan(BrowseTheWebWithWebdriverIO.using(global.browser), TakeNotes.usingAnEmptyNotepad(), CallAnApi.using({
49
+ baseURL: webdriverIOConfig.baseUrl,
50
+ }))),
51
+ crew: [
52
+ ...config.serenity.crew,
53
+ this.notifier,
54
+ outputStreamBufferPrinter,
55
+ ]
56
+ });
57
+ }
58
+ async init() {
59
+ // This is the only (hacky) way to register a fake reporter programmatically (as of @wdio/reporter 7.4.2)
60
+ // - https://github.com/webdriverio/webdriverio/blob/365fb0ad79fcf4471f21f23e18afa6818986dbdb/packages/wdio-runner/src/index.ts#L147-L181
61
+ // - https://github.com/webdriverio/webdriverio/blob/365fb0ad79fcf4471f21f23e18afa6818986dbdb/packages/wdio-runner/src/reporter.ts#L24
62
+ const browserCapabilitiesReporter = await (this.reporter._loadReporter([
63
+ BrowserCapabilitiesReporter, {
64
+ serenity: this.serenity
65
+ },
66
+ ]));
67
+ this.reporter._reporters.push(browserCapabilitiesReporter);
68
+ // WebdriverIO v8 represents paths to specs as file URIs, so they need to be converted to absolute paths to avoid confusing the test runners like Cucumber
69
+ const absolutePaths = this.specs.map(pathToSpec => Path.from(pathToSpec).value);
70
+ await this.adapter.load(absolutePaths);
71
+ return this;
72
+ }
73
+ hasTests() {
74
+ return this.adapter.scenarioCount() > 0;
75
+ }
76
+ async run() {
77
+ await this.adapter.run();
78
+ return this.notifier.failureCount();
79
+ }
80
+ defaultConfig() {
81
+ return {
82
+ serenity: {
83
+ crew: [
84
+ ArtifactArchiver.storingArtifactsAt(this.cwd.value, 'target/site/serenity'),
85
+ ]
86
+ }
87
+ };
88
+ }
89
+ }
90
+ //# sourceMappingURL=WebdriverIOFrameworkAdapter.js.map