playwright 1.62.1 → 1.65.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.
@@ -7336,7 +7336,7 @@ var require_scan = __commonJS({
7336
7336
  var scan = (input, options) => {
7337
7337
  const opts = options || {};
7338
7338
  const length = input.length - 1;
7339
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
7339
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
7340
7340
  const slashes = [];
7341
7341
  const tokens = [];
7342
7342
  const parts = [];
@@ -7442,14 +7442,18 @@ var require_scan = __commonJS({
7442
7442
  negatedExtglob = true;
7443
7443
  }
7444
7444
  if (scanToEnd === true) {
7445
+ let parens = 0;
7445
7446
  while (eos() !== true && (code = advance())) {
7446
7447
  if (code === CHAR_BACKWARD_SLASH) {
7447
7448
  backslashes = token.backslashes = true;
7448
- code = advance();
7449
+ advance();
7450
+ continue;
7451
+ }
7452
+ if (code === CHAR_LEFT_PARENTHESES) {
7453
+ parens++;
7449
7454
  continue;
7450
7455
  }
7451
- if (code === CHAR_RIGHT_PARENTHESES) {
7452
- isGlob = token.isGlob = true;
7456
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
7453
7457
  finished = true;
7454
7458
  break;
7455
7459
  }
@@ -7503,13 +7507,18 @@ var require_scan = __commonJS({
7503
7507
  if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
7504
7508
  isGlob = token.isGlob = true;
7505
7509
  if (scanToEnd === true) {
7510
+ let parens = 1;
7506
7511
  while (eos() !== true && (code = advance())) {
7507
- if (code === CHAR_LEFT_PARENTHESES) {
7512
+ if (code === CHAR_BACKWARD_SLASH) {
7508
7513
  backslashes = token.backslashes = true;
7509
- code = advance();
7514
+ advance();
7510
7515
  continue;
7511
7516
  }
7512
- if (code === CHAR_RIGHT_PARENTHESES) {
7517
+ if (code === CHAR_LEFT_PARENTHESES) {
7518
+ parens++;
7519
+ continue;
7520
+ }
7521
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
7513
7522
  finished = true;
7514
7523
  break;
7515
7524
  }
@@ -7582,32 +7591,31 @@ var require_scan = __commonJS({
7582
7591
  if (opts.parts === true || opts.tokens === true) {
7583
7592
  let prevIndex;
7584
7593
  for (let idx = 0; idx < slashes.length; idx++) {
7585
- const n = prevIndex ? prevIndex + 1 : start;
7594
+ const n2 = prevIndex !== void 0 ? prevIndex + 1 : start;
7586
7595
  const i = slashes[idx];
7587
- const value = input.slice(n, i);
7596
+ const value2 = input.slice(n2, i);
7588
7597
  if (opts.tokens) {
7589
7598
  if (idx === 0 && start !== 0) {
7590
7599
  tokens[idx].isPrefix = true;
7591
7600
  tokens[idx].value = prefix;
7592
7601
  } else {
7593
- tokens[idx].value = value;
7602
+ tokens[idx].value = value2;
7594
7603
  }
7595
7604
  depth(tokens[idx]);
7596
7605
  state.maxDepth += tokens[idx].depth;
7597
7606
  }
7598
- if (idx !== 0 || value !== "") {
7599
- parts.push(value);
7607
+ if (i >= start) {
7608
+ parts.push(value2);
7609
+ prevIndex = i;
7600
7610
  }
7601
- prevIndex = i;
7602
7611
  }
7603
- if (prevIndex && prevIndex + 1 < input.length) {
7604
- const value = input.slice(prevIndex + 1);
7605
- parts.push(value);
7606
- if (opts.tokens) {
7607
- tokens[tokens.length - 1].value = value;
7608
- depth(tokens[tokens.length - 1]);
7609
- state.maxDepth += tokens[tokens.length - 1].depth;
7610
- }
7612
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
7613
+ const value = input.slice(n);
7614
+ parts.push(value);
7615
+ if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
7616
+ tokens[tokens.length - 1].value = value;
7617
+ depth(tokens[tokens.length - 1]);
7618
+ state.maxDepth += tokens[tokens.length - 1].depth;
7611
7619
  }
7612
7620
  state.slashes = slashes;
7613
7621
  state.parts = parts;
@@ -7796,7 +7804,11 @@ var require_parse = __commonJS({
7796
7804
  }
7797
7805
  }
7798
7806
  };
7799
- var getStarExtglobSequenceOutput = (pattern) => {
7807
+ var buildCharClassStar = (chars) => {
7808
+ const source = chars.length === 1 ? utils2.escapeRegex(chars[0]) : `[${chars.map((ch) => utils2.escapeRegex(ch)).join("")}]`;
7809
+ return `${source}*`;
7810
+ };
7811
+ var getStarExtglobSequenceChars = (pattern) => {
7800
7812
  let index = 0;
7801
7813
  const chars = [];
7802
7814
  while (index < pattern.length) {
@@ -7818,8 +7830,7 @@ var require_parse = __commonJS({
7818
7830
  if (chars.length < 1) {
7819
7831
  return;
7820
7832
  }
7821
- const source = chars.length === 1 ? utils2.escapeRegex(chars[0]) : `[${chars.map((ch) => utils2.escapeRegex(ch)).join("")}]`;
7822
- return `${source}*`;
7833
+ return chars;
7823
7834
  };
7824
7835
  var repeatedExtglobRecursion = (pattern) => {
7825
7836
  let depth = 0;
@@ -7843,15 +7854,29 @@ var require_parse = __commonJS({
7843
7854
  return { risky: true };
7844
7855
  }
7845
7856
  }
7857
+ const safeChars = [];
7858
+ let sawStarSequence = false;
7859
+ let combinable = true;
7846
7860
  for (const branch of branches) {
7847
- const safeOutput = getStarExtglobSequenceOutput(branch);
7848
- if (safeOutput) {
7849
- return { risky: true, safeOutput };
7861
+ const chars = getStarExtglobSequenceChars(branch);
7862
+ if (chars) {
7863
+ sawStarSequence = true;
7864
+ safeChars.push(...chars);
7865
+ continue;
7866
+ }
7867
+ const literal = normalizeSimpleBranch(branch);
7868
+ if (literal && literal.length === 1) {
7869
+ safeChars.push(literal);
7870
+ continue;
7850
7871
  }
7872
+ combinable = false;
7851
7873
  if (repeatedExtglobRecursion(branch) > max) {
7852
7874
  return { risky: true };
7853
7875
  }
7854
7876
  }
7877
+ if (sawStarSequence) {
7878
+ return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
7879
+ }
7855
7880
  return { risky: false };
7856
7881
  };
7857
7882
  var parse = (input, options) => {
@@ -8433,6 +8458,7 @@ var require_parse = __commonJS({
8433
8458
  rest = rest.slice(3);
8434
8459
  consume("/**", 3);
8435
8460
  }
8461
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
8436
8462
  if (prior.type === "bos" && eos()) {
8437
8463
  prev.type = "globstar";
8438
8464
  prev.value += value;
@@ -8442,7 +8468,7 @@ var require_parse = __commonJS({
8442
8468
  consume(value);
8443
8469
  continue;
8444
8470
  }
8445
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
8471
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
8446
8472
  state.output = state.output.slice(0, -(prior.output + prev.output).length);
8447
8473
  prior.output = `(?:${prior.output}`;
8448
8474
  prev.type = "globstar";
@@ -8701,9 +8727,9 @@ var require_picomatch = __commonJS({
8701
8727
  }
8702
8728
  return { isMatch: Boolean(match), match, output };
8703
8729
  };
8704
- picomatch.matchBase = (input, glob, options) => {
8730
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
8705
8731
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
8706
- return regex.test(utils2.basename(input));
8732
+ return regex.test(utils2.basename(input, { windows: posix }));
8707
8733
  };
8708
8734
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
8709
8735
  picomatch.parse = (pattern, options) => {
@@ -11153,6 +11179,9 @@ var ArrayContaining = class extends AsymmetricMatcher {
11153
11179
  }
11154
11180
  };
11155
11181
  var ArrayOf = class extends AsymmetricMatcher {
11182
+ constructor(sample, inverse = false) {
11183
+ super(typeof sample === "function" ? new Any(sample) : sample, inverse);
11184
+ }
11156
11185
  asymmetricMatch(other) {
11157
11186
  const matcherContext = this.getMatcherContext();
11158
11187
  const result = Array.isArray(other) && other.every(
@@ -12479,11 +12508,11 @@ var SnapshotHelper = class {
12479
12508
  writeFileSync(this.actualPath, actual);
12480
12509
  attachments.push({ name: addSuffixToFilePath(this.attachmentBaseName, "-actual"), contentType: this.mimeType, path: this.actualPath });
12481
12510
  const message = `A snapshot doesn't exist at ${this.expectedPath}${isWriteMissingMode ? ", writing actual." : "."}`;
12482
- if (this.updateSnapshots === "all" || this.updateSnapshots === "changed") {
12511
+ if (this.updateSnapshots === "all" || this.updateSnapshots === "changed" || this.updateSnapshots === "missing") {
12483
12512
  console.log(message);
12484
12513
  return this.createMatcherResult(message, true, void 0, attachments);
12485
12514
  }
12486
- if (this.updateSnapshots === "missing") {
12515
+ if (this.updateSnapshots === "default") {
12487
12516
  return {
12488
12517
  ...this.createMatcherResult("", true, void 0, attachments),
12489
12518
  softError: new Error(message),
@@ -12612,6 +12641,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
12612
12641
  isNot: !!this.isNot,
12613
12642
  timeout,
12614
12643
  signal: helper.options.signal,
12644
+ title: this.title,
12615
12645
  type: screenshotType,
12616
12646
  comparator: helper.options.comparator,
12617
12647
  maxDiffPixels: helper.options.maxDiffPixels,
@@ -12725,7 +12755,7 @@ function toBeAttached(locator, options) {
12725
12755
  const expected = attached ? "attached" : "detached";
12726
12756
  const arg = attached ? "" : "{ attached: false }";
12727
12757
  return toBeTruthy.call(this, "toBeAttached", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
12728
- return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout, signal });
12758
+ return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout, signal, title: this.title });
12729
12759
  }, options);
12730
12760
  }
12731
12761
  function toBeChecked(locator, options) {
@@ -12745,12 +12775,12 @@ function toBeChecked(locator, options) {
12745
12775
  arg = options?.checked === false ? `{ checked: false }` : "";
12746
12776
  }
12747
12777
  return toBeTruthy.call(this, "toBeChecked", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
12748
- return await locator._expect("to.be.checked", { isNot, timeout, expectedValue, signal });
12778
+ return await locator._expect("to.be.checked", { isNot, timeout, expectedValue, signal, title: this.title });
12749
12779
  }, options);
12750
12780
  }
12751
12781
  function toBeDisabled(locator, options) {
12752
12782
  return toBeTruthy.call(this, "toBeDisabled", locator, "Locator", "disabled", "", async (isNot, timeout, signal) => {
12753
- return await locator._expect("to.be.disabled", { isNot, timeout, signal });
12783
+ return await locator._expect("to.be.disabled", { isNot, timeout, signal, title: this.title });
12754
12784
  }, options);
12755
12785
  }
12756
12786
  function toBeEditable(locator, options) {
@@ -12758,12 +12788,12 @@ function toBeEditable(locator, options) {
12758
12788
  const expected = editable ? "editable" : "readOnly";
12759
12789
  const arg = editable ? "" : "{ editable: false }";
12760
12790
  return toBeTruthy.call(this, "toBeEditable", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
12761
- return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout, signal });
12791
+ return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout, signal, title: this.title });
12762
12792
  }, options);
12763
12793
  }
12764
12794
  function toBeEmpty(locator, options) {
12765
12795
  return toBeTruthy.call(this, "toBeEmpty", locator, "Locator", "empty", "", async (isNot, timeout, signal) => {
12766
- return await locator._expect("to.be.empty", { isNot, timeout, signal });
12796
+ return await locator._expect("to.be.empty", { isNot, timeout, signal, title: this.title });
12767
12797
  }, options);
12768
12798
  }
12769
12799
  function toBeEnabled(locator, options) {
@@ -12771,17 +12801,17 @@ function toBeEnabled(locator, options) {
12771
12801
  const expected = enabled ? "enabled" : "disabled";
12772
12802
  const arg = enabled ? "" : "{ enabled: false }";
12773
12803
  return toBeTruthy.call(this, "toBeEnabled", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
12774
- return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout, signal });
12804
+ return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout, signal, title: this.title });
12775
12805
  }, options);
12776
12806
  }
12777
12807
  function toBeFocused(locator, options) {
12778
12808
  return toBeTruthy.call(this, "toBeFocused", locator, "Locator", "focused", "", async (isNot, timeout, signal) => {
12779
- return await locator._expect("to.be.focused", { isNot, timeout, signal });
12809
+ return await locator._expect("to.be.focused", { isNot, timeout, signal, title: this.title });
12780
12810
  }, options);
12781
12811
  }
12782
12812
  function toBeHidden(locator, options) {
12783
12813
  return toBeTruthy.call(this, "toBeHidden", locator, "Locator", "hidden", "", async (isNot, timeout, signal) => {
12784
- return await locator._expect("to.be.hidden", { isNot, timeout, signal });
12814
+ return await locator._expect("to.be.hidden", { isNot, timeout, signal, title: this.title });
12785
12815
  }, options);
12786
12816
  }
12787
12817
  function toBeVisible(locator, options) {
@@ -12789,43 +12819,43 @@ function toBeVisible(locator, options) {
12789
12819
  const expected = visible ? "visible" : "hidden";
12790
12820
  const arg = visible ? "" : "{ visible: false }";
12791
12821
  return toBeTruthy.call(this, "toBeVisible", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
12792
- return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout, signal });
12822
+ return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout, signal, title: this.title });
12793
12823
  }, options);
12794
12824
  }
12795
12825
  function toBeInViewport(locator, options) {
12796
12826
  return toBeTruthy.call(this, "toBeInViewport", locator, "Locator", "in viewport", "", async (isNot, timeout, signal) => {
12797
- return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout, signal });
12827
+ return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout, signal, title: this.title });
12798
12828
  }, options);
12799
12829
  }
12800
12830
  function toContainText(locator, expected, options = {}) {
12801
12831
  if (Array.isArray(expected)) {
12802
12832
  return toEqual.call(this, "toContainText", locator, "Locator", async (isNot, timeout, signal) => {
12803
12833
  const expectedText = serializeExpectedTextValues(expected, { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
12804
- return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal });
12834
+ return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal, title: this.title });
12805
12835
  }, expected, { ...options, contains: true });
12806
12836
  } else {
12807
12837
  return toMatchText.call(this, "toContainText", locator, "Locator", async (isNot, timeout, signal) => {
12808
12838
  const expectedText = serializeExpectedTextValues([expected], { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
12809
- return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal });
12839
+ return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal, title: this.title });
12810
12840
  }, expected, { ...options, matchSubstring: true });
12811
12841
  }
12812
12842
  }
12813
12843
  function toHaveAccessibleDescription(locator, expected, options) {
12814
12844
  return toMatchText.call(this, "toHaveAccessibleDescription", locator, "Locator", async (isNot, timeout, signal) => {
12815
12845
  const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
12816
- return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout, signal });
12846
+ return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout, signal, title: this.title });
12817
12847
  }, expected, options);
12818
12848
  }
12819
12849
  function toHaveAccessibleName(locator, expected, options) {
12820
12850
  return toMatchText.call(this, "toHaveAccessibleName", locator, "Locator", async (isNot, timeout, signal) => {
12821
12851
  const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
12822
- return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout, signal });
12852
+ return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout, signal, title: this.title });
12823
12853
  }, expected, options);
12824
12854
  }
12825
12855
  function toHaveAccessibleErrorMessage(locator, expected, options) {
12826
12856
  return toMatchText.call(this, "toHaveAccessibleErrorMessage", locator, "Locator", async (isNot, timeout, signal) => {
12827
12857
  const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
12828
- return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout, signal });
12858
+ return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout, signal, title: this.title });
12829
12859
  }, expected, options);
12830
12860
  }
12831
12861
  function toHaveAttribute(locator, name, expected, options) {
@@ -12837,24 +12867,24 @@ function toHaveAttribute(locator, name, expected, options) {
12837
12867
  }
12838
12868
  if (expected === void 0) {
12839
12869
  return toBeTruthy.call(this, "toHaveAttribute", locator, "Locator", "have attribute", "", async (isNot, timeout, signal) => {
12840
- return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout, signal });
12870
+ return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout, signal, title: this.title });
12841
12871
  }, options);
12842
12872
  }
12843
12873
  return toMatchText.call(this, "toHaveAttribute", locator, "Locator", async (isNot, timeout, signal) => {
12844
12874
  const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase });
12845
- return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout, signal });
12875
+ return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout, signal, title: this.title });
12846
12876
  }, expected, options);
12847
12877
  }
12848
12878
  function toHaveClass(locator, expected, options) {
12849
12879
  if (Array.isArray(expected)) {
12850
12880
  return toEqual.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout, signal) => {
12851
12881
  const expectedText = serializeExpectedTextValues(expected);
12852
- return await locator._expect("to.have.class.array", { expectedText, isNot, timeout, signal });
12882
+ return await locator._expect("to.have.class.array", { expectedText, isNot, timeout, signal, title: this.title });
12853
12883
  }, expected, options);
12854
12884
  } else {
12855
12885
  return toMatchText.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout, signal) => {
12856
12886
  const expectedText = serializeExpectedTextValues([expected]);
12857
- return await locator._expect("to.have.class", { expectedText, isNot, timeout, signal });
12887
+ return await locator._expect("to.have.class", { expectedText, isNot, timeout, signal, title: this.title });
12858
12888
  }, expected, options);
12859
12889
  }
12860
12890
  }
@@ -12864,37 +12894,37 @@ function toContainClass(locator, expected, options) {
12864
12894
  throw new Error(`"expected" argument in toContainClass cannot contain RegExp values`);
12865
12895
  return toEqual.call(this, "toContainClass", locator, "Locator", async (isNot, timeout, signal) => {
12866
12896
  const expectedText = serializeExpectedTextValues(expected);
12867
- return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout, signal });
12897
+ return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout, signal, title: this.title });
12868
12898
  }, expected, options);
12869
12899
  } else {
12870
12900
  if (isRegExp2(expected))
12871
12901
  throw new Error(`"expected" argument in toContainClass cannot be a RegExp value`);
12872
12902
  return toMatchText.call(this, "toContainClass", locator, "Locator", async (isNot, timeout, signal) => {
12873
12903
  const expectedText = serializeExpectedTextValues([expected]);
12874
- return await locator._expect("to.contain.class", { expectedText, isNot, timeout, signal });
12904
+ return await locator._expect("to.contain.class", { expectedText, isNot, timeout, signal, title: this.title });
12875
12905
  }, expected, options);
12876
12906
  }
