browsertime 24.7.0 → 24.8.1

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,19 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 24.8.1 - 2025-06-01
4
+ ### Fixed
5
+ * [Visual Elements] Fix split for selector to include full value with ':'` - thank you [Pavel Bairov](https://github.com/Amerousful) for PR [#2298](https://github.com/sitespeedio/browsertime/pull/2298).
6
+
7
+ ## 24.8.0 - 2025-05-30
8
+ ### Added
9
+ * Updated to Chrome/Chromedriver 137 and Firefox 139 in the Docker container [#2284](https://github.com/sitespeedio/browsertime/pull/2284).
10
+ * Updated to Edge/Edgedriver 137 in the Docker container [#2289](https://github.com/sitespeedio/browsertime/pull/2289).
11
+ * New command: `wait.byXpathAndVisible(...)` - thank you [Pavel Bairov](https://github.com/Amerousful) for PR [#2286](https://github.com/sitespeedio/browsertime/pull/2286).
12
+ * New command: `wait.bySelectorAndVisible(...)` PR [#2288](https://github.com/sitespeedio/browsertime/pull/2288).
13
+
14
+ ### Fixed
15
+ * Updated dependencies: selenium, usb-power-profiling, execa and dev dependencies [#2290](https://github.com/sitespeedio/browsertime/pull/2290), [#2291](https://github.com/sitespeedio/browsertime/pull/2291), [#2294](https://github.com/sitespeedio/browsertime/pull/2294) and [#2295](https://github.com/sitespeedio/browsertime/pull/2295).
16
+
3
17
  ## 24.7.0 - 2025-05-13
4
18
  ### Added
5
19
  * Added Edge and Edgedriver 136 [#2282](https://github.com/sitespeedio/browsertime/pull/2282).
@@ -91,7 +91,7 @@
91
91
  for (const nameAndSelector of customArray) {
92
92
  const parts = nameAndSelector.split(':');
93
93
  const type = parts[0];
94
- const selector = parts[1];
94
+ const selector = nameAndSelector.slice(nameAndSelector.indexOf(':') + 1);
95
95
  const element = document.body.querySelector(selector);
96
96
  try {
97
97
  if (isElementPartlyInViewportAndVisible(element)) {
@@ -100,6 +100,35 @@ export class Wait {
100
100
  }
101
101
  }
102
102
 
103
+ /**
104
+ * Waits for an element located by XPath to appear and visible within a maximum time.
105
+ *
106
+ * @async
107
+ * @param {string} xpath - The XPath of the element to wait for.
108
+ * @param {number} maxTime - Maximum time to wait in milliseconds.
109
+ * @returns {Promise<void>} A promise that resolves when the element is found or the time times out.
110
+ * @throws {Error} Throws an error if the element is not found within the specified time.
111
+ */
112
+ async byXpathAndVisible(xpath, maxTime = 6000) {
113
+ const driver = this.browser.getDriver();
114
+ await this.byXpath(xpath, maxTime);
115
+ try {
116
+ driver.findElement;
117
+ await driver.wait(
118
+ webdriver.until.elementIsVisible(
119
+ driver.findElement(webdriver.By.xpath(xpath))
120
+ ),
121
+ maxTime
122
+ );
123
+ } catch (error) {
124
+ log.error('Element by xpath %s was not visible in %s ms', xpath, maxTime);
125
+ log.verbose(error);
126
+ throw new Error(
127
+ `Element by xpath ${xpath} was not located in ${maxTime} ms`
128
+ );
129
+ }
130
+ }
131
+
103
132
  /**
104
133
  * Waits for an element located by a CSS selector to appear within a maximum time.
105
134
  *
@@ -131,6 +160,38 @@ export class Wait {
131
160
  }
132
161
  }
133
162
 
163
+ /**
164
+ * Waits for an element located by a CSS selector to be visible within a maximum time.
165
+ *
166
+ * @async
167
+ * @param {string} selector - The CSS selector of the element to wait for.
168
+ * @param {number} maxTime - Maximum time to wait in milliseconds.
169
+ * @returns {Promise<void>} A promise that resolves when the element is found or the time times out.
170
+ * @throws {Error} Throws an error if the element is not found within the specified time.
171
+ */
172
+ async bySelectorAndVisible(selector, maxTime = 6000) {
173
+ const driver = this.browser.getDriver();
174
+
175
+ try {
176
+ await driver.wait(
177
+ webdriver.until.elementIsVisible(
178
+ driver.findElement(webdriver.By.css(selector))
179
+ ),
180
+ maxTime
181
+ );
182
+ } catch (error) {
183
+ log.error(
184
+ 'Element by selector %s was not visible in %s ms',
185
+ selector,
186
+ maxTime
187
+ );
188
+ log.verbose(error);
189
+ throw new Error(
190
+ `Element by selector ${selector} was not visible in ${maxTime} ms`
191
+ );
192
+ }
193
+ }
194
+
134
195
  /**
135
196
  * Waits for a specified amount of time.
136
197
  *
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "24.7.0",
4
+ "version": "24.8.1",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "types": "./types/scripting.d.ts",
8
8
  "dependencies": {
9
9
  "@devicefarmer/adbkit": "3.3.8",
10
- "@sitespeed.io/chromedriver": "136.0.7103-92",
11
- "@sitespeed.io/edgedriver": "136.0.3240-64",
10
+ "@sitespeed.io/chromedriver": "137.0.7151-55",
11
+ "@sitespeed.io/edgedriver": "137.0.3296-52",
12
12
  "@sitespeed.io/geckodriver": "0.36.0",
13
13
  "@sitespeed.io/log": "0.2.6",
14
14
  "@sitespeed.io/throttle": "5.0.1",
15
15
  "@sitespeed.io/tracium": "0.3.3",
16
16
  "chrome-har": "1.0.1",
17
17
  "chrome-remote-interface": "0.33.3",
18
- "execa": "9.5.2",
18
+ "execa": "9.6.0",
19
19
  "fast-stats": "0.0.7",
20
20
  "ff-test-bidi-har-export": "0.0.17",
21
21
  "lodash.merge": "4.6.2",
22
- "selenium-webdriver": "4.32.0",
22
+ "selenium-webdriver": "4.33.0",
23
23
  "yargs": "17.7.2"
24
24
  },
25
25
  "optionalDependencies": {
@@ -28,18 +28,18 @@
28
28
  "@jimp/jpeg": "0.22.12",
29
29
  "@jimp/plugin-resize": "0.22.12",
30
30
  "@jimp/plugin-scale": "0.22.12",
31
- "usb-power-profiling": "1.5.0"
31
+ "usb-power-profiling": "1.6.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/selenium-webdriver": "4.1.25",
35
- "ava": "6.2.0",
35
+ "ava": "6.3.0",
36
36
  "clean-jsdoc-theme": "4.3.0",
37
- "eslint": "9.17.0",
38
- "eslint-config-prettier": "9.1.0",
39
- "eslint-plugin-prettier": "5.2.1",
37
+ "eslint": "9.27.0",
38
+ "eslint-config-prettier": "10.1.5",
39
+ "eslint-plugin-prettier": "5.4.1",
40
40
  "eslint-plugin-unicorn": "56.0.1",
41
41
  "jsdoc": "4.0.4",
42
- "prettier": "3.4.2",
42
+ "prettier": "3.5.3",
43
43
  "serve": "14.2.4",
44
44
  "serve-handler": "6.1.6",
45
45
  "typescript": "5.7.2"
@@ -44,6 +44,16 @@ export class Wait {
44
44
  * @throws {Error} Throws an error if the element is not found within the specified time.
45
45
  */
46
46
  byXpath(xpath: string, maxTime: number): Promise<void>;
47
+ /**
48
+ * Waits for an element located by XPath to appear and visible within a maximum time.
49
+ *
50
+ * @async
51
+ * @param {string} xpath - The XPath of the element to wait for.
52
+ * @param {number} maxTime - Maximum time to wait in milliseconds.
53
+ * @returns {Promise<void>} A promise that resolves when the element is found or the time times out.
54
+ * @throws {Error} Throws an error if the element is not found within the specified time.
55
+ */
56
+ byXpathAndVisible(xpath: string, maxTime?: number): Promise<void>;
47
57
  /**
48
58
  * Waits for an element located by a CSS selector to appear within a maximum time.
49
59
  *
@@ -54,6 +64,16 @@ export class Wait {
54
64
  * @throws {Error} Throws an error if the element is not found within the specified time.
55
65
  */
56
66
  bySelector(selector: string, maxTime: number): Promise<void>;
67
+ /**
68
+ * Waits for an element located by a CSS selector to be visible within a maximum time.
69
+ *
70
+ * @async
71
+ * @param {string} selector - The CSS selector of the element to wait for.
72
+ * @param {number} maxTime - Maximum time to wait in milliseconds.
73
+ * @returns {Promise<void>} A promise that resolves when the element is found or the time times out.
74
+ * @throws {Error} Throws an error if the element is not found within the specified time.
75
+ */
76
+ bySelectorAndVisible(selector: string, maxTime?: number): Promise<void>;
57
77
  /**
58
78
  * Waits for a specified amount of time.
59
79
  *
@@ -1 +1 @@
1
- {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../../lib/core/engine/command/wait.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;IACE,kDASC;IARC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAG5C;;;;;;;;OAQG;IACH,SALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAED;;;;;;;;OAQG;IACH,mBALW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;OAQG;IACH,eALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;OAQG;IACH,qBALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAuBzB;IAED;;;;;;;OAOG;IACH,WAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;;OAKG;IACH,oBAFa,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;;;;;OAQG;IACH,0BALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;CACF"}
1
+ {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../../lib/core/engine/command/wait.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;IACE,kDASC;IARC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAG5C;;;;;;;;OAQG;IACH,SALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAED;;;;;;;;OAQG;IACH,mBALW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;OAQG;IACH,eALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;OAQG;IACH,yBALW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB;IAED;;;;;;;;OAQG;IACH,qBALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAuBzB;IAED;;;;;;;;OAQG;IACH,+BALW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAwBzB;IAED;;;;;;;OAOG;IACH,WAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;;OAKG;IACH,oBAFa,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;;;;;OAQG;IACH,0BALW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;CACF"}