@wdio/browserstack-service 8.1.2 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
- import type { Capabilities, Frameworks } from '@wdio/types';
2
- import type { Browser, MultiRemoteBrowser } from 'webdriverio';
1
+ import type { Frameworks } from '@wdio/types';
3
2
  import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
4
3
  import type { Pickle, ITestCaseHookParameter } from './cucumber-types.js';
5
4
  export default class InsightsHandler {
@@ -11,7 +10,7 @@ export default class InsightsHandler {
11
10
  private _commands;
12
11
  private _gitConfigPath?;
13
12
  private _requestQueueHandler;
14
- constructor(_browser: Browser<'async'> | MultiRemoteBrowser<'async'>, browserCaps?: Capabilities.Capabilities, isAppAutomate?: boolean, sessionId?: string, _framework?: string | undefined);
13
+ constructor(_browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, isAppAutomate?: boolean, _framework?: string | undefined);
15
14
  before(): Promise<void>;
16
15
  beforeHook(test: Frameworks.Test, context: any): Promise<void>;
17
16
  afterHook(test: Frameworks.Test, result: Frameworks.TestResult): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAOzE,MAAM,CAAC,OAAO,OAAO,eAAe;IASnB,OAAO,CAAC,QAAQ;IAAwI,OAAO,CAAC,UAAU,CAAC;IAPxL,OAAO,CAAC,MAAM,CAA+B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AE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;IAkBzD,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IA0BzF,aAAa,CACf,WAAW,SAA2C,EACtD,YAAY,SAA4C,GACzD,OAAO,CAAC,OAAO,CAAC;IASb,QAAQ;IAId;;OAEG;IACG,cAAc,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,sBAAsB;IAwDtI,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,YAAY;YAYN,gBAAgB;YAsEhB,2BAA2B;IAmFzC,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,aAAa;CAMxB"}
@@ -12,22 +12,23 @@ export default class InsightsHandler {
12
12
  _commands = {};
13
13
  _gitConfigPath;
14
14
  _requestQueueHandler = RequestQueueHandler.getInstance();
15
- constructor(_browser, browserCaps, isAppAutomate, sessionId, _framework) {
15
+ constructor(_browser, isAppAutomate, _framework) {
16
16
  this._browser = _browser;
17
17
  this._framework = _framework;
18
18
  this._requestQueueHandler.start();
19
+ const caps = this._browser.capabilities;
20
+ const sessionId = this._browser.sessionId;
19
21
  this._platformMeta = {
20
- browserName: browserCaps?.browserName,
21
- browserVersion: browserCaps?.browserVersion,
22
- platformName: browserCaps?.platformName,
23
- caps: browserCaps,
24
- sessionId: sessionId,
22
+ browserName: caps.browserName,
23
+ browserVersion: caps?.browserVersion,
24
+ platformName: caps?.platformName,
25
+ caps: caps,
26
+ sessionId,
25
27
  product: isAppAutomate ? 'app-automate' : 'automate'
26
28
  };
27
29
  }
28
30
  async before() {
29
31
  if (isBrowserstackSession(this._browser)) {
30
- // await this._browser.execute(`browserstack_executor: {"action": "annotate", "arguments": {"data": "ObservabilitySync:${Date.now()}","level": "debug"}}`)
31
32
  await this._browser.execute(`browserstack_executor: ${JSON.stringify({
32
33
  action: 'annotate',
33
34
  arguments: {
@@ -173,6 +174,9 @@ export default class InsightsHandler {
173
174
  return;
174
175
  }
175
176
  const identifier = this.getIdentifier(test);
177
+ if (!this._tests[identifier]) {
178
+ return;
179
+ }
176
180
  // log screenshot
177
181
  if (Boolean(process.env.BS_TESTOPS_ALLOW_SCREENSHOTS) && isScreenshotCommand(args) && args.result.value) {
178
182
  await uploadEventData([{
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AASzC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IAClD,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,OAAO,CAAC,CAAyC;IACzD,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,oBAAoB,CAAoC;IAEhE,aAAa,CAAE,WAAW,EAAE,WAAW;IASvC,YAAY,CAAE,UAAU,EAAE,UAAU;IAI9B,UAAU,CAAE,SAAS,EAAE,SAAS;CAgDzC"}
1
+ {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AASzC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IAClD,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,OAAO,CAAC,CAAyC;IACzD,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,oBAAoB,CAAoC;IAEhE,aAAa,CAAE,WAAW,EAAE,WAAW;IASvC,YAAY,CAAE,UAAU,EAAE,UAAU;IAI9B,UAAU,CAAE,SAAS,EAAE,SAAS;CAgDzC"}
@@ -1,5 +1,4 @@
1
1
  import type { Services, Capabilities, Options, Frameworks } from '@wdio/types';
2
- import type { Browser, MultiRemoteBrowser } from 'webdriverio';
3
2
  import type { BrowserstackConfig, MultiRemoteAction } from './types.js';
4
3
  import type { Pickle, Feature, ITestCaseHookParameter } from './cucumber-types.js';
5
4
  export default class BrowserstackService implements Services.ServiceInstance {
@@ -20,7 +19,7 @@ export default class BrowserstackService implements Services.ServiceInstance {
20
19
  constructor(options: BrowserstackConfig & Options.Testrunner, _caps: Capabilities.RemoteCapability, _config: Options.Testrunner);
21
20
  _updateCaps(fn: (caps: Capabilities.Capabilities | Capabilities.DesiredCapabilities) => void): void;
22
21
  beforeSession(config: Omit<Options.Testrunner, 'capabilities'>): void;
23
- before(caps: Capabilities.RemoteCapability, specs: string[], browser: Browser<'async'> | MultiRemoteBrowser<'async'>): Promise<void>;
22
+ before(caps: Capabilities.RemoteCapability, specs: string[], browser: WebdriverIO.Browser): Promise<void>;
24
23
  /**
25
24
  * Set the default job name at the suite level to make sure we account
26
25
  * for the cases where there is a long running `before` function for a
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,s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I,EAAE,UAAU,CAAC,IAAI;IAoBjC,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAS/E,KAAK,CAAE,MAAM,EAAE,MAAM;IAqB3B;;OAEG;IAEG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAMjD;;;OAGG;IACG,cAAc,CAAE,KAAK,EAAE,sBAAsB;IAO7C,aAAa,CAAE,KAAK,EAAE,sBAAsB;IAsB5C,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKzD,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IAIzF,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAgCzD,cAAc,IAAI,OAAO;IAOzB,UAAU,CAAE,WAAW,EAAE,GAAG;IAU5B,kBAAkB,CAAE,MAAM,EAAE,iBAAiB;IAqB7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG;IAarC,gBAAgB;YAuBR,eAAe;IA0B7B,OAAO,CAAC,cAAc;YAIR,eAAe;CAqBhC"}
package/build/service.js CHANGED
@@ -59,14 +59,14 @@ export default class BrowserstackService {
59
59
  }
60
60
  async before(caps, specs, browser) {
61
61
  // added to maintain backward compatibility with webdriverIO v5
62
- this._browser = browser ? browser : global.browser;
62
+ this._browser = browser ? browser : globalThis.browser;
63
63
  // Ensure capabilities are not null in case of multiremote
64
64
  if (this._isAppAutomate()) {
65
65
  this._sessionBaseUrl = 'https://api-cloud.browserstack.com/app-automate/sessions';
66
66
  }
67
67
  this._scenariosThatRan = [];
68
68
  if (this._observability && this._browser) {
69
- this._insightsHandler = new InsightsHandler(this._browser, this._browser.capabilities, this._isAppAutomate(), this._browser.sessionId, this._config.framework);
69
+ this._insightsHandler = new InsightsHandler(this._browser, this._isAppAutomate(), this._config.framework);
70
70
  await this._insightsHandler.before();
71
71
  /**
72
72
  * register command event
@@ -196,7 +196,7 @@ export default class BrowserstackService {
196
196
  log.info(`Update (reloaded) job with sessionId ${oldSessionId}, ${status}`);
197
197
  }
198
198
  else {
199
- const browserName = this._browser.instances.filter((browserName) => this._browser && this._browser[browserName].sessionId === newSessionId)[0];
199
+ const browserName = this._browser.instances.filter((browserName) => this._browser && this._browser.getInstance(browserName).sessionId === newSessionId)[0];
200
200
  log.info(`Update (reloaded) multiremote job for browser "${browserName}" and sessionId ${oldSessionId}, ${status}`);
201
201
  }
202
202
  if (setSessionStatus) {
@@ -226,19 +226,19 @@ export default class BrowserstackService {
226
226
  });
227
227
  }
228
228
  _multiRemoteAction(action) {
229
- const { _browser } = this;
230
- if (!_browser) {
229
+ if (!this._browser) {
231
230
  return Promise.resolve();
232
231
  }
233
- if (!_browser.isMultiremote) {
234
- return action(_browser.sessionId);
232
+ if (!this._browser.isMultiremote) {
233
+ return action(this._browser.sessionId);
235
234
  }
236
- return Promise.all(_browser.instances
235
+ const multiremotebrowser = this._browser;
236
+ return Promise.all(multiremotebrowser.instances
237
237
  .filter((browserName) => {
238
- const cap = getBrowserCapabilities(_browser, this._caps, browserName);
238
+ const cap = getBrowserCapabilities(multiremotebrowser, this._caps, browserName);
239
239
  return isBrowserstackCapability(cap);
240
240
  })
241
- .map((browserName) => (action(_browser[browserName].sessionId, browserName))));
241
+ .map((browserName) => (action(multiremotebrowser.getInstance(browserName).sessionId, browserName))));
242
242
  }
243
243
  _update(sessionId, requestBody) {
244
244
  if (!isBrowserstackSession(this._browser)) {
@@ -303,7 +303,7 @@ export default class BrowserstackService {
303
303
  if (this._browser.isMultiremote) {
304
304
  const multiRemoteBrowser = this._browser;
305
305
  return Promise.all(Object.keys(this._caps).map(async (browserName) => {
306
- const browser = multiRemoteBrowser[browserName];
306
+ const browser = multiRemoteBrowser.getInstance(browserName);
307
307
  return (await browser.execute(script));
308
308
  }));
309
309
  }
package/build/util.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { Browser, MultiRemoteBrowser } from 'webdriverio';
2
1
  import type { Capabilities, Frameworks, Options } from '@wdio/types';
3
2
  import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
4
3
  import type { UserConfig, UploadType, BrowserstackConfig } from './types.js';
@@ -14,7 +13,7 @@ export declare function getBrowserDescription(cap: Capabilities.DesiredCapabilit
14
13
  * @param caps browser capbilities object. In case of multiremote, the object itself should have a property named 'capabilities'
15
14
  * @param browserName browser name in case of multiremote
16
15
  */
17
- export declare function getBrowserCapabilities(browser: Browser<'async'> | MultiRemoteBrowser<'async'>, caps?: Capabilities.RemoteCapability, browserName?: string): Capabilities.Capabilities;
16
+ export declare function getBrowserCapabilities(browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, caps?: Capabilities.RemoteCapability, browserName?: string): Capabilities.Capabilities;
18
17
  /**
19
18
  * check for browserstack W3C capabilities. Does not support legacy capabilities
20
19
  * @param cap browser capabilities
@@ -65,8 +64,8 @@ export declare function getGitMetaData(): Promise<{
65
64
  } | undefined>;
66
65
  export declare function getUniqueIdentifier(test: Frameworks.Test): string;
67
66
  export declare function getUniqueIdentifierForCucumber(world: ITestCaseHookParameter): string;
68
- export declare function getCloudProvider(browser: Browser<'async'> | MultiRemoteBrowser<'async'>): string;
69
- export declare function isBrowserstackSession(browser?: Browser<'async'> | MultiRemoteBrowser<'async'>): boolean | undefined;
67
+ export declare function getCloudProvider(browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): string;
68
+ export declare function isBrowserstackSession(browser?: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): boolean | undefined;
70
69
  export declare function getScenarioExamples(world: ITestCaseHookParameter): string[] | undefined;
71
70
  export declare function removeAnsiColors(message: string): string;
72
71
  export declare function getLogTag(eventType: string): string;
@@ -1 +1 @@
1
- {"version":3,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,EAAE,IAAI,EAAE,UAAU,EAAE,iBAmB3F;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,sBAQhH;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,sBAQ/G;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC,EAAE,MAAM,sBAQnH;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,MAAM,UAQ/G;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAW7H;AAED,eAAO,MAAM,KAAK,mCAAkE,CAAA"}
package/build/util.js CHANGED
@@ -49,7 +49,7 @@ export function getBrowserCapabilities(browser, caps, browserName) {
49
49
  return { ...browser.capabilities, ...caps };
50
50
  }
51
51
  const multiCaps = caps;
52
- const globalCap = browserName && browser[browserName] ? browser[browserName].capabilities : {};
52
+ const globalCap = browserName && browser.getInstance(browserName) ? browser.getInstance(browserName).capabilities : {};
53
53
  const cap = browserName && multiCaps[browserName] ? multiCaps[browserName].capabilities : {};
54
54
  return { ...globalCap, ...cap };
55
55
  }
@@ -95,7 +95,7 @@ export async function launchTestSession(options, config, bsConfig) {
95
95
  failed_tests_rerun: process.env.BROWSERSTACK_RERUN || false,
96
96
  version_control: await getGitMetaData(),
97
97
  observability_version: {
98
- frameworkName: config.framework,
98
+ frameworkName: 'WebdriverIO-' + config.framework,
99
99
  sdkVersion: bsConfig.bstackServiceVersion
100
100
  }
101
101
  };
@@ -120,11 +120,25 @@ export async function launchTestSession(options, config, bsConfig) {
120
120
  }
121
121
  }
122
122
  catch (error) {
123
- if (error instanceof HTTPError && error.response && error.response.statusCode === 401) {
124
- log.debug('Data upload to BrowserStack Test Observability failed either due to incorrect credentials or an unsupported SDK version or because you do not have access to the product.');
123
+ if (error instanceof HTTPError && error.response) {
124
+ const errorMessageJson = error.response.body ? JSON.parse(error.response.body.toString()) : null;
125
+ const errorMessage = errorMessageJson ? errorMessageJson.message : null, errorType = errorMessageJson ? errorMessageJson.errorType : null;
126
+ switch (errorType) {
127
+ case 'ERROR_INVALID_CREDENTIALS':
128
+ log.error(errorMessage);
129
+ break;
130
+ case 'ERROR_ACCESS_DENIED':
131
+ log.info(errorMessage);
132
+ break;
133
+ case 'ERROR_SDK_DEPRECATED':
134
+ log.error(errorMessage);
135
+ break;
136
+ default:
137
+ log.error(errorMessage);
138
+ }
125
139
  }
126
140
  else {
127
- log.debug(`[Start_Build] Failed. Error: ${error}`);
141
+ log.error(`Data upload to BrowserStack Test Observability failed due to ${error}`);
128
142
  }
129
143
  }
130
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browserstack-service",
3
- "version": "8.1.2",
3
+ "version": "8.2.0",
4
4
  "description": "WebdriverIO service for better Browserstack integration",
5
5
  "author": "Adam Bjerstedt <abjerstedt@gmail.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
@@ -37,7 +37,7 @@
37
37
  "gitconfiglocal": "^2.1.0",
38
38
  "got": "^12.1.0",
39
39
  "uuid": "^8.3.2",
40
- "webdriverio": "8.1.2"
40
+ "webdriverio": "8.2.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@wdio/cli": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "14625257acfd6081b4c9914b214110c0c7bf7218"
51
+ "gitHead": "3620e90e47b6d3e62832f5de24f43cee6b31e972"
52
52
  }