12877
12907
  }
12878
12908
  function toHaveCount(locator, expected, options) {
12879
12909
  return toEqual.call(this, "toHaveCount", locator, "Locator", async (isNot, timeout, signal) => {
12880
- return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout, signal });
12910
+ return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout, signal, title: this.title });
12881
12911
  }, expected, options);
12882
12912
  }
12883
12913
  function toHaveCSS(locator, name, expected, options) {
12884
12914
  return toMatchText.call(this, "toHaveCSS", locator, "Locator", async (isNot, timeout, signal) => {
12885
12915
  const expectedText = serializeExpectedTextValues([expected]);
12886
- return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, pseudo: options?.pseudo, timeout, signal });
12916
+ return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, pseudo: options?.pseudo, timeout, signal, title: this.title });
12887
12917
  }, expected, options);
12888
12918
  }
12889
12919
  function toHaveId(locator, expected, options) {
12890
12920
  return toMatchText.call(this, "toHaveId", locator, "Locator", async (isNot, timeout, signal) => {
12891
12921
  const expectedText = serializeExpectedTextValues([expected]);
12892
- return await locator._expect("to.have.id", { expectedText, isNot, timeout, signal });
12922
+ return await locator._expect("to.have.id", { expectedText, isNot, timeout, signal, title: this.title });
12893
12923
  }, expected, options);
12894
12924
  }
