@testim/testim-cli 3.289.0 → 3.290.1-beta

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 (217) hide show
  1. package/cli.js +22390 -122
  2. package/cli.js.map +1 -0
  3. package/npm-shrinkwrap.json +1169 -12846
  4. package/package.json +16 -10
  5. package/OverrideTestDataBuilder.js +0 -117
  6. package/agent/routers/cliJsCode/index.js +0 -13
  7. package/agent/routers/cliJsCode/router.js +0 -63
  8. package/agent/routers/cliJsCode/service.js +0 -705
  9. package/agent/routers/codim/router.js +0 -69
  10. package/agent/routers/codim/router.test.js +0 -60
  11. package/agent/routers/codim/service.js +0 -193
  12. package/agent/routers/general/index.js +0 -36
  13. package/agent/routers/hybrid/registerRoutes.js +0 -81
  14. package/agent/routers/index.js +0 -56
  15. package/agent/routers/playground/router.js +0 -77
  16. package/agent/routers/playground/service.js +0 -96
  17. package/agent/routers/standalone-browser/registerRoutes.js +0 -47
  18. package/agent/server.js +0 -150
  19. package/cdpTestRunner.js +0 -86
  20. package/chromiumInstaller.js +0 -91
  21. package/cli/isCiRun.js +0 -10
  22. package/cli/onExit.js +0 -65
  23. package/cli/writeStackTrace.js +0 -27
  24. package/cliAgentMode.js +0 -384
  25. package/codim/codim-cli.js +0 -91
  26. package/codim/codim-npm-package/index.ts +0 -427
  27. package/codim/codim-npm-package/package-lock.json +0 -14
  28. package/codim/codim-npm-package/package.json +0 -14
  29. package/codim/hybrid-utils.js +0 -28
  30. package/codim/measure-perf.js +0 -41
  31. package/codim/template.js/.idea/workspace.xml +0 -57
  32. package/codim/template.js/.vscode/launch.json +0 -53
  33. package/codim/template.ts/.idea/workspace.xml +0 -57
  34. package/codim/template.ts/.vscode/launch.json +0 -55
  35. package/commons/AbortError.js +0 -12
  36. package/commons/SeleniumPerfStats.js +0 -58
  37. package/commons/chrome-launcher.js +0 -15
  38. package/commons/chromedriverWrapper.js +0 -70
  39. package/commons/config.js +0 -39
  40. package/commons/constants.js +0 -67
  41. package/commons/detectDebugger.js +0 -19
  42. package/commons/featureAvailabilityService.js +0 -26
  43. package/commons/featureFlags.js +0 -132
  44. package/commons/getSessionPlayerRequire.js +0 -28
  45. package/commons/httpRequest.js +0 -261
  46. package/commons/httpRequestCounters.js +0 -98
  47. package/commons/httpRequestCounters.test.js +0 -38
  48. package/commons/initializeUserWithAuth.js +0 -55
  49. package/commons/lazyRequire.js +0 -105
  50. package/commons/logUtils.js +0 -15
  51. package/commons/logUtils.test.js +0 -21
  52. package/commons/logger.js +0 -178
  53. package/commons/mockNetworkRuleFileSchema.json +0 -140
  54. package/commons/npmWrapper.js +0 -174
  55. package/commons/npmWrapper.test.js +0 -374
  56. package/commons/performance-logger.js +0 -71
  57. package/commons/preloadTests.js +0 -29
  58. package/commons/prepareRunner.js +0 -85
  59. package/commons/prepareRunner.test.js +0 -144
  60. package/commons/prepareRunnerAndTestimStartUtils.js +0 -198
  61. package/commons/prepareRunnerAndTestimStartUtils.test.js +0 -73
  62. package/commons/requireWithFallback.js +0 -25
  63. package/commons/runnerFileCache.js +0 -204
  64. package/commons/socket/baseSocketServiceSocketIO.js +0 -197
  65. package/commons/socket/realDataService.js +0 -59
  66. package/commons/socket/realDataServiceSocketIO.js +0 -33
  67. package/commons/socket/remoteStepService.js +0 -55
  68. package/commons/socket/remoteStepServiceSocketIO.js +0 -61
  69. package/commons/socket/socketService.js +0 -175
  70. package/commons/socket/testResultService.js +0 -62
  71. package/commons/socket/testResultServiceSocketIO.js +0 -64
  72. package/commons/testimAnalytics.js +0 -40
  73. package/commons/testimCloudflare.js +0 -83
  74. package/commons/testimCloudflare.test.js +0 -185
  75. package/commons/testimCustomToken.js +0 -124
  76. package/commons/testimDesiredCapabilitiesBuilder.js +0 -647
  77. package/commons/testimNgrok.js +0 -90
  78. package/commons/testimNgrok.test.js +0 -140
  79. package/commons/testimServicesApi.js +0 -631
  80. package/commons/testimTunnel.js +0 -73
  81. package/commons/testimTunnel.test.js +0 -172
  82. package/commons/xhr2.js +0 -897
  83. package/coverage/SummaryToObjectReport.js +0 -19
  84. package/coverage/jsCoverage.js +0 -252
  85. package/credentialsManager.js +0 -142
  86. package/errors.js +0 -161
  87. package/executionQueue.js +0 -37
  88. package/fixLocalBuild.js +0 -24
  89. package/inputFileUtils.js +0 -103
  90. package/lib/coralogix-winston.transport.js +0 -99
  91. package/player/SeleniumProtocolError.js +0 -100
  92. package/player/WebDriverHttpRequest.js +0 -177
  93. package/player/WebdriverioWebDriverApi.js +0 -671
  94. package/player/appiumTestPlayer.js +0 -90
  95. package/player/chromeLauncherTestPlayer.js +0 -67
  96. package/player/constants.js +0 -332
  97. package/player/extensionTestPlayer.js +0 -32
  98. package/player/findElementStrategy.js +0 -154
  99. package/player/scripts/isElementDisplayed.js +0 -252
  100. package/player/seleniumTestPlayer.js +0 -140
  101. package/player/services/frameLocator.js +0 -170
  102. package/player/services/mobileFrameLocatorMock.js +0 -32
  103. package/player/services/playbackTimeoutCalculator.js +0 -175
  104. package/player/services/portSelector.js +0 -19
  105. package/player/services/tabService.js +0 -551
  106. package/player/services/tabServiceMock.js +0 -167
  107. package/player/services/windowCreationListener.js +0 -8
  108. package/player/stepActions/RefreshStepAction.js +0 -16
  109. package/player/stepActions/apiStepAction.js +0 -89
  110. package/player/stepActions/baseCliJsStepAction.js +0 -51
  111. package/player/stepActions/baseJsStepAction.js +0 -277
  112. package/player/stepActions/cliConditionStepAction.js +0 -11
  113. package/player/stepActions/cliJsStepAction.js +0 -11
  114. package/player/stepActions/dropFileStepAction.js +0 -34
  115. package/player/stepActions/evaluateExpressionStepAction.js +0 -52
  116. package/player/stepActions/extensionOnlyStepAction.js +0 -12
  117. package/player/stepActions/extractTextStepAction.js +0 -19
  118. package/player/stepActions/hoverStepAction.js +0 -55
  119. package/player/stepActions/inputFileStepAction.js +0 -199
  120. package/player/stepActions/jsCodeStepAction.js +0 -11
  121. package/player/stepActions/jsConditionStepAction.js +0 -11
  122. package/player/stepActions/locateStepAction.js +0 -159
  123. package/player/stepActions/mouseStepAction.js +0 -370
  124. package/player/stepActions/navigationStepAction.js +0 -29
  125. package/player/stepActions/nodePackageStepAction.js +0 -47
  126. package/player/stepActions/pixelValidationStepAction.js +0 -39
  127. package/player/stepActions/scripts/dispatchEvents.js +0 -282
  128. package/player/stepActions/scripts/doClick.js +0 -221
  129. package/player/stepActions/scripts/doDragPath.js +0 -225
  130. package/player/stepActions/scripts/doubleClick.js +0 -119
  131. package/player/stepActions/scripts/dropEvent.js +0 -63
  132. package/player/stepActions/scripts/focusElement.js +0 -46
  133. package/player/stepActions/scripts/html5dragAction.js +0 -56
  134. package/player/stepActions/scripts/html5dragActionV2.js +0 -312
  135. package/player/stepActions/scripts/runCode.js +0 -147
  136. package/player/stepActions/scripts/scroll.js +0 -90
  137. package/player/stepActions/scripts/selectOption.js +0 -51
  138. package/player/stepActions/scripts/setText.js +0 -415
  139. package/player/stepActions/scripts/wheel.js +0 -61
  140. package/player/stepActions/scrollStepAction.js +0 -96
  141. package/player/stepActions/selectOptionStepAction.js +0 -49
  142. package/player/stepActions/sfdcRecordedStepAction.js +0 -24
  143. package/player/stepActions/sfdcStepAction.js +0 -28
  144. package/player/stepActions/sleepStepAction.js +0 -12
  145. package/player/stepActions/specialKeyStepAction.js +0 -52
  146. package/player/stepActions/stepAction.js +0 -73
  147. package/player/stepActions/stepActionRegistrar.js +0 -111
  148. package/player/stepActions/submitStepAction.js +0 -12
  149. package/player/stepActions/tdkHybridStepAction.js +0 -18
  150. package/player/stepActions/textStepAction.js +0 -110
  151. package/player/stepActions/textValidationStepAction.js +0 -64
  152. package/player/stepActions/wheelStepAction.js +0 -41
  153. package/player/utils/cookieUtils.js +0 -39
  154. package/player/utils/eyeSdkService.js +0 -250
  155. package/player/utils/imageCaptureUtils.js +0 -267
  156. package/player/utils/screenshotUtils.js +0 -68
  157. package/player/utils/stepActionUtils.js +0 -90
  158. package/player/utils/windowUtils.js +0 -195
  159. package/player/webDriverUtils.js +0 -40
  160. package/player/webDriverUtils.test.js +0 -116
  161. package/player/webdriver.js +0 -976
  162. package/polyfills/Array.prototype.at.js +0 -13
  163. package/polyfills/index.js +0 -13
  164. package/processHandler.js +0 -79
  165. package/processHandler.test.js +0 -55
  166. package/reports/chromeReporter.js +0 -17
  167. package/reports/consoleReporter.js +0 -190
  168. package/reports/debugReporter.js +0 -82
  169. package/reports/jsonReporter.js +0 -55
  170. package/reports/junitReporter.js +0 -183
  171. package/reports/reporter.js +0 -166
  172. package/reports/reporterUtils.js +0 -54
  173. package/reports/teamCityReporter.js +0 -73
  174. package/runOptions.d.ts +0 -305
  175. package/runOptions.js +0 -1288
  176. package/runOptionsAgentFlow.js +0 -87
  177. package/runOptionsUtils.js +0 -60
  178. package/runner.js +0 -355
  179. package/runners/ParallelWorkerManager.js +0 -284
  180. package/runners/TestPlanRunner.js +0 -419
  181. package/runners/buildCodeTests.js +0 -159
  182. package/runners/runnerUtils.js +0 -81
  183. package/services/analyticsService.js +0 -96
  184. package/services/branchService.js +0 -29
  185. package/services/gridService.js +0 -357
  186. package/services/gridService.test.js +0 -357
  187. package/services/labFeaturesService.js +0 -64
  188. package/services/lambdatestService.js +0 -227
  189. package/services/lambdatestService.test.js +0 -353
  190. package/services/localRCASaver.js +0 -124
  191. package/stepPlayers/cliJsStepPlayback.js +0 -40
  192. package/stepPlayers/hybridStepPlayback.js +0 -140
  193. package/stepPlayers/nodePackageStepPlayback.js +0 -28
  194. package/stepPlayers/playwrightHybridStepPlayback.js +0 -61
  195. package/stepPlayers/puppeteerHybridStepPlayback.js +0 -76
  196. package/stepPlayers/remoteStepPlayback.js +0 -80
  197. package/stepPlayers/seleniumHybridStepPlayback.js +0 -84
  198. package/stepPlayers/tdkHybridStepPlayback.js +0 -112
  199. package/testRunHandler.js +0 -603
  200. package/testRunStatus.js +0 -567
  201. package/testimNpmDriver.js +0 -52
  202. package/utils/argsUtils.js +0 -91
  203. package/utils/argsUtils.test.js +0 -32
  204. package/utils/fsUtils.js +0 -174
  205. package/utils/index.js +0 -197
  206. package/utils/promiseUtils.js +0 -85
  207. package/utils/stringUtils.js +0 -98
  208. package/utils/stringUtils.test.js +0 -22
  209. package/utils/timeUtils.js +0 -25
  210. package/utils/utils.test.js +0 -27
  211. package/workers/BaseWorker.js +0 -498
  212. package/workers/BaseWorker.test.js +0 -186
  213. package/workers/WorkerAppium.js +0 -180
  214. package/workers/WorkerExtension.js +0 -192
  215. package/workers/WorkerExtensionSingleBrowser.js +0 -77
  216. package/workers/WorkerSelenium.js +0 -253
  217. package/workers/workerUtils.js +0 -20
