@applitools/eyes-browser 1.0.1 → 1.0.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-browser@1.0.1...js/eyes-browser@1.0.2) (2023-12-18)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * @applitools/core bumped to 4.5.0
9
+ #### Features
10
+
11
+ * add set of env variables to skip/ignore some optional automations ([#2097](https://github.com/applitools/eyes.sdk.javascript1/issues/2097)) ([bd3b08c](https://github.com/applitools/eyes.sdk.javascript1/commit/bd3b08c3d2997eb98d545b308a1f15501192178e))
12
+
13
+
14
+ #### Bug Fixes
15
+
16
+ * fixed issue when page wasn't reloaded for one of the breakpoints if the initial viewport size matches it ([9038723](https://github.com/applitools/eyes.sdk.javascript1/commit/9038723ee68515f7d4fe20ed31ec501df9a381dc))
17
+
18
+
19
+
20
+ * @applitools/spec-driver-webdriver bumped to 1.0.53
21
+
22
+ * @applitools/spec-driver-selenium bumped to 1.5.67
23
+
24
+ * @applitools/spec-driver-puppeteer bumped to 1.3.3
25
+
26
+ * @applitools/driver bumped to 1.16.0
27
+ #### Features
28
+
29
+ * add set of env variables to skip/ignore some optional automations ([#2097](https://github.com/applitools/eyes.sdk.javascript1/issues/2097)) ([bd3b08c](https://github.com/applitools/eyes.sdk.javascript1/commit/bd3b08c3d2997eb98d545b308a1f15501192178e))
30
+ * @applitools/screenshoter bumped to 3.8.19
31
+
32
+ * @applitools/nml-client bumped to 1.6.1
33
+
34
+ * @applitools/ec-client bumped to 1.7.19
35
+
36
+ * @applitools/eyes bumped to 1.13.2
37
+
38
+
3
39
  ## [1.0.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-browser@1.0.0...js/eyes-browser@1.0.1) (2023-12-12)
4
40
 
5
41
 
package/dist/index.js CHANGED
@@ -31700,12 +31700,16 @@ var require_driver = __commonJS({
31700
31700
  }
31701
31701
  async refresh({ reset } = {}) {
31702
31702
  if (reset) {
31703
- this._driverInfo = void 0;
31704
- this._environment = void 0;
31705
- this._viewport = void 0;
31706
- this._features = void 0;
31707
- this._helper = void 0;
31708
- this._state = {};
31703
+ if (utils34.general.getEnvValue("AVOID_DRIVER_STATE_REST", "boolean")) {
31704
+ this._logger.log(`Skipping reset of the driver state`);
31705
+ } else {
31706
+ this._driverInfo = void 0;
31707
+ this._environment = void 0;
31708
+ this._viewport = void 0;
31709
+ this._features = void 0;
31710
+ this._helper = void 0;
31711
+ this._state = {};
31712
+ }
31709
31713
  }
31710
31714
  const spec = this._spec;
31711
31715
  let currentContext = this.currentContext.target;
@@ -32009,10 +32013,15 @@ var require_driver = __commonJS({
32009
32013
  async getHelper() {
32010
32014
  var _a, _b, _c;
32011
32015
  if (this._helper === void 0) {
32012
- const environment = await this.getEnvironment();
32013
- this._logger.log(`Extracting helper for ${environment.isIOS ? "ios" : "android"}`);
32014
- this._helper = environment.isIOS ? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this }) : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this });
32015
- this._logger.log(`Extracted helper of type ${(_a = this._helper) === null || _a === void 0 ? void 0 : _a.name}`);
32016
+ if (utils34.general.getEnvValue("IGNORE_HELPER_LIB", "boolean")) {
32017
+ this._logger.log(`Skipping helper lib extraction`);
32018
+ this._helper = null;
32019
+ } else {
32020
+ const environment = await this.getEnvironment();
32021
+ this._logger.log(`Extracting helper for ${environment.isIOS ? "ios" : "android"}`);
32022
+ this._helper = environment.isIOS ? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this }) : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this });
32023
+ this._logger.log(`Extracted helper of type ${(_a = this._helper) === null || _a === void 0 ? void 0 : _a.name}`);
32024
+ }
32016
32025
  }
32017
32026
  this._logger.log(`Returning helper for of type ${(_c = (_b = this._helper) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : null}`);
32018
32027
  return this._helper;
@@ -32309,25 +32318,29 @@ var require_driver = __commonJS({
32309
32318
  if (environment.isWeb)
32310
32319
  return (_a = this._viewport) === null || _a === void 0 ? void 0 : _a.orientation;
32311
32320
  if (environment.isAndroid) {
32312
- this._logger.log("Extracting device orientation using adb command on android");
32313
- const rotation = await this.execute("mobile:shell", {
32314
- command: "dumpsys window | grep 'mCurrentRotation' | cut -d = -f2"
32315
- }).then((rotation2) => {
32316
- var _a2;
32317
- return (_a2 = rotation2 === null || rotation2 === void 0 ? void 0 : rotation2.trim) === null || _a2 === void 0 ? void 0 : _a2.call(rotation2);
32318
- }).catch(() => null);
32319
- if (rotation) {
32320
- let orientation2 = void 0;
32321
- if (rotation === "ROTATION_0" || rotation === "0")
32322
- orientation2 = "portrait";
32323
- else if (rotation === "ROTATION_90" || rotation === "3")
32324
- orientation2 = "landscape-secondary";
32325
- else if (rotation === "ROTATION_180" || rotation === "2")
32326
- orientation2 = "portrait-secondary";
32327
- else if (rotation === "ROTATION_270" || rotation === "1")
32328
- orientation2 = "landscape";
32329
- this._logger.log("Extracted device orientation:", orientation2);
32330
- return orientation2;
32321
+ if (utils34.general.getEnvValue("AVOID_ADB_USAGE", "boolean")) {
32322
+ this._logger.log(`Skipping device orientation extraction using adb command on android`);
32323
+ } else {
32324
+ this._logger.log("Extracting device orientation using adb command on android");
32325
+ const rotation = await this.execute("mobile:shell", {
32326
+ command: "dumpsys window | grep 'mCurrentRotation' | cut -d = -f2"
32327
+ }).then((rotation2) => {
32328
+ var _a2;
32329
+ return (_a2 = rotation2 === null || rotation2 === void 0 ? void 0 : rotation2.trim) === null || _a2 === void 0 ? void 0 : _a2.call(rotation2);
32330
+ }).catch(() => null);
32331
+ if (rotation) {
32332
+ let orientation2 = void 0;
32333
+ if (rotation === "ROTATION_0" || rotation === "0")
32334
+ orientation2 = "portrait";
32335
+ else if (rotation === "ROTATION_90" || rotation === "3")
32336
+ orientation2 = "landscape-secondary";
32337
+ else if (rotation === "ROTATION_180" || rotation === "2")
32338
+ orientation2 = "portrait-secondary";
32339
+ else if (rotation === "ROTATION_270" || rotation === "1")
32340
+ orientation2 = "landscape";
32341
+ this._logger.log("Extracted device orientation:", orientation2);
32342
+ return orientation2;
32343
+ }
32331
32344
  }
32332
32345
  }
32333
32346
  this._logger.log("Extracting device orientation");
@@ -82505,9 +82518,9 @@ var require_take_dom_snapshots = __commonJS({
82505
82518
  logger.log(message);
82506
82519
  }
82507
82520
  }
82508
- if (settings.layoutBreakpoints.reload)
82509
- await driver.reloadPage();
82510
82521
  }
82522
+ if (settings.layoutBreakpoints.reload)
82523
+ await driver.reloadPage();
82511
82524
  if (settings.lazyLoad && (index === 0 || settings.layoutBreakpoints.reload)) {
82512
82525
  await (0, wait_for_lazy_load_1.waitForLazyLoad)({ context: currentContext, settings: settings.lazyLoad, logger });
82513
82526
  }
@@ -84278,7 +84291,7 @@ var require_package2 = __commonJS({
84278
84291
  "../core/package.json"(exports, module) {
84279
84292
  module.exports = {
84280
84293
  name: "@applitools/core",
84281
- version: "4.4.0",
84294
+ version: "4.5.0",
84282
84295
  homepage: "https://applitools.com",
84283
84296
  bugs: {
84284
84297
  url: "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -87887,7 +87900,7 @@ var require_logs = __commonJS({
87887
87900
  init_setImmediate();
87888
87901
  init_buffer();
87889
87902
  Object.defineProperty(exports, "__esModule", { value: true });
87890
- exports.structureLogs = exports.parseLogs = void 0;
87903
+ exports.analyzeLogs = exports.structureLogs = exports.stringifyLog = exports.parseLogs = void 0;
87891
87904
  function parseLogs(logs) {
87892
87905
  const regexp = /^(?<label>[^\s]+) (?:\((?<tags>[^\)]+)\) )?\| (?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)? (?:\[(?<level>[A-Z]+)\s*\])? (?<message>.+)$/;
87893
87906
  const lines = logs.split("\n");
@@ -87906,8 +87919,14 @@ var require_logs = __commonJS({
87906
87919
  }, []);
87907
87920
  }
87908
87921
  exports.parseLogs = parseLogs;
87922
+ function stringifyLog(log) {
87923
+ var _a;
87924
+ return `${log.label} (${(_a = log.tags) === null || _a === void 0 ? void 0 : _a.map((tags) => tags.join("/")).join(" & ")}) ${log.timestamp} [${log.level}] ${log.message}`;
87925
+ }
87926
+ exports.stringifyLog = stringifyLog;
87909
87927
  function structureLogs(logs) {
87910
87928
  const groups = {};
87929
+ groups.logs;
87911
87930
  logs.forEach((log) => {
87912
87931
  var _a;
87913
87932
  const tags = (_a = log.tags) !== null && _a !== void 0 ? _a : [[]];
@@ -87925,6 +87944,34 @@ var require_logs = __commonJS({
87925
87944
  return groups;
87926
87945
  }
87927
87946
  exports.structureLogs = structureLogs;
87947
+ function analyzeLogs({ logs, ...groups }) {
87948
+ var _a, _b;
87949
+ const analysis = {};
87950
+ analysis.logs = logs === null || logs === void 0 ? void 0 : logs.map(stringifyLog);
87951
+ const groupAnalyses = Object.fromEntries(Object.entries(groups).map(([name, group]) => [name, analyzeLogs(group)]));
87952
+ analysis.startedAt = Math.min(Date.parse((_a = logs === null || logs === void 0 ? void 0 : logs[0]) === null || _a === void 0 ? void 0 : _a.timestamp) || Infinity, ...Object.values(groupAnalyses).map((group) => group.startedAt));
87953
+ analysis.finishedAt = Math.max(Date.parse((_b = logs === null || logs === void 0 ? void 0 : logs[logs.length - 1]) === null || _b === void 0 ? void 0 : _b.timestamp) || 0, ...Object.values(groupAnalyses).map((group) => group.finishedAt));
87954
+ analysis.time = analysis.finishedAt - analysis.startedAt;
87955
+ analysis.conclusion = "";
87956
+ analysis.conclusion += `Time taken: ${formatTime(analysis.time)};`;
87957
+ if (Object.keys(groupAnalyses).length > 0) {
87958
+ analysis.conclusion += `Longest group: ${Object.keys(groupAnalyses).reduce((prev, cur) => groupAnalyses[cur].time > groupAnalyses[prev].time ? cur : prev)}`;
87959
+ }
87960
+ return { ...analysis, ...groupAnalyses };
87961
+ }
87962
+ exports.analyzeLogs = analyzeLogs;
87963
+ function formatTime(ms) {
87964
+ const h = Math.floor(ms / 36e5);
87965
+ if (h)
87966
+ ms -= h * 36e5;
87967
+ const m = Math.floor(ms / 6e4);
87968
+ if (m)
87969
+ ms -= m * 6e4;
87970
+ const s = Math.floor(ms / 1e3);
87971
+ if (s)
87972
+ ms -= s * 1e3;
87973
+ return [h && `${h}h`, m && `${m}m`, s && `${s}s`, ms && `${ms}ms`].filter(Boolean).join(" ");
87974
+ }
87928
87975
  }
87929
87976
  });
87930
87977
 
@@ -87993,7 +88040,7 @@ var require_package3 = __commonJS({
87993
88040
  "../eyes/package.json"(exports, module) {
87994
88041
  module.exports = {
87995
88042
  name: "@applitools/eyes",
87996
- version: "1.13.1",
88043
+ version: "1.13.2",
87997
88044
  keywords: [
87998
88045
  "applitools",
87999
88046
  "eyes",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-browser",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "keywords": [
5
5
  "applitools",
6
6
  "browser",
@@ -48,7 +48,7 @@
48
48
  "test": "run --top-level mocha './test/**/*.spec.ts'"
49
49
  },
50
50
  "dependencies": {
51
- "@applitools/eyes": "1.13.1"
51
+ "@applitools/eyes": "1.13.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^12.20.55",