playwright-core 1.57.0-alpha-2025-10-15 → 1.57.0-alpha-2025-10-16

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.
@@ -167,6 +167,9 @@ class Locator {
167
167
  describe(description) {
168
168
  return new Locator(this._frame, this._selector + " >> internal:describe=" + JSON.stringify(description));
169
169
  }
170
+ description() {
171
+ return (0, import_locatorGenerators.locatorCustomDescription)(this._selector) || null;
172
+ }
170
173
  first() {
171
174
  return new Locator(this._frame, this._selector + " >> nth=0");
172
175
  }
@@ -41,7 +41,7 @@ class CRServiceWorker extends import_page.Worker {
41
41
  super(browserContext, url);
42
42
  this._session = session;
43
43
  this.browserContext = browserContext;
44
- if (!!process.env.PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS)
44
+ if (!process.env.PLAYWRIGHT_DISABLE_SERVICE_WORKER_NETWORK)
45
45
  this._networkManager = new import_crNetworkManager.CRNetworkManager(null, this);
46
46
  session.once("Runtime.executionContextCreated", (event) => {
47
47
  this.createExecutionContext(new import_crExecutionContext.CRExecutionContext(session, event.context));
@@ -41,6 +41,7 @@ function browserDirectoryToMarkerFilePath(browserDirectory) {
41
41
  function downloadFile(options) {
42
42
  let downloadedBytes = 0;
43
43
  let totalBytes = 0;
44
+ let chunked = false;
44
45
  const promise = new import_manualPromise.ManualPromise();
45
46
  (0, import_network.httpRequest)({
46
47
  url: options.url,
@@ -60,11 +61,13 @@ function downloadFile(options) {
60
61
  response.on("data", (chunk) => content += chunk).on("end", handleError).on("error", handleError);
61
62
  return;
62
63
  }
64
+ chunked = response.headers["transfer-encoding"] === "chunked";
65
+ log(`-- is chunked: ${chunked}`);
63
66
  totalBytes = parseInt(response.headers["content-length"] || "0", 10);
64
67
  log(`-- total bytes: ${totalBytes}`);
65
68
  const file = import_fs.default.createWriteStream(options.zipPath);
66
69
  file.on("finish", () => {
67
- if (downloadedBytes !== totalBytes) {
70
+ if (!chunked && downloadedBytes !== totalBytes) {
68
71
  log(`-- download failed, size mismatch: ${downloadedBytes} != ${totalBytes}`);
69
72
  promise.reject(new Error(`Download failed: size mismatch, file size: ${downloadedBytes}, expected size: ${totalBytes} URL: ${options.url}`));
70
73
  } else {
@@ -89,7 +92,8 @@ function downloadFile(options) {
89
92
  return promise;
90
93
  function onData(chunk) {
91
94
  downloadedBytes += chunk.length;
92
- progress(downloadedBytes, totalBytes);
95
+ if (!chunked)
96
+ progress(downloadedBytes, totalBytes);
93
97
  }
94
98
  }
95
99
  async function main(options) {
@@ -25,7 +25,8 @@ __export(locatorGenerators_exports, {
25
25
  PythonLocatorFactory: () => PythonLocatorFactory,
26
26
  asLocator: () => asLocator,
27
27
  asLocatorDescription: () => asLocatorDescription,
28
- asLocators: () => asLocators
28
+ asLocators: () => asLocators,
29
+ locatorCustomDescription: () => locatorCustomDescription
29
30
  });
30
31
  module.exports = __toCommonJS(locatorGenerators_exports);
31
32
  var import_selectorParser = require("./selectorParser");
@@ -33,17 +34,31 @@ var import_stringUtils = require("./stringUtils");
33
34
  function asLocatorDescription(lang, selector) {
34
35
  try {
35
36
  const parsed = (0, import_selectorParser.parseSelector)(selector);
36
- const lastPart = parsed.parts[parsed.parts.length - 1];
37
- if (lastPart?.name === "internal:describe") {
38
- const description = JSON.parse(lastPart.body);
39
- if (typeof description === "string")
40
- return description;
41
- }
37
+ const customDescription = parseCustomDescription(parsed);
38
+ if (customDescription)
39
+ return customDescription;
42
40
  return innerAsLocators(new generators[lang](), parsed, false, 1)[0];
43
41
  } catch (e) {
44
42
  return selector;
45
43
  }
46
44
  }
45
+ function locatorCustomDescription(selector) {
46
+ try {
47
+ const parsed = (0, import_selectorParser.parseSelector)(selector);
48
+ return parseCustomDescription(parsed);
49
+ } catch (e) {
50
+ return void 0;
51
+ }
52
+ }
53
+ function parseCustomDescription(parsed) {
54
+ const lastPart = parsed.parts[parsed.parts.length - 1];
55
+ if (lastPart?.name === "internal:describe") {
56
+ const description = JSON.parse(lastPart.body);
57
+ if (typeof description === "string")
58
+ return description;
59
+ }
60
+ return void 0;
61
+ }
47
62
  function asLocator(lang, selector, isFrameLocator = false) {
48
63
  return asLocators(lang, selector, isFrameLocator, 1)[0];
49
64
  }
@@ -669,5 +684,6 @@ function isRegExp(obj) {
669
684
  PythonLocatorFactory,
670
685
  asLocator,
671
686
  asLocatorDescription,
672
- asLocators
687
+ asLocators,
688
+ locatorCustomDescription
673
689
  });