Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
kwiniarski opened this issue Apr 12, 2024 · 5 comments

Comments

@kwiniarski
Copy link

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.

if ((!this._buildName || process.env.BROWSERSTACK_BUILD_NAME) && this._buildIdentifier) {
this._updateCaps(capabilities, 'buildIdentifier')
BStackLogger.warn('Skipping buildIdentifier as buildName is not passed.')
return
}

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
@kwiniarski kwiniarski added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Apr 12, 2024
@christian-bromann
Copy link
Member

buildIdentifier: '${BUILD_NUMBER}'

It seems like you are also setting the buildIdentifier in your capabilities here. Can you remove this entry and try again? Also can you verify that your environment variables were set correctly by printing them out via e.g. console.log(process.env. BROWSERSTACK_BUILD_NAME).

@christian-bromann christian-bromann added Information Missing and removed Needs Triaging ⏳ No one has looked into the issue yet labels Apr 12, 2024
@kwiniarski
Copy link
Author

I think I have tried all combinations already. But checked them again. When environment variables are set then adding buildIdentifier to the service options or capabilities options or both at the same time has no effect. My build name in BrowserStack has no number.

But when I remove environment variables and hardcode build name in configuration, then setting buildIdentifier in service options works as expected. All my builds are numbered in BrowserStack.

@christian-bromann
Copy link
Member

@kwiniarski can you provide a minimal reproducible example?

@kwiniarski
Copy link
Author

I can't post the repo where I have this, but I will try to extract the minimal code. I think it will be helpful because I also have another potential bug with BrowserStack there.

@kwiniarski
Copy link
Author

I have created repository with simple example that reproduces described issue: https://github.com/kwiniarski/wdio-browserstack-stencil.
Steps to reproduce are in the README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants