webdriverio / webdriverio/webdriverio

[🐛 Bug]: BrowserStack build identifier is not set when BROWSERSTACK_BUILD_NAME environment variable is set

Open
#12,674 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug 🐛 help wanted Needs Investigation
Dominant language
TypeScript
Stars
9.8k
Forks
2.7k
Avg merge
2d 13h
Merged PRs (30d)
69

Description

Have you read the Contributing Guidelines on issues?
WebdriverIO Version

8.35.1

Node.js Version

v20.9.0

Mode

Standalone Mode

Which capabilities are you using?
[
  {
    browserName: 'Chrome',
    'bstack:options': {
      projectName: 'Pinta',
      buildName: 'LOCAL',
      consoleLogs: 'verbose',
      networkLogs: true,
      local: true,
      debug: true,
      buildTag: 'desktop',
      browserVersion: '120.0',
      os: 'Windows',
      osVersion: '11',
      wdioService: '8.35.1',
      buildIdentifier: '${BUILD_NUMBER}'
    }
  },
  {
    browserName: 'Safari',
    'bstack:options': {
      projectName: 'Pinta',
      buildName: 'LOCAL',
      consoleLogs: 'verbose',
      networkLogs: true,
      local: true,
      debug: true,
      buildTag: 'desktop',
      browserVersion: '15.6',
      os: 'OS X',
      osVersion: 'Monterey',
      wdioService: '8.35.1',
      buildIdentifier: '${BUILD_NUMBER}'
    }
  }
]
What happened?

I'm using WebdriverIO with BrowserStack service and I have noticed that when I set build name through BROWSERSTACK_BUILD_NAME environment variable, then setting build identifier has no effect. Digging a little into the code I have found this condition in launcher.ts which effectively terminates processing of build identifier when BROWSERSTACK_BUILD_NAME is set.

https://github.com/webdriverio/webdriverio/blob/fa5f02f24b64372d2791814bde1306788319e30e/packages/wdio-browserstack-service/src/launcher.ts#L701-L705

What is your expected behavior?

No response

How to reproduce the bug.

Just set up BROWSERSTACK_BUILD_NAME variable and then run tests using browserstack-service. In BrowserStack dashboard you will see that following build are not numbered. All test sessions are appended to the one, already existing build.

Relevant log output
There is no relevant output for this bug in logs.
Code of Conduct
  • I agree to follow this project's Code of Conduct
Is there an existing issue for this?
  • I have searched the existing issues

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect packages/wdio-browserstack-service/src/launcher.ts around lines 701-705, focusing on how BROWSERSTACK_BUILD_NAME affects buildIdentifier handling. Reproduce with the reported BrowserStack configuration and environment variable. Done means buildIdentifier is honored when BROWSERSTACK_BUILD_NAME is set, with test sessions appearing in separately numbered builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cloud, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.