Zarkonnen / se-interpreter

Interpreter for Selenium Builder JSON scripts based on node.js and wd.
34 stars 31 forks source link

Getting the SauceOnDemandSessionID #49

Open bernaxa opened 8 years ago

bernaxa commented 8 years ago

Hello,

I'm using the se-interpreter with Jenkins, but I can't get any report published as I'm not able to get the SessionID of the Sauce automated test.

How could I get the SessionID so I can print it to the stdout of jenkins with something like this:

echo SauceOnDemandSessionID=SessionID_from_se-interpreter echo job-name=myjobname

Thanks!

ghost commented 7 years ago

Just add this to your sauce_listener.js

Listener.prototype.endStep = function(testRun, step, info) {
  if (this.sessions.indexOf(this.testRun.listener.sessionID) == -1) {
    console.log("SauceOnDemandSessionID=" + this.testRun.listener.sessionID + " job-name=" + this.testRun.name + "\n\r");
    this.sessions.push(this.testRun.listener.sessionID);
  }
  if (this.originalListener) { this.originalListener.endStep(testRun, step, info); }
};