12895
12925
  function toHaveJSProperty(locator, name, expected, options) {
12896
12926
  return toEqual.call(this, "toHaveJSProperty", locator, "Locator", async (isNot, timeout, signal) => {
12897
- return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout, signal });
12927
+ return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout, signal, title: this.title });
12898
12928
  }, expected, options);
12899
12929
  }
12900
12930
  function toHaveRole(locator, expected, options) {
@@ -12902,38 +12932,38 @@ function toHaveRole(locator, expected, options) {
12902
12932
  throw new Error(`"role" argument in toHaveRole must be a string`);
12903
12933
  return toMatchText.call(this, "toHaveRole", locator, "Locator", async (isNot, timeout, signal) => {
12904
12934
  const expectedText = serializeExpectedTextValues([expected]);
12905
- return await locator._expect("to.have.role", { expectedText, isNot, timeout, signal });
12935
+ return await locator._expect("to.have.role", { expectedText, isNot, timeout, signal, title: this.title });
12906
12936
  }, expected, options);
12907
12937
  }
12908
12938
  function toHaveText(locator, expected, options = {}) {
12909
12939
  if (Array.isArray(expected)) {
12910
12940
  return toEqual.call(this, "toHaveText", locator, "Locator", async (isNot, timeout, signal) => {
12911
12941
  const expectedText = serializeExpectedTextValues(expected, { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
12912
- return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal });
12942
+ return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal, title: this.title });
12913
12943
  }, expected, options);
12914
12944
  } else {
12915
12945
  return toMatchText.call(this, "toHaveText", locator, "Locator", async (isNot, timeout, signal) => {
12916
12946
  const expectedText = serializeExpectedTextValues([expected], { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
12917
- return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal });
12947
+ return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal, title: this.title });
12918
12948
  }, expected, options);
12919
12949
  }
12920
12950
  }
12921
12951
  function toHaveValue(locator, expected, options) {
12922
12952
  return toMatchText.call(this, "toHaveValue", locator, "Locator", async (isNot, timeout, signal) => {
12923
12953
  const expectedText = serializeExpectedTextValues([expected]);
12924
- return await locator._expect("to.have.value", { expectedText, isNot, timeout, signal });
12954
+ return await locator._expect("to.have.value", { expectedText, isNot, timeout, signal, title: this.title });
12925
12955
  }, expected, options);
12926
12956
  }
