scottgonzalez/node-browserstack

API unable to update job name

Closed this issue · 2 comments

Hello, I have come across a case where the package wont update the job name using the automate client.
I am automating using selenium and cucumber JS with typescript.
I am passing name and status to be updated to my respective browserstack job, however, only status gets updated.
here is the code of where i am trying to achieve it:

 async updateTestStatus(sessionId: string, params: any) {
    this.sessionClient = await browserstack.createAutomateClient(this.browserStackCredentials);

    await this.sessionClient.updateSession(sessionId, params, (error, session) => {
      if (error) {
        return Error;
      } 
    });
  }

and I am calling it like this in my After hook:

After(async (hookForResult: HookScenarioResult) => {
    if (hookForResult.failureException) {
      await browserStackApi.updateTestStatus(sessionId,
       {name: hookForResult.scenario.name, status: hookForResult.status});
      driver.takeScreenshot().then(data => {
        attach(new Buffer(data, 'base64'), 'image/png');
      }).catch(error => {
        // tslint:disable-next-line:no-console
        logger.printLog(error);
        throw error;
      });
    } else {
     await browserStackApi.updateTestStatus(sessionId,
      {name: hookForResult.scenario.name, status: hookForResult.status});
    }
  });

Please suggest.

The documentation does not say that name is supported.

All good. I thought passing an Object like

{
status: <pass/fail>,
name: scenario.name
}

might allow it.
Opened an issue on browserstack api, saucelabs does it immaculately, hoping browserstack would listen to their users too
browserstack/api#26
thanks anyway