Skip to content

Commit

Permalink
Merge pull request #84 from Shahnawaz-Sk/remark_error_fix
Browse files Browse the repository at this point in the history
changes for session remarks
  • Loading branch information
Shahnawaz-Sk authored Aug 20, 2024
2 parents dc8eff4 + f21f4c7 commit 7e11574
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"contributors": [
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions src/service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>;
Expand Down Expand Up @@ -62,4 +63,5 @@ export default class LambdaRestService implements Services.ServiceInstance {
_setSessionName(sessionName: string): Promise<void>;
_executeCommand(cmd: string): Promise<void>;
getSessionURL(sessionId: string, product: string): string;
_setSessionRemarks(err: string): Promise<void>;
}
17 changes: 12 additions & 5 deletions src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7e11574

Please sign in to comment.