12927
12957
  function toHaveValues(locator, expected, options) {
12928
12958
  return toEqual.call(this, "toHaveValues", locator, "Locator", async (isNot, timeout, signal) => {
12929
12959
  const expectedText = serializeExpectedTextValues(expected);
12930
- return await locator._expect("to.have.values", { expectedText, isNot, timeout, signal });
12960
+ return await locator._expect("to.have.values", { expectedText, isNot, timeout, signal, title: this.title });
12931
12961
  }, expected, options);
12932
12962
  }
12933
12963
  function toHaveTitle(page, expected, options = {}) {
12934
12964
  return toMatchText.call(this, "toHaveTitle", page, "Page", async (isNot, timeout, signal) => {
12935
12965
  const expectedText = serializeExpectedTextValues([expected], { normalizeWhiteSpace: true });
12936
- return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout, signal });
12966
+ return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout, signal, title: this.title });
12937
12967
  }, expected, options);
12938
12968
  }
12939
12969
  function toHaveURL(page, expected, options) {
@@ -12945,7 +12975,7 @@ function toHaveURL(page, expected, options) {
12945
12975
  expected = typeof expected === "string" ? constructURLBasedOnBaseURL(baseURL, expected) : expected;
12946
12976
  return toMatchText.call(this, "toHaveURL", page, "Page", async (isNot, timeout, signal) => {
12947
12977
  const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase });
12948
- return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout, signal });
12978
+ return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout, signal, title: this.title });
12949
12979
  }, expected, options);
12950
12980
  }
