@percy/webdriver-utils 1.27.4 → 1.27.5-beta.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.
@@ -60,12 +60,26 @@ export default class AutomateProvider extends GenericProvider {
60
60
  percyBuildUrl: this.buildInfo.url,
61
61
  state: 'begin'
62
62
  });
63
+ // Selenium Hub, set status error Code to 13 if an error is thrown
64
+ // Handling error with Selenium dialect is != W3C
65
+ if ((result === null || result === void 0 ? void 0 : result.status) === 13) throw new Error((result === null || result === void 0 ? void 0 : result.value) || 'Got invalid error response');
63
66
  this._markedPercy = result.success;
64
67
  return result;
65
68
  } catch (e) {
69
+ var _e$response, _JSON$parse, _e$response2;
66
70
  log.debug(`[${name}] : Could not mark Automate session as percy`);
67
71
  log.error(`[${name}] : error: ${e.toString()}`);
68
- return null;
72
+ /**
73
+ * - Handling Error when dialect is W3C
74
+ * ERROR response format from SeleniumHUB `{
75
+ * sessionId: ...,
76
+ * status: 13,
77
+ * value: { error: '', message: ''}
78
+ * }
79
+ */
80
+ const errResponse = (e === null || e === void 0 ? void 0 : (_e$response = e.response) === null || _e$response === void 0 ? void 0 : _e$response.body) && ((_JSON$parse = JSON.parse(e === null || e === void 0 ? void 0 : (_e$response2 = e.response) === null || _e$response2 === void 0 ? void 0 : _e$response2.body)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.value) || {};
81
+ const errMessage = (errResponse === null || errResponse === void 0 ? void 0 : errResponse.message) || (errResponse === null || errResponse === void 0 ? void 0 : errResponse.error) || (e === null || e === void 0 ? void 0 : e.message) || (e === null || e === void 0 ? void 0 : e.error) || (e === null || e === void 0 ? void 0 : e.value) || e.toString();
82
+ throw new Error(errMessage);
69
83
  }
70
84
  });
71
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/webdriver-utils",
3
- "version": "1.27.4",
3
+ "version": "1.27.5-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,8 +29,8 @@
29
29
  "test:coverage": "yarn test --coverage"
30
30
  },
31
31
  "dependencies": {
32
- "@percy/config": "1.27.4",
33
- "@percy/sdk-utils": "1.27.4"
32
+ "@percy/config": "1.27.5-beta.0",
33
+ "@percy/sdk-utils": "1.27.5-beta.0"
34
34
  },
35
- "gitHead": "bb901bc6aabf20e27528b6cdfab22c9d8721a2b2"
35
+ "gitHead": "5fed59aa21112e7854a414306504ce7243df7365"
36
36
  }