@skyramp/skyramp 1.2.37 → 1.2.39
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.
- package/package.json +1 -1
- package/src/classes/SkyrampClient.js +4 -1
- package/src/classes/SmartPlaywright.js +3 -0
- package/src/index.js +2 -1
- package/src/utils.d.ts +14 -0
- package/src/utils.js +27 -0
package/package.json
CHANGED
|
@@ -33,8 +33,8 @@ const CONTAINER_PORT = 35142;
|
|
|
33
33
|
const loginWrapper = lib.func('loginWrapper', 'string', []);
|
|
34
34
|
const logoutWrapper = lib.func('logoutWrapper', 'string', []);
|
|
35
35
|
|
|
36
|
+
const { createTestDescriptionFromScenario, getYamlBytes, readDataFromFile, checkForUpdate, SKYRAMP_YAML_VERSION } = require('../utils');
|
|
36
37
|
// k8s related
|
|
37
|
-
const { createTestDescriptionFromScenario, getYamlBytes, readDataFromFile, SKYRAMP_YAML_VERSION } = require('../utils');
|
|
38
38
|
const applyLocalWrapper = lib.func('applyLocalWrapper', 'string', []);
|
|
39
39
|
const addKubeconfigWrapper = lib.func('addKubeconfigWrapper', 'string', ['string', 'string', 'string']);
|
|
40
40
|
const deleteSkyrampWorkerWrapper = lib.func('deleteSkyrampWorkerWrapper', 'string', ['string', 'string', 'string', 'string'])
|
|
@@ -101,6 +101,9 @@ class SkyrampClient {
|
|
|
101
101
|
constructor(kubeconfigPathOrOptions, clusterName, context, userToken, directory = process.cwd()) {
|
|
102
102
|
this.local_image = false;
|
|
103
103
|
this.timestamp = Date.now();
|
|
104
|
+
|
|
105
|
+
checkForUpdate("npm")
|
|
106
|
+
|
|
104
107
|
if (typeof kubeconfigPathOrOptions === 'object') {
|
|
105
108
|
const options = kubeconfigPathOrOptions;
|
|
106
109
|
this.workerNamespaces = [];
|
|
@@ -9,6 +9,7 @@ const responseType = koffi.struct({
|
|
|
9
9
|
error: 'char*',
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
+
const { checkForUpdate } = require('../utils');
|
|
12
13
|
const improvePlaywrightSelectorWrapper = lib.func('improvePlywrightSelectorWrapper', responseType, ['string']);
|
|
13
14
|
const hasJavascriptWrapper = lib.func('hasJavascript', 'bool', ['string']);
|
|
14
15
|
|
|
@@ -658,6 +659,8 @@ class SkyrampPlaywrightLocator {
|
|
|
658
659
|
|
|
659
660
|
class SkyrampPlaywrightPage {
|
|
660
661
|
constructor(page, testInfo) {
|
|
662
|
+
checkForUpdate("npm")
|
|
663
|
+
|
|
661
664
|
this._page = page;
|
|
662
665
|
this._testInfo = testInfo; // Store testInfo for screenshot auto-baseline
|
|
663
666
|
return new Proxy(this, {
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const { AsyncScenario, AsyncRequest } = require('./classes/AsyncScenario');
|
|
|
17
17
|
const { LoadTestConfig } = require('./classes/LoadTestConfig');
|
|
18
18
|
const AsyncTestStatus = require('./classes/AsyncTestStatus');
|
|
19
19
|
const MockV2 = require('./classes/MockV2');
|
|
20
|
-
const { getValue, checkSchema, iterate } = require('./utils');
|
|
20
|
+
const { getValue, checkSchema, iterate, pushToolEvent } = require('./utils');
|
|
21
21
|
const { checkStatusCode } = require('./function');
|
|
22
22
|
const { newSkyrampPlaywrightPage, expect } = require('./classes/SmartPlaywright');
|
|
23
23
|
|
|
@@ -46,6 +46,7 @@ module.exports = {
|
|
|
46
46
|
checkStatusCode,
|
|
47
47
|
checkSchema,
|
|
48
48
|
iterate,
|
|
49
|
+
pushToolEvent,
|
|
49
50
|
newSkyrampPlaywrightPage,
|
|
50
51
|
expect,
|
|
51
52
|
}
|
package/src/utils.d.ts
CHANGED
|
@@ -62,6 +62,20 @@ export function checkSchema(jsonInput: object, schema: object): boolean;
|
|
|
62
62
|
*/
|
|
63
63
|
export function iterate(jsonInput: object): object;
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Send telemetry of tool event
|
|
67
|
+
* @param {string} entryPoint - entrypoint of event, either MCP or vscode
|
|
68
|
+
* @param {string} toolName - name of the tool
|
|
69
|
+
* @param {string} error - error message if it failed
|
|
70
|
+
* @param {Object} params - any parameters associated with the tool call. Disctionary
|
|
71
|
+
*/
|
|
72
|
+
export function pushToolEvent(entryPoint: string, toolName: string, err: string, params: object): void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* check for update
|
|
76
|
+
*/
|
|
77
|
+
export function checkForUpdate(component: string): void;
|
|
78
|
+
|
|
65
79
|
/**
|
|
66
80
|
* The Skyramp YAML version constant.
|
|
67
81
|
*/
|
package/src/utils.js
CHANGED
|
@@ -13,6 +13,8 @@ const responseType = koffi.struct({
|
|
|
13
13
|
const getJSONValueWrapper = lib.func('getJSONValueWrapper', responseType, ['string', 'string']);
|
|
14
14
|
const checkSchemaWrapper = lib.func('checkSchemaWrapper', responseType, ['string', 'string']);
|
|
15
15
|
const iterateWrapper = lib.func('generateJsonTreePathsFromBlob', 'string', ['string']);
|
|
16
|
+
const pushToolEventWrapper = lib.func('pushToolEvent', 'void', ['string', 'string', 'string', 'string']);
|
|
17
|
+
const checkForUpdateWrapper = lib.func('checkForUpdateWrapper', 'void', ['string']);
|
|
16
18
|
|
|
17
19
|
function isJSONString(value) {
|
|
18
20
|
if (typeof value !== "string") {
|
|
@@ -196,6 +198,29 @@ function iterate(fuzz_body) {
|
|
|
196
198
|
return parsed
|
|
197
199
|
}
|
|
198
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Send telemetry of tool event
|
|
203
|
+
*
|
|
204
|
+
* @param {string} entryPoint - entrypoint of event, either MCP or vscode
|
|
205
|
+
* @param {string} toolName - name of the tool
|
|
206
|
+
* @param {string} error - error message if it failed
|
|
207
|
+
* @param {Object} params - any parameters associated with the tool call. Disctionary
|
|
208
|
+
*/
|
|
209
|
+
function pushToolEvent(entryPoint, toolName, err, params) {
|
|
210
|
+
const paramsStr = JSON.stringify(params);
|
|
211
|
+
|
|
212
|
+
pushToolEventWrapper(entryPoint, toolName, err, paramsStr);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* check if new library is available
|
|
217
|
+
*
|
|
218
|
+
* @param {string} component - NAme of component
|
|
219
|
+
*/
|
|
220
|
+
function checkForUpdate(component) {
|
|
221
|
+
checkForUpdateWrapper(component)
|
|
222
|
+
}
|
|
223
|
+
|
|
199
224
|
module.exports = {
|
|
200
225
|
createTestDescriptionFromScenario,
|
|
201
226
|
getYamlBytes,
|
|
@@ -203,5 +228,7 @@ module.exports = {
|
|
|
203
228
|
getValue,
|
|
204
229
|
checkSchema,
|
|
205
230
|
iterate,
|
|
231
|
+
pushToolEvent,
|
|
232
|
+
checkForUpdate,
|
|
206
233
|
SKYRAMP_YAML_VERSION
|
|
207
234
|
}
|