12951
12981
  async function toBeOK(response) {
@@ -12999,11 +13029,12 @@ async function toPass(callback, options = {}) {
12999
13029
  function computeMatcherTitleSuffix(matcherName, receiver, args) {
13000
13030
  if (matcherName === "toHaveScreenshot") {
13001
13031
  const title = toHaveScreenshotStepTitle(...args);
13002
- return { short: title ? `(${title})` : "" };
13032
+ return { titleSuffix: title ? `(${title})` : "" };
13003
13033
  }
13004
13034
  if (receiver && typeof receiver === "object" && receiver._apiName === "Locator") {
13005
13035
  try {
13006
- return { long: " " + asLocatorDescription("javascript", receiver._selector) };
13036
+ const locator = asLocatorDescription("javascript", receiver._selector);
13037
+ return { subtitle: locator, params: { locator } };
13007
13038
  } catch {
13008
13039
  }
13009
13040
  }
@@ -13053,7 +13084,7 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
13053
13084
  expected = await import_fs2.default.promises.readFile(expectedPath, "utf8").catch(() => "");
13054
13085
  timeout = expectedParam?.timeout ?? this.timeout;
13055
13086
  }
13056
- const isMissingBaseline = updateSnapshots === "missing" && !expected;
13087
+ const isMissingBaseline = (updateSnapshots === "missing" || updateSnapshots === "default") && !expected;
13057
13088
  if (isMissingBaseline && this.isNot) {
13058
13089
  const message2 = `Matchers using ".not" can't generate new baselines`;
13059
13090
  return { pass: this.isNot, message: () => message2, name: "toMatchAriaSnapshot" };
@@ -13067,7 +13098,7 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
13067
13098
  if (globalChildren && !expected.match(/^- \/children:/m))
13068
13099
  expected = `- /children: ${globalChildren}
13069
13100
  ` + expected;
13070
- const expectParams = { expectedValue: expected, isNot: this.isNot, timeout, signal: options.signal };
13101
+ const expectParams = { expectedValue: expected, isNot: this.isNot, timeout, signal: options.signal, title: this.title };
13071
13102
  const { matches: pass, received, log, timedOut, errorMessage } = locator ? await locator._expect("to.match.aria", expectParams) : await receiver.mainFrame()._expect("to.match.aria", expectParams);
13072
13103
  const typedReceived = received?.value;
13073
13104
  const message = () => {
@@ -13108,7 +13139,10 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
13108
13139
  const relativePath = import_path2.default.relative(process.cwd(), expectedPath);
13109
13140
  if (isMissingBaseline) {
13110
13141
  const message3 = `A snapshot doesn't exist at ${relativePath}, writing actual.`;
13111
- return { pass: true, message: () => "", name: "toMatchAriaSnapshot", softError: new Error(message3), shouldNotRetryTest: true };
13142
+ if (updateSnapshots === "default")
13143
+ return { pass: true, message: () => "", name: "toMatchAriaSnapshot", softError: new Error(message3), shouldNotRetryTest: true };
13144
+ console.log(message3);
13145
+ return { pass: true, message: () => "", name: "toMatchAriaSnapshot" };
13112
13146
  }
13113
13147
  const message2 = `A snapshot is generated at ${relativePath}.`;
13114
13148
  console.log(message2);
@@ -13117,7 +13151,7 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
13117
13151
  const suggestedRebaseline = `\`
13118
13152
  ${escapeTemplateString(indent2(typedReceived.regex, "{indent} "))}
13119
13153
  {indent}\``;
13120
- if (isMissingBaseline) {
13154
+ if (isMissingBaseline && updateSnapshots === "default") {
13121
13155
  const message2 = "A snapshot is not provided, generating new baseline.";
13122
13156
  return { pass: true, message: () => "", name: "toMatchAriaSnapshot", suggestedRebaseline, softError: new Error(message2), shouldNotRetryTest: true };
13123
13157
  }
@@ -13159,7 +13193,7 @@ var { currentZone } = require("playwright-core/lib/coreBundle").utils;
13159
13193
  function unfilteredStackTrace(rawStack) {
13160
13194
  return rawStack.map((frame) => parseStackFrame(frame)).filter((f) => !!f);
13161
13195
  }
13162
- var _expectConfig = { testInfo: null, filteredStackTrace: unfilteredStackTrace, ignoreSnapshots: false, updateSnapshots: "missing" };
13196
+ var _expectConfig = { testInfo: null, filteredStackTrace: unfilteredStackTrace, ignoreSnapshots: false, updateSnapshots: "default" };
13163
13197
  function setExpectConfig(config) {
13164
13198
  _expectConfig = config;
13165
13199
  }
@@ -13303,17 +13337,18 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
13303
13337
  const testInfo = expectConfig().testInfo;
13304
13338
  const customMessage = info.message || "";
13305
13339
  const suffixes = computeMatcherTitleSuffix(matcherName, actual, args);
13306
- const defaultTitle = `${info.poll ? "poll " : ""}${info.isSoft ? "soft " : ""}${info.isNot ? "not " : ""}${matcherName}${suffixes.short || ""}`;
13307
- const shortTitle = customMessage || `Expect ${escapeWithQuotes(defaultTitle, '"')}`;
13308
- const longTitle = shortTitle + (suffixes.long || "");
13309
- const apiName = `expect${info.poll ? ".poll " : ""}${info.isSoft ? ".soft " : ""}${info.isNot ? ".not" : ""}.${matcherName}${suffixes.short || ""}`;
13340
+ const defaultTitle = `${info.poll ? "poll " : ""}${info.isSoft ? "soft " : ""}${info.isNot ? "not " : ""}${matcherName}${suffixes.titleSuffix || ""}`;
13341
+ const title = customMessage || `Expect ${escapeWithQuotes(defaultTitle, '"')}`;
13310
13342
  const stackFrames = expectConfig().filteredStackTrace(captureRawStack());
13343
+ const params = { ...suffixes.params };
13344
+ if (args[0])
13345
+ params.expected = args[0];
13311
13346
  const stepData = {
13312
13347
  category: "expect",
13313
- apiName,
13314
- title: longTitle,
13315
- shortTitle,
13316
- params: args[0] ? { expected: args[0] } : void 0
13348
+ title,
13349
+ subtitle: suffixes.subtitle,
13350
+ stack: stackFrames,
13351
+ params: Object.keys(params).length ? params : void 0
13317
13352
  };
13318
13353
  const step = testInfo?._addStep(stepData);
13319
13354
  const handleError = (error, result) => {
@@ -13334,7 +13369,7 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
13334
13369
  }
13335
13370
  };
13336
13371
  try {
13337
- const invoke = () => info.poll ? invokePollMatcher(matcherName, info, matcher, actual, args, promise) : invokeMatcher(matcherName, info, matcher, actual, args, promise);
13372
+ const invoke = () => info.poll ? invokePollMatcher(matcherName, info, matcher, actual, args, promise) : invokeMatcher(matcherName, info, matcher, actual, args, promise, title);
13338
13373
  const result = step ? currentZone().with("stepZone", step).run(invoke) : invoke();
13339
13374
  if (result instanceof Promise)
13340
13375
  return result.then(finalizer, handleError);
@@ -13343,7 +13378,7 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
13343
13378
  handleError(error);
13344
13379
  }
13345
13380
  }
13346
- function invokeMatcher(matcherName, info, matcher, actual, args, promise) {
13381
+ function invokeMatcher(matcherName, info, matcher, actual, args, promise, title) {
13347
13382
  const isNot = !!info.isNot;
13348
13383
  const timeout = info.timeout ?? expectConfig().timeout ?? defaultExpectTimeout;
13349
13384
  const matcherContext = {
@@ -13352,6 +13387,7 @@ function invokeMatcher(matcherName, info, matcher, actual, args, promise) {
13352
13387
  promise: promise ?? "",
13353
13388
  utils,
13354
13389
  timeout,
13390
+ title,
13355
13391
  equals: throwUnsupportedExpectMatcherError
13356
13392
  };
13357
13393
  if (!promise)
@@ -24,7 +24,7 @@ The following npm packages are inlined into this bundle.
24
24
  - jest-util@30.4.1 (https://github.com/jestjs/jest)
25
25
  - js-tokens@4.0.0 (https://github.com/lydell/js-tokens)
26
26
  - picocolors@1.1.1 (https://github.com/alexeyraspopov/picocolors)
27
- - picomatch@4.0.4 (https://github.com/micromatch/picomatch)
27
+ - picomatch@4.0.7 (https://github.com/micromatch/picomatch)
28
28
  - pretty-format@30.4.1 (https://github.com/jestjs/jest)
29
29
  - react-is@18.3.1 (https://github.com/facebook/react)
30
30
  - react-is@19.2.7 (https://github.com/facebook/react)
@@ -475,7 +475,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
475
475
  =========================================
476
476
  END OF picocolors@1.1.1 NOTICES AND INFORMATION
477
477
 
478
- %% picomatch@4.0.4 NOTICES AND INFORMATION BEGIN HERE
478
+ %% picomatch@4.0.7 NOTICES AND INFORMATION BEGIN HERE
479
479
  =========================================
480
480
  The MIT License (MIT)
481
481
 
@@ -499,7 +499,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
499
499
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
500
500
  THE SOFTWARE.
501
501
  =========================================
502
- END OF picomatch@4.0.4 NOTICES AND INFORMATION
502
+ END OF picomatch@4.0.7 NOTICES AND INFORMATION
503
503
 
504
504
  %% pretty-format@30.4.1 NOTICES AND INFORMATION BEGIN HERE
505
505
  =========================================
@@ -1,5 +1,5 @@
1
1
  # packages/playwright/lib/matchers/expect.js
2
- # total: 533.4 KB
2
+ # total: 535.4 KB
3
3
 
4
4
  ## Inlined (59)
5
5
  7.9 KB node_modules/@babel/code-frame/lib/index.js
@@ -35,9 +35,9 @@
35
35
  3.1 KB node_modules/picocolors/picocolors.js
36
36
  0.5 KB node_modules/picomatch/index.js
37
37
  5.3 KB node_modules/picomatch/lib/constants.js
38
- 33.6 KB node_modules/picomatch/lib/parse.js
39
- 5.2 KB node_modules/picomatch/lib/picomatch.js
40
- 9.5 KB node_modules/picomatch/lib/scan.js
38
+ 34.3 KB node_modules/picomatch/lib/parse.js
39
+ 5.3 KB node_modules/picomatch/lib/picomatch.js
40
+ 9.8 KB node_modules/picomatch/lib/scan.js
41
41
  2.3 KB node_modules/picomatch/lib/utils.js
42
42
  42.0 KB node_modules/pretty-format/build/index.js
43
43
  4.4 KB node_modules/pretty-format/node_modules/ansi-styles/index.js
@@ -52,14 +52,14 @@
52
52
  0.4 KB node_modules/stack-utils/node_modules/escape-string-regexp/index.js
53
53
  3.1 KB node_modules/supports-color/index.js
54
54
  10.3 KB packages/playwright/src/matchers/expect.ts
55
- 45.2 KB packages/playwright/src/matchers/expectLibrary.ts
55
+ 45.3 KB packages/playwright/src/matchers/expectLibrary.ts
56
56
  3.3 KB packages/playwright/src/matchers/matcherHint.ts
57
- 16.8 KB packages/playwright/src/matchers/matchers.ts
57
+ 17.4 KB packages/playwright/src/matchers/matchers.ts
58
58
  1.3 KB packages/playwright/src/matchers/toBeTruthy.ts
59
59
  2.1 KB packages/playwright/src/matchers/toEqual.ts
60
60
  2.9 KB packages/playwright/src/matchers/toHaveURL.ts
61
- 5.7 KB packages/playwright/src/matchers/toMatchAriaSnapshot.ts
62
- 15.3 KB packages/playwright/src/matchers/toMatchSnapshot.ts
61
+ 5.9 KB packages/playwright/src/matchers/toMatchAriaSnapshot.ts
62
+ 15.4 KB packages/playwright/src/matchers/toMatchSnapshot.ts
63
63
  3.0 KB packages/playwright/src/matchers/toMatchText.ts
64
64
 
65
65
  ## External (2)