From 70506d75f2ccc0c60d4a1ac07250cea864a9dca7 Mon Sep 17 00:00:00 2001 From: Shahnawaz-LambdaTest Date: Wed, 14 Aug 2024 11:10:55 +0000 Subject: [PATCH 1/2] changes for session remarks --- package-lock.json | 4 ++-- package.json | 2 +- src/service.d.ts | 2 ++ src/service.js | 17 ++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 440adc7..a792a69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wdio-lambdatest-service", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wdio-lambdatest-service", - "version": "3.0.0", + "version": "3.0.1", "license": "MIT", "dependencies": { "@lambdatest/node-tunnel": "^4.0.1", diff --git a/package.json b/package.json index 87c1908..6f1e2a2 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wdio-lambdatest-service", - "version": "3.0.0", + "version": "3.0.1", "description": "A WebdriverIO service that manages tunnel and job metadata for LambdaTest.", "author": "LambdaTest ", "contributors": [ diff --git a/src/service.d.ts b/src/service.d.ts index 165d0e8..96a172c 100644 --- a/src/service.d.ts +++ b/src/service.d.ts @@ -19,6 +19,7 @@ export default class LambdaRestService implements Services.ServiceInstance { private _testCnt; private _testTitle?; private _currrentTestTitle; + private _ltErrorRemark?: boolean; constructor(options: LTOptions & SessionNameOptions, capabilities: Capabilities.RemoteCapability, config: Options.Testrunner); before(caps: Capabilities.RemoteCapability, specs: string[], browser: Browser<'async'> | MultiRemoteBrowser<'async'>): Promise; @@ -62,4 +63,5 @@ export default class LambdaRestService implements Services.ServiceInstance { _setSessionName(sessionName: string): Promise; _executeCommand(cmd: string): Promise; getSessionURL(sessionId: string, product: string): string; + _setSessionRemarks(err: string): Promise; } diff --git a/src/service.js b/src/service.js index 2149800..402c5c9 100755 --- a/src/service.js +++ b/src/service.js @@ -395,14 +395,21 @@ export default class LambdaRestService { } } - async _setSessionRemarks(err){ - let replacedString = err.replace(/"/g, "'"); - let errorCustom =`lambda-hook: {"action": "setTestStatus","arguments": {"status":"failed","remark":"${replacedString}"}}`; + async _setSessionRemarks(err) { try { + const hookObject = { + action: "setTestStatus", + arguments: { + status: "failed", + remark: err + } + }; + + const errorCustom = `lambda-hook: ${JSON.stringify(hookObject)}`; await this._browser.execute(errorCustom); } catch (error) { - console.log(error) - } + console.log("Error setting session remarks:", error); + } } async _setSessionName(sessionName) { From f21f4c79d4294c133d80d7dcf30759e0e12884c9 Mon Sep 17 00:00:00 2001 From: Shahnawaz-LambdaTest Date: Tue, 20 Aug 2024 06:57:39 +0000 Subject: [PATCH 2/2] added version --- package-lock.json | 6 +++--- package.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a792a69..9669a14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,9 +51,9 @@ "node": ">=10.0.0" }, "peerDependencies": { - "@wdio/cli": "^7.0.0 || ^8.0.0", - "@wdio/types": "^7.0.0 || ^8.0.0", - "webdriverio": "^7.0.0 || ^8.0.0" + "@wdio/cli": "^7.0.0 || ^8.0.0 || ^9.0.0", + "@wdio/types": "^7.0.0 || ^8.0.0 || ^9.0.0", + "webdriverio": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index 6f1e2a2..63c71a4 100755 --- a/package.json +++ b/package.json @@ -55,9 +55,9 @@ "axios": "^1.6.2" }, "peerDependencies": { - "@wdio/cli": "^7.0.0 || ^8.0.0", - "@wdio/types": "^7.0.0 || ^8.0.0", - "webdriverio": "^7.0.0 || ^8.0.0" + "@wdio/cli": "^7.0.0 || ^8.0.0 || ^9.0.0", + "@wdio/types": "^7.0.0 || ^8.0.0 || ^9.0.0", + "webdriverio": "^7.0.0 || ^8.0.0 || ^9.0.0" }, "publishConfig": { "access": "public"