diff --git a/package-lock.json b/package-lock.json index 440adc7..9669a14 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", @@ -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 87c1908..63c71a4 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": [ @@ -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" 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) {