@@ -1,427 +0,0 @@
1
- /**
2
- * Happens when you call a test from node directly (node myFile.js) instead of through the Testim CLI (testim run myFile.js)
3
- */
4
- class StubError extends Error {
5
- constructor(name: string) { super(`Error calling ${name} stub. Codim needs to run through the Testim CLI`); }
6
- }
7
-
8
- /**
9
- * Represents the Testim Dev Kit step locator.
10
- * @see https://help.testim.io/docs/working-with-locators
11
- */
12
- class TDKStepLocator {
13
- public elementLocator?: any;
14
- public selector?: string;
15
- public nthChildIndex?: number;
16
- public id?: string;
17
- public name?: string;
18
- public innerLocator?: TDKStepLocator;
19
- public parentLocator?: TDKStepLocator;
20
- public find(selector: any): TDKStepLocator {
21
- throw new StubError('TDKStepLocator.find');
22
- }
23
- public nthChild(index: number): TDKStepLocator {
24
- throw new StubError('TDKStepLocator.nthChild');
25
- }
26
- public childWithText(text: string): TDKStepLocator {
27
- throw new StubError('TDKStepLocator.childWithText');
28
- }
29
- /**
30
- * Sets the locator confidence threshold
31
- * @param threshold the locator conidence score
32
- */
33
- withConfidence(threshold: number): TDKStepLocator {
34
- throw new StubError('TDKStepLocator.withThreshold');
35
- }
36
- }
37
-
38
- /**
39
- * Represents the options passed to a click.
40
- * @see https://help.testim.io/docs/click
41
- */
42
- type ClickOptions = { button?: 'left' | 'right'; offset?: { x: number; y: number } };
43
-
44
- /**
45
- * Represents the return value from a getCookie or setCookie call.
46
- * @see https://help.testim.io/docs/get-cookie
47
- */
48
- class CookieData {
49
- name?: string;
50
- value?: string;
51
- domain?: string;
52
- expires?: number;
53
- httpOnly? = true;
54
- secure? = false;
55
- path?: string;
56
- }
57
- /**
58
- * Represents an x/y point - passed to Drag and Drop
59
- */
60
- type Point = {
61
- x: number;
62
- y: number;
63
- }
64
- /**
65
- * A CSS selector used to select an element. This is usually a string like `'.foo'` and the syntax is whatever
66
- * the browser and JSDOM's `document.querySelector` understand.
67
- * @see https://www.w3.org/TR/selectors-3/#selectors
68
- */
69
- type Selector = string;
70
- /**
71
- * All Testim methods that work on an element work on either a Selector or TDKStepLocator
72
- */
73
- type SelectParam = Selector | TDKStepLocator;
74
- /**
75
- * The options passed to a scrollToElement command
76
- * @see https://help.testim.io/docs/scroll-to-element
77
- */
78
- type ScrollOptions = {
79
- scrollTarget?: SelectParam;
80
- }
81
- /** The options passed to a hover command
82
- * @see https://help.testim.io/docs/hover
83
- */
84
- type HoverOptions = {
85
- offset?: { x: number; y: number };
86
- }
87
- /** The options passed to a waitForCode command
88
- * @see https://help.testim.io/docs/wait-for-code
89
- */
90
- type WaitForCodeOptions = {
91
- pollInterval: number;
92
- }
93
- /** The options passed to a resize command
94
- * @see https://help.testim.io/docs/resize
95
- */
96
- type ResizeOptions = {
97
- width: number;
98
- height: number;
99
- }
100
- /** the options passed to a waitForElement command
101
- * @see https://help.testim.io/docs/wait-for-element
102
- */
103
- type WaitForElementOptions = {
104
- checkVisibility?: boolean;
105
- }
106
-
107
- /** the options passed to a waitForText command
108
- * @see https://help.testim.io/docs/wait-for-text
109
- */
110
- type WaitForTextOptions = {
111
- checkVisibility?: boolean;
112
- }
113
-
114
- type Headers = { [key: string]: string };
115
- type RequestMethods = 'GET' | 'POST' | 'PUT' | 'PATH' | 'DELETE' | 'COPY' | 'HEAD' | 'OPTIONS';
116
-
117
- type ApiCallOptions = {
118
- method?: RequestMethods;
119
- headers?: Headers;
120
- body?: string;
121
- sendViaWebApp?: boolean;
122
- omitCookies?: boolean;
123
- }
124
-
125
- export enum GeneratedValueTypes {
126
- LettersOnly = 'Letters Only',
127
- NumbersOnly = 'Numbers Only',
128
- Mixed = 'Mixed'
129
- }
130
-
131
- /**
132
- * Clicks the given element on the screen, clicks on the element in its center by default.
133
- * @see https://help.testim.io/docs/click
134
- */
135
- export async function click(selector: SelectParam, options: ClickOptions = {}): Promise<void> { throw new StubError('click'); }
136
-
137
- /**
138
- * Clicks the given element on the screen, clicks on the element in its center by default.
139
- * @see https://help.testim.io/docs/dblclick
140
- */
141
- export async function dblclick(selector: SelectParam, options: ClickOptions = {}): Promise<void> { throw new StubError('dblclick'); }
142
-
143
-
144
- /**
145
- * Sleeps a specified duration. Basically the same as
146
- * const sleep = require('util').promisify(setTimeout);
147
- * Except that it adds a sleep step to the UI
148
- * @param ms milliseconds to sleep
149
- */
150
- export async function sleep(ms: number): Promise<void> { throw new StubError('sleep'); }
151
- /**
152
- * Api call
153
- */
154
- export async function apiCall(url: string, options?: ApiCallOptions): Promise<{statusCode: number; statusText: string; requestDuration: number; responseBody: any; responseHeaders: any}> { throw new StubError('apiCall'); }
155
- /**
156
- * Get latest download item work only in Chrome extension mode
157
- */
158
- export async function downloadFile(): Promise<{fileName: string; fileType: string; sizeInBytes: number; fileBlob: any}> { throw new StubError('downloadFile'); }
159
- /**
160
- * Generate random value letters/numbers/mixed
161
- */
162
- export async function generateRandomValue(generatedLength = 12, valueType = GeneratedValueTypes.Mixed, prefixValue = ''): Promise<string> { throw new StubError('generateRandomValue'); }
163
- /**
164
- * Generate Testim random email - PRO feature
165
- */
166
- export async function generateTestimEmail(): Promise<string> { throw new StubError('generateTestimEmail'); }
167
- /**
168
- * Get email messages from Testim email inbox - PRO feature
169
- */
170
- export async function getTestimInbox(emailAddress: string): Promise<any[]> { throw new StubError('getTestimInbox'); }
171
- /**
172
- * Get document element outer html
173
- */
174
- export async function html(): Promise<string> { throw new StubError('html'); }
175
- /**
176
- * This method used to simulate upload file on <input type="file">
177
- */
178
- export async function inputFile(selector: SelectParam, inputFileUrls: string | string[]): Promise<void> { throw new StubError('inputFile'); }
179
- /**
180
- * This method used to simulate drop file on drop zone
181
- */
182
- export async function dropFile(selector: SelectParam, inputFileUrls: string | string[]): Promise<void> { throw new StubError('dropFile'); }
183
- /**
184
- * Refresh current page
185
- */
186
- export async function refresh(): Promise<void> { throw new StubError('refresh'); }
187
- /**
188
- * Get current page title
189
- */
190
- export async function title(): Promise<void> { throw new StubError('title'); }
191
- /**
192
- * Get current page url
193
- */
194
- export async function url(): Promise<void> { throw new StubError('url'); }
195
- /**
196
- * This method is used to extract an element's text content.
197
- * @see https://help.testim.io/docs/text
198
- */
199
- export async function text(selector: SelectParam): Promise<string> { throw new StubError('text'); }
200
- /**
201
- * Scroll to a given element on the screen.
202
- * @see https://help.testim.io/docs/scroll-to-element
203
- */
204
- export async function scrollToElement(selector: SelectParam, options: ScrollOptions = {}): Promise<void> { throw new StubError('scrollToElement'); }
205
- /**
206
- * This method is used to set an element's text content. If the element already has text content it overrides it.
207
- * @see https://help.testim.io/docs/type
208
- */
209
- export async function type(selector: SelectParam, textValue: string): Promise<void> { throw new StubError('type'); }
210
- /**
211
- * This method is used to run custom JavaScript in the browser application page. This is useful as an escape hatch and in order to implement interactions that are not available out of the box with Testim or in order to interact with the page JavaScript.
212
- * @see https://help.testim.io/docs/evaluate
213
- */
214
- export async function evaluate<R, U extends any[]>(fn: (...any: U) => R | Promise<R>, ...parameters: U): Promise<R> { throw new StubError('evaluate'); }
215
- /**
216
- * This method is used to execute an arbitrary command that runs in Node.js from within the test
217
- * @see https://help.testim.io/docs/cli-action
218
- */
219
- export async function cliAction<R, U extends any[]>(fn: (...any: U) => R | Promise<R>, ...parameters: U): Promise<R> { throw new StubError('cliAction'); }
220
- /**
221
- * The go command navigates to a given web page in the controlled browser.
222
- * @see https://help.testim.io/docs/go
223
- */
224
- export async function go(url: string): Promise<void> { throw new StubError('go'); }
225
- /**
226
- * Sets a cookie on a given page.
227
- * @see https://help.testim.io/docs/set-cookie
228
- */
229
- export async function setCookie(cookieData: CookieData): Promise<void> { throw new StubError('setCookie'); }
230
- /**
231
- * Gets a cookie by a specific name.
232
- * @see https://help.testim.io/docs/get-cookie
233
- */
234
- export async function getCookie(name: string): Promise<CookieData> { throw new StubError('getCookie'); }
235
- /**
236
- * Hovers over the given element on the screen, on the element center by default.
237
- * @see https://help.testim.io/docs/hover
238
- */
239
- export async function hover(selector: SelectParam, options: HoverOptions): Promise<void> { throw new StubError('hover'); }
240
- /**
241
- * This method checks that an element matching the given selector exists on the page
242
- * @see https://help.testim.io/docs/exists
243
- */
244
- export async function exists(selector: SelectParam): Promise<boolean> { throw new StubError('exists'); }
245
- /**
246
- * This method is used to check if a checkbox element is checked or not.
247
- * @see https://help.testim.io/docs/checkbox
248
- */
249
- export async function checkbox(selector: SelectParam): Promise<boolean> { throw new StubError('checkbox'); }
250
- /**
251
- * This method is used to check if a radio element is checked or not.
252
- * @see https://help.testim.io/docs/radio
253
- */
254
- export async function radio(selector: SelectParam): Promise<void> { throw new StubError('radio'); }
255
- /**
256
- * This method selects a given <option> element from an HTML <select> element.
257
- * @see https://help.testim.io/docs/select
258
- */
259
- export async function selectOption(selector: SelectParam): Promise<void> { throw new StubError('selectOption'); }
260
- /**
261
- * Send a given key to the browser (for example tab).
262
- * @see https://help.testim.io/docs/send-character
263
- */
264
- export async function sendCharacter(selector: SelectParam, keyCode: number): Promise<void> { throw new StubError('sendCharacter'); }
265
- /**
266
- * Drags and drops on the given element onto another element on the page using HTML5 drag and drop events.
267
- * @see https://help.testim.io/docs/drag-and-drop
268
- */
269
- export async function dragAndDrop(sourceSelector: SelectParam, targetSelector: SelectParam): Promise<void> { throw new StubError('dragAndDrop'); }
270
- /**
271
- * Dragged the given element alongside the given x/y path.
272
- * @see https://help.testim.io/docs/drag
273
- */
274
- export async function drag(selector: SelectParam, dragPath: Point[]): Promise<void> { throw new StubError('drag'); }
275
- /**
276
- * https://help.testim.io/docs/scroll-to-position
277
- * @see https://help.testim.io/docs/scroll-to-position
278
- */
279
- export async function scrollToPosition(x: number, y: number, options: ScrollOptions = {}): Promise<void> { throw new StubError('scrollToPosition'); }
280
- /**
281
- * This method submits the given form element.
282
- * @see https://help.testim.io/docs/submit
283
- */
284
- export async function submit(selector: SelectParam): Promise<void> { throw new StubError('submit'); }
285
- /**
286
- * This method polls the page every 100 (default ms) until a passed JavaScript value is true (well, truthy).
287
- * @see https://help.testim.io/docs/wait-for-code
288
- */
289
- export async function waitForCode(fn: Function, options? : WaitForCodeOptions): Promise<void> { throw new StubError('waitForCode'); }
290
- /**
291
- * Waits for an element to exist on the screen and be visible.
292
- * @see https://help.testim.io/docs/resize
293
- */
294
-
295
- export async function resize(options: ResizeOptions): Promise<void> { throw new StubError('resize'); }
296
- /**
297
- * Waits for an element to exist on the screen.
298
- * @see https://help.testim.io/docs/wait-for-element
299
- */
300
- export async function waitForElement(selector: SelectParam, options: WaitForElementOptions = { checkVisibility: true }): Promise<void> { throw new StubError('waitForElement'); }
301
- /**
302
- * Waits for an element to exist on the screen.
303
- * @see https://help.testim.io/docs/wait-for-element
304
- */
305
- export async function waitForNoElement(selector: SelectParam, options: WaitForElementOptions = { checkVisibility: true }): Promise<void> { throw new StubError('waitForNoElement'); }
306
- /**
307
- * Waits for an element to exist on the screen and its text equal to expected value.
308
- * @see https://help.testim.io/docs/wait-for-text
309
- */
310
- export async function waitForText(selector: SelectParam, expectedValue: string | RegExp, options: WaitForTextOptions = { checkVisibility: true }): Promise<void> { throw new StubError('waitForText'); }
311
-
312
- export const screenshot = {
313
- /**
314
- * Takes a screenshot of the whole screen
315
- */
316
- viewport: async function viewport(): Promise<string> { throw new StubError('screenshotViewport'); },
317
- /**
318
- * Takes a screenshot of the whole page by scrolling down and taking screenshots of the different parts and stitching them together
319
- */
320
- stitch: async function stitch(): Promise<string> { throw new StubError('screenshotStitch'); },
321
- /**
322
- * Takes a screenshot of a specific element
323
- */
324
- element: async function element(selector: SelectParam): Promise<string> { throw new StubError('screenshotElement'); },
325
- };
326
-
327
-
328
- /**
329
- * Defines a test to run.
330
- * @see https://help.testim.io/docs/getting-started
331
- */
332
- export function it(name: string | Function, fn?: Function): void { throw new StubError('it'); }
333
- /**
334
- * Defines a test to run.
335
- * @see https://help.testim.io/docs/getting-started
336
- */
337
- export function test(name: string | Function, fn?: Function): void { throw new StubError('test'); }
338
- /**
339
- * Defines a test suite to run.
340
- * @see https://help.testim.io/docs/getting-started
341
- */
342
- export function describe(name: string, fn: Function): void { throw new StubError('describe'); }
343
- /**
344
- * Defines a piece of code to run before all tests in this file.
345
- * @see https://help.testim.io/docs/getting-started
346
- */
347
- export function before(fn: Function): void { throw new StubError('before'); }
348
- /**
349
- * Defines a piece of code to run before each test in this file.
350
- * @see https://help.testim.io/docs/getting-started
351
- */
352
- export function beforeEach(fn: Function): void { throw new StubError('beforeEach'); }
353
- /**
354
- * Defines a piece of code to run after all tests in this file.
355
- * @see https://help.testim.io/docs/getting-started
356
- */
357
- export function after(fn: Function): void { throw new StubError('after'); }
358
- /**
359
- * Defines a piece of code to run after each test in this file.
360
- * @see https://help.testim.io/docs/getting-started
361
- */
362
- export function afterEach(fn: Function): void { throw new StubError('afterEach'); }
363
- /**
364
- * Skips the given test.
365
- * @see https://help.testim.io/docs/getting-started
366
- */
367
- export function skip(name: string | Function, fn?: Function): void { throw new StubError('skip'); }
368
- /**
369
- * Runs only the current test or test suite in this file.
370
- * @see https://help.testim.io/docs/getting-started
371
- */
372
- export function only(name: string | Function, fn?: Function): void { throw new StubError('only'); }
373
- /**
374
- * Skips the given suite.
375
- * @see https://help.testim.io/docs/getting-started
376
- */
377
- export function describeSkip(name: string, fn: Function): void { throw new StubError('describeSkip'); }
378
- /**
379
- * Runs only given suite.
380
- * @see https://help.testim.io/docs/getting-started
381
- */
382
- export function describeOnly(name: string, fn: Function): void { throw new StubError('describeOnly'); }
383
- it.skip = test.skip = skip;
384
- it.only = test.only = only;
385
- describe.skip = describeSkip;
386
- describe.only = describeOnly;
387
- /**
388
- * A SmartLocator is like a stable selector. It contains a ton of interesting metadata and it's one of the bits Testim's AI
389
- * runs reinforcement learning on. It selects each element in thousands of ways and runs a consensus algorithm on the results.
390
- * @see https://help.testim.io/docs/working-with-locators
391
- */
392
- export class Locator {
393
- public static fromSelector(selector: string): TDKStepLocator {
394
- throw new StubError('Locator.fromSelector');
395
- }
396
- public static set(locators: any) {}
397
- public static for(locatorId: string): TDKStepLocator {
398
- throw new StubError('Locator.for');
399
- }
400
- /**
401
- * Sets the locator confidence threshold
402
- * @param threshold the locator conidence score
403
- */
404
- setConfidenceThreshold(threshold: number) {
405
- throw new StubError('setConfidenceThreshold');
406
- }
407
- }
408
- /**
409
- * Finds a Smart Locator by name
410
- * @see https://help.testim.io/docs/working-with-locators
411
- */
412
- export function l(locatorId: string): TDKStepLocator {
413
- return Locator.for(locatorId);
414
- }
415
- /**
416
- * Create Locator from CSS selector
417
- * @see https://help.testim.io/docs/working-with-locators
418
- */
419
- export function fromSelector(selector: string): TDKStepLocator {
420
- return Locator.fromSelector(selector);
421
- }
422
-
423
- /**
424
- * Changes the tab or frame context
425
- * @see https://help.testim.io/docs/with-context
426
- */
427
- export function withContext(contextOptions: any): any { throw new StubError('withContext'); }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "testim",
3
- "version": "1.0.0",
4
- "lockfileVersion": 1,
5
- "requires": true,
6
- "dependencies": {
7
- "typescript": {
8
- "version": "4.5.5",
9
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
10
- "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
11
- "dev": true
12
- }
13
- }
14
- }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "testim",
3
- "version": "3.0.5",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "prepare": "npx tsc --types node --declaration index.ts"
8
- },
9
- "author": "Testim Developers",
10
- "license": "Proprietary",
11
- "devDependencies": {
12
- "typescript": "4.6.2"
13
- }
14
- }
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.getArgumentsFromContext = async function getArgumentsFromContext(
4
- step,
5
- context,
6
- locatorStrategy
7
- ) {
8
- const argsInCorrectOrder = fixArgsOrdering(step.parameterNames.map(p => p.displayName), context.incomingParams.as);
9
-
10
- return await Promise.all(argsInCorrectOrder.map(arg => {
11
- if (typeof arg === 'object' && arg.locatedElement) {
12
- return locatorStrategy(arg);
13
- }
14
- return arg;
15
- }));
16
- };
17
-
18
- function fixArgsOrdering(parametersInOrder, incomingParamsAs) {
19
- const finalList = [];
20
-
21
- for (const p of parametersInOrder) {
22
- // this is expected to always find index
23
- const index = incomingParamsAs.functionParameters.indexOf(p);
24
- finalList.push(incomingParamsAs.functionArguments[index]);
25
- }
26
-
27
- return finalList;
28
- }
@@ -1,41 +0,0 @@
1
- /* eslint-disable no-console */
2
- const startTime = Date.now();
3
- let last = 0;
4
- global.log = function time(message) {
5
- const time = Date.now() - startTime;
6
- console.log(time, time - last, message);
7
- last = time;
8
- };
9
- global.perf = function perf(fn) {
10
- const start = Date.now();
11
- try {
12
- fn();
13
- } finally {
14
- console.log(fn.name, 'took', Date.now() - start);
15
- }
16
- };
17
-
18
- global.measureRequireTimes = () => {
19
- 'use strict';
20
-
21
- const {
22
- performance,
23
- PerformanceObserver,
24
- } = require('perf_hooks');
25
- const mod = require('module');
26
-
27
- // Monkey patch the require function
28
- mod.Module.prototype.require = performance.timerify(mod.Module.prototype.require);
29
- // eslint-disable-next-line no-global-assign
30
- require = performance.timerify(require);
31
-
32
- // Activate the observer
33
- const obs = new PerformanceObserver((list) => {
34
- const entries = list.getEntries();
35
- entries.sort((a, b) => b.duration - a.duration).filter(x => x.duration > 1).forEach((entry) => {
36
- console.log(`require('${entry[0]}')`, entry.duration);
37
- });
38
- obs.disconnect();
39
- });
40
- obs.observe({ entryTypes: ['function'], buffered: true });
41
- };
@@ -1,57 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RunManager">
4
- <configuration default="true" type="js.build_tools.npm">
5
- <package-json value="$PROJECT_DIR$/package.json" />
6
- <command value="run" />
7
- <scripts>
8
- <script value="debug-examples" />
9
- </scripts>
10
- <node-interpreter value="project" />
11
- <envs />
12
- <method v="2" />
13
- </configuration>
14
- <configuration name="run examples" type="js.build_tools.npm" nameIsGenerated="true">
15
- <package-json value="$PROJECT_DIR$/package.json" />
16
- <command value="run" />
17
- <scripts>
18
- <script value="debug-examples" />
19
- </scripts>
20
- <node-interpreter value="project" />
21
- <envs />
22
- <method v="2" />
23
- </configuration>
24
- <configuration name="run tests" type="js.build_tools.npm" nameIsGenerated="true">
25
- <package-json value="$PROJECT_DIR$/package.json" />
26
- <command value="run" />
27
- <scripts>
28
- <script value="debug" />
29
- </scripts>
30
- <node-interpreter value="project" />
31
- <envs />
32
- <method v="2" />
33
- </configuration>
34
- <configuration name="run open file" type="js.build_tools.npm" nameIsGenerated="true">
35
- <package-json value="$PROJECT_DIR$/package.json" />
36
- <command value="run" />
37
- <scripts>
38
- <script value="debug-file" />
39
- </scripts>
40
- <arguments value="$FilePath$" />
41
- <node-interpreter value="project" />
42
- <envs />
43
- <method v="2" />
44
- </configuration>
45
- <configuration name="run headless" type="js.build_tools.npm" nameIsGenerated="true">
46
- <package-json value="$PROJECT_DIR$/package.json" />
47
- <command value="run" />
48
- <scripts>
49
- <script value="headless" />
50
- </scripts>
51
- <node-interpreter value="project" />
52
- <envs />
53
- <method v="2" />
54
- </configuration>
55
-
56
- </component>
57
- </project>
@@ -1,53 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "Run Examples",
11
- "runtimeExecutable": "npm",
12
- "runtimeArgs": [
13
- "run-script",
14
- "debug-examples"
15
- ],
16
- "port": 9229
17
- },
18
- {
19
- "type": "node",
20
- "request": "launch",
21
- "name": "Run Tests",
22
- "runtimeExecutable": "npm",
23
- "runtimeArgs": [
24
- "run-script",
25
- "debug"
26
- ],
27
- "port": 9229
28
- },
29
- {
30
- "type": "node",
31
- "request": "launch",
32
- "name": "Run Open File",
33
- "runtimeExecutable": "npm",
34
- "runtimeArgs": [
35
- "run-script",
36
- "debug-file",
37
- "${file}"
38
- ],
39
- "port": 9229
40
- },
41
- {
42
- "type": "node",
43
- "request": "launch",
44
- "name": "Run Headless",
45
- "runtimeExecutable": "npm",
46
- "runtimeArgs": [
47
- "run-script",
48
- "headless"
49
- ],
50
- "port": 9229
51
- },
52
- ]
53
- }