@smoothdeploy/playwright 1.62.0 → 1.62.1-beta-1790342324000

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.
@@ -793,16 +793,13 @@ function loadTsConfig(configPath) {
793
793
  ${e.message}`);
794
794
  }
795
795
  }
796
- function resolveConfigFile(baseConfigFile, referencedConfigFile, kind) {
797
- const originalReferencedConfigFile = referencedConfigFile;
796
+ function resolveConfigFile(baseConfigFile, referencedConfigFile) {
798
797
  if (!referencedConfigFile.endsWith(".json"))
799
798
  referencedConfigFile += ".json";
800
799
  const currentDir = import_path4.default.dirname(baseConfigFile);
801
800
  let resolvedConfigFile = import_path4.default.resolve(currentDir, referencedConfigFile);
802
801
  if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs4.default.existsSync(resolvedConfigFile))
803
802
  resolvedConfigFile = import_path4.default.join(currentDir, "node_modules", referencedConfigFile);
804
- if (!import_fs4.default.existsSync(resolvedConfigFile))
805
- throw new Error(`Failed to resolve "${kind}" path "${originalReferencedConfigFile}" referenced from ${baseConfigFile}`);
806
803
  return resolvedConfigFile;
807
804
  }
808
805
  function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
@@ -819,7 +816,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
819
816
  const parsedConfig = json5.parse(cleanedJson);
820
817
  const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
821
818
  for (const extendedConfig of extendsArray) {
822
- const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig, "extends");
819
+ const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
823
820
  const base = innerLoadTsConfig(extendedConfigPath, references, visited);
824
821
  Object.assign(result2, base, { tsConfigPath: configFilePath });
825
822
  }
@@ -835,7 +832,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
835
832
  result2.absoluteBaseUrl = import_path4.default.resolve(import_path4.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
836
833
  }
837
834
  for (const ref of parsedConfig.references || [])
838
- references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path, "references"), references, visited));
835
+ references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
839
836
  if (import_path4.default.basename(configFilePath) === "jsconfig.json" && result2.allowJs === void 0)
840
837
  result2.allowJs = true;
841
838
  return result2;
@@ -1,5 +1,5 @@
1
1
  # packages/playwright/lib/common/index.js
2
- # total: 114.5 KB
2
+ # total: 114.2 KB
3
3
 
4
4
  ## Inlined (20)
5
5
  12.0 KB packages/playwright/src/common/config.ts
@@ -20,7 +20,7 @@
20
20
  1.1 KB packages/playwright/src/transform/pirates.ts
21
21
  1.1 KB packages/playwright/src/transform/portTransport.ts
22
22
  12.3 KB packages/playwright/src/transform/transform.ts
23
- 3.2 KB packages/playwright/src/transform/tsconfig-loader.ts
23
+ 2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
24
24
  7.0 KB packages/playwright/src/util.ts
25
25
 
26
26
  ## External (8)
package/lib/index.js CHANGED
@@ -109,6 +109,7 @@ const utilityFixtures = {
109
109
  category: "pw:api",
110
110
  title: renderTitle(channel.type, channel.method, channel.params, data.title),
111
111
  apiName: data.apiName,
112
+ channelMethod: `${channel.type}.${channel.method}`,
112
113
  params: channel.params,
113
114
  group: getActionGroup({ type: channel.type, method: channel.method })
114
115
  }, tracingGroupSteps[tracingGroupSteps.length - 1]);
@@ -4891,26 +4891,124 @@ var listModeReporter_default = ListModeReporter;
4891
4891
  // packages/playwright/src/reporters/smoothdeploy.ts
4892
4892
  var fs9 = __toESM(require("fs"));
4893
4893
  var path12 = __toESM(require("path"));
4894
+
4895
+ // packages/playwright/src/reporters/smoothdeployMatch.ts
4896
+ var ACTION_API = {
4897
+ navigate: ["Frame.goto"],
4898
+ click: ["Frame.click", "Frame.dblclick", "Frame.dispatchEvent"],
4899
+ fill: ["Frame.fill"],
4900
+ press: ["Frame.press"],
4901
+ hover: ["Frame.hover"],
4902
+ check: ["Frame.check"],
4903
+ uncheck: ["Frame.uncheck"],
4904
+ select: ["Frame.selectOption"],
4905
+ setInputFiles: ["Frame.setInputFiles", "ElementHandle.setInputFiles"],
4906
+ openPage: ["BrowserContext.newPage"],
4907
+ closePage: ["Page.close"],
4908
+ assertVisible: ["toBeVisible"],
4909
+ assertText: ["toContainText", "toHaveText"],
4910
+ assertValue: ["toHaveValue", "toBeEmpty"],
4911
+ assertChecked: ["toBeChecked", "not.toBeChecked"],
4912
+ assertSnapshot: ["toHaveScreenshot", "toMatchAriaSnapshot"]
4913
+ };
4914
+ var FILLER_API_NEVER_SKIPS_AHEAD = /* @__PURE__ */ new Set(["Frame.dispatchEvent"]);
4915
+ function stepApi(step) {
4916
+ if (step.category === "pw:api")
4917
+ return step.channelMethod ?? null;
4918
+ return normalizeApiName(step.apiName);
4919
+ }
4920
+ function shortApi(step) {
4921
+ const api = stepApi(step);
4922
+ if (!api)
4923
+ return null;
4924
+ const idx = api.lastIndexOf(".");
4925
+ return step.category === "pw:api" && idx >= 0 ? api.slice(idx + 1) : api;
4926
+ }
4927
+ function normalizeApiName(apiName) {
4928
+ if (!apiName)
4929
+ return null;
4930
+ if (apiName.startsWith("expect")) {
4931
+ if (apiName.includes(".poll") || apiName.includes(".soft"))
4932
+ return null;
4933
+ const matcher = apiName.slice("expect".length).replace(/^\./, "");
4934
+ return matcher || null;
4935
+ }
4936
+ const idx = apiName.lastIndexOf(".");
4937
+ return idx >= 0 ? apiName.slice(idx + 1) : apiName;
4938
+ }
4939
+ function apiMatches(step, expected) {
4940
+ const api = stepApi(step);
4941
+ if (!api)
4942
+ return false;
4943
+ const allowed = ACTION_API[expected.action];
4944
+ return !!allowed && allowed.includes(api);
4945
+ }
4946
+ function groupMatches(step, expected) {
4947
+ if (expected.title !== void 0)
4948
+ return step.title === expected.title;
4949
+ return expected.action === "group";
4950
+ }
4951
+ function stepMatches(step, expected) {
4952
+ if (step.category === "test.step")
4953
+ return groupMatches(step, expected);
4954
+ if (step.category === "pw:api" || step.category === "expect")
4955
+ return apiMatches(step, expected);
4956
+ return false;
4957
+ }
4958
+ function matchStep(step, siblings, cursor) {
4959
+ if (cursor < siblings.length && stepMatches(step, siblings[cursor]))
4960
+ return cursor;
4961
+ const api = stepApi(step);
4962
+ const canLookAhead = step.category === "test.step" ? siblings.some((s) => s.title !== void 0) : !!api && !FILLER_API_NEVER_SKIPS_AHEAD.has(api);
4963
+ if (!canLookAhead)
4964
+ return -1;
4965
+ for (let j = cursor + 1; j < siblings.length; j++) {
4966
+ if (stepMatches(step, siblings[j]))
4967
+ return j;
4968
+ }
4969
+ return -1;
4970
+ }
4971
+ var INTERNAL_STEP_TITLES = /* @__PURE__ */ new Set([
4972
+ "Before Hooks",
4973
+ "After Hooks",
4974
+ "Worker Cleanup",
4975
+ "Launch browser",
4976
+ "Launch persistent context",
4977
+ "Connect over CDP",
4978
+ "Close browser",
4979
+ "Create context",
4980
+ "Close context",
4981
+ "Create page",
4982
+ "Close page",
4983
+ "Create CDP session"
4984
+ ]);
4985
+ function isToPassWrapper(step) {
4986
+ return normalizeApiName(step.apiName) === "toPass";
4987
+ }
4988
+ function isUserStep(step) {
4989
+ if (step.category === "hook" || step.category === "fixture" || step.category === "test.attach")
4990
+ return false;
4991
+ if (step.title.startsWith('Fixture "'))
4992
+ return false;
4993
+ return !INTERNAL_STEP_TITLES.has(step.title);
4994
+ }
4995
+
4996
+ // packages/playwright/src/reporters/smoothdeploy.ts
4997
+ var NO_SCREENSHOT_PREFIXES = ["Navigate", "Go back", "Go forward", "Reload", "Screenshot", "Wait for", "Pause", "Evaluate"];
4998
+ var safeId = (id) => id.replace(/[^a-zA-Z0-9_-]/g, "-");
4894
4999
  var SmoothDeployReporter = class {
4895
5000
  constructor() {
4896
5001
  this._configDir = "";
4897
5002
  this._manifest = null;
4898
- // Resolved manifest test + paramIndex for each active pw test
4899
5003
  this._resolvedTests = /* @__PURE__ */ new Map();
4900
- // Map pw TestStep → matched manifest step
4901
- this._stepToManifest = /* @__PURE__ */ new WeakMap();
4902
- // Child counter per parent (TestStep for nested, test.id string for root-level)
4903
- this._childCounters = /* @__PURE__ */ new Map();
4904
- // Accumulate nested step data per test for output manifest
5004
+ this._matched = /* @__PURE__ */ new WeakMap();
5005
+ this._opaqueFiller = /* @__PURE__ */ new WeakSet();
5006
+ this._retries = /* @__PURE__ */ new WeakMap();
5007
+ this._rootCursors = /* @__PURE__ */ new Map();
4905
5008
  this._testSteps = /* @__PURE__ */ new Map();
4906
- // Track parent step → output StepData for nesting output
4907
- this._stepToOutput = /* @__PURE__ */ new WeakMap();
4908
- // ID remap: pw IDs → manifest IDs (sanitized). Built during execution, applied in onEnd.
4909
5009
  this._testIdMap = /* @__PURE__ */ new Map();
4910
- // safePwTestId → safeManifestTestId
4911
5010
  this._stepIdMap = /* @__PURE__ */ new Map();
4912
5011
  }
4913
- // safePwStepId → safeManifestStepId
4914
5012
  version() {
4915
5013
  return "v2";
4916
5014
  }
@@ -4919,44 +5017,36 @@ var SmoothDeployReporter = class {
4919
5017
  }
4920
5018
  onConfigure(config2) {
4921
5019
  this._configDir = config2.configFile ? path12.dirname(config2.configFile) : config2.rootDir;
4922
- this._loadManifest();
4923
- }
4924
- _loadManifest() {
4925
5020
  const manifestPath = path12.join(this._configDir, ".smoothdeploy-manifest.json");
4926
- if (!fs9.existsSync(manifestPath))
4927
- throw new Error(`SmoothDeploy reporter requires .smoothdeploy-manifest.json in ${this._configDir}`);
4928
- const raw = fs9.readFileSync(manifestPath, "utf-8");
4929
- this._manifest = JSON.parse(raw);
5021
+ if (fs9.existsSync(manifestPath))
5022
+ this._manifest = JSON.parse(fs9.readFileSync(manifestPath, "utf-8"));
4930
5023
  }
4931
- _emit(event) {
4932
- process.stdout.write(`[SMOOTHDEPLOY_EVENT]${JSON.stringify(event)}
5024
+ _emit(event, step) {
5025
+ const retry = step && this._nearestRetry(step);
5026
+ if (retry)
5027
+ retry.events.push(event);
5028
+ else
5029
+ process.stdout.write(`[SMOOTHDEPLOY_EVENT]${JSON.stringify(event)}
4933
5030
  `);
4934
5031
  }
4935
- _isUserStep(step) {
4936
- const title = step.title;
4937
- if (title === "Before Hooks" || title === "After Hooks" || title === "Worker Cleanup")
4938
- return false;
4939
- if (title.startsWith('Fixture "'))
4940
- return false;
4941
- const internalSteps = [
4942
- "Launch browser",
4943
- "Launch persistent context",
4944
- "Connect over CDP",
4945
- "Close browser",
4946
- "Create context",
4947
- "Close context",
4948
- "Create page",
4949
- "Close page",
4950
- "Create CDP session"
4951
- ];
4952
- if (internalSteps.includes(title))
4953
- return false;
4954
- return true;
5032
+ _nearestRetry(step) {
5033
+ for (let p = step.parent; p; p = p.parent) {
5034
+ const retry = this._retries.get(p);
5035
+ if (retry)
5036
+ return retry;
5037
+ }
5038
+ return void 0;
4955
5039
  }
4956
- // Resolve a pw TestCase to its manifest test entry + param index.
4957
- // For parameterized tests: manifest title "Foo" with params=3 matches pw titles "Foo0", "Foo1", "Foo2".
4958
- // For non-parameterized tests: exact match, paramIndex=0.
4959
5040
  _resolveManifestTest(test) {
5041
+ const manifestTest = this._findManifestTest(test);
5042
+ if (!manifestTest)
5043
+ return { manifestTest: { id: test.id, title: test.title, steps: [] }, paramIndex: 0, passthrough: true };
5044
+ const single = manifestTest.manifestTest.steps.length === 1 ? manifestTest.manifestTest.steps[0] : void 0;
5045
+ if (single && single.action === "script")
5046
+ return { ...manifestTest, passthrough: true, passthroughRootId: single.id };
5047
+ return { ...manifestTest, passthrough: false };
5048
+ }
5049
+ _findManifestTest(test) {
4960
5050
  if (!this._manifest)
4961
5051
  return null;
4962
5052
  const titlePath = test.titlePath();
@@ -4966,7 +5056,6 @@ var SmoothDeployReporter = class {
4966
5056
  return null;
4967
5057
  const fileIdx = titlePath.indexOf(relFile);
4968
5058
  const describeTitles = fileIdx >= 0 ? titlePath.slice(fileIdx + 1, -1) : [];
4969
- const testTitle = test.title;
4970
5059
  let currentSuites = fileManifest.suites;
4971
5060
  let currentTests = fileManifest.tests;
4972
5061
  for (const desc of describeTitles) {
@@ -4976,15 +5065,13 @@ var SmoothDeployReporter = class {
4976
5065
  currentSuites = suite.suites;
4977
5066
  currentTests = suite.tests;
4978
5067
  }
4979
- const exactMatch = currentTests.find((t2) => t2.title === testTitle);
5068
+ const exactMatch = currentTests.find((t2) => t2.title === test.title);
4980
5069
  if (exactMatch)
4981
5070
  return { manifestTest: exactMatch, paramIndex: 0 };
4982
5071
  for (const mt of currentTests) {
4983
- if (!mt.params || mt.params < 1)
4984
- continue;
4985
- if (!testTitle.startsWith(mt.title))
5072
+ if (!mt.params || mt.params < 1 || !test.title.startsWith(mt.title))
4986
5073
  continue;
4987
- const suffix = testTitle.slice(mt.title.length);
5074
+ const suffix = test.title.slice(mt.title.length);
4988
5075
  const idx = parseInt(suffix, 10);
4989
5076
  if (String(idx) === suffix && idx >= 0 && idx < mt.params)
4990
5077
  return { manifestTest: mt, paramIndex: idx };
@@ -4993,13 +5080,9 @@ var SmoothDeployReporter = class {
4993
5080
  }
4994
5081
  onTestBegin(test, result) {
4995
5082
  const resolved = this._resolveManifestTest(test);
4996
- if (!resolved)
4997
- return;
4998
5083
  this._resolvedTests.set(test.id, resolved);
4999
- const safePw = test.id.replace(/[^a-zA-Z0-9_-]/g, "-");
5000
- const safeManifest = resolved.manifestTest.id.replace(/[^a-zA-Z0-9_-]/g, "-");
5001
- this._testIdMap.set(safePw, safeManifest);
5002
- this._childCounters.set(test.id, 0);
5084
+ this._testIdMap.set(safeId(test.id), safeId(resolved.manifestTest.id));
5085
+ this._rootCursors.set(test.id, 0);
5003
5086
  this._testSteps.set(test.id, []);
5004
5087
  this._emit({
5005
5088
  event: "testBegin",
@@ -5008,11 +5091,36 @@ var SmoothDeployReporter = class {
5008
5091
  testTitle: test.title,
5009
5092
  timestamp: Date.now()
5010
5093
  });
5094
+ if (resolved.passthroughRootId) {
5095
+ this._emit({
5096
+ event: "stepBegin",
5097
+ testId: resolved.manifestTest.id,
5098
+ paramIndex: resolved.paramIndex,
5099
+ id: resolved.passthroughRootId,
5100
+ action: "script",
5101
+ title: test.title,
5102
+ category: "test.step",
5103
+ timestamp: Date.now()
5104
+ });
5105
+ }
5011
5106
  }
5012
5107
  onTestEnd(test, result) {
5013
5108
  const resolved = this._resolvedTests.get(test.id);
5014
5109
  if (!resolved)
5015
5110
  return;
5111
+ if (resolved.passthroughRootId) {
5112
+ this._emit({
5113
+ event: "stepEnd",
5114
+ testId: resolved.manifestTest.id,
5115
+ paramIndex: resolved.paramIndex,
5116
+ id: resolved.passthroughRootId,
5117
+ action: "script",
5118
+ title: test.title,
5119
+ duration: result.duration,
5120
+ error: result.error ? { message: result.error.message } : null,
5121
+ timestamp: Date.now()
5122
+ });
5123
+ }
5016
5124
  this._emit({
5017
5125
  event: "testEnd",
5018
5126
  testId: resolved.manifestTest.id,
@@ -5022,29 +5130,77 @@ var SmoothDeployReporter = class {
5022
5130
  duration: result.duration,
5023
5131
  timestamp: Date.now()
5024
5132
  });
5025
- this._childCounters.delete(test.id);
5133
+ this._rootCursors.delete(test.id);
5134
+ }
5135
+ _nearestMatchedAncestor(step) {
5136
+ for (let p = step.parent; p; p = p.parent) {
5137
+ const matched = this._matched.get(p);
5138
+ if (matched)
5139
+ return { matched, blocked: false };
5140
+ if (this._opaqueFiller.has(p))
5141
+ return { blocked: true };
5142
+ }
5143
+ return { blocked: false };
5144
+ }
5145
+ _resolveStep(test, resolved, step, parent) {
5146
+ const stepLike = { title: step.title, category: step.category, apiName: step._apiName, channelMethod: step._channelMethod };
5147
+ if (resolved.passthrough) {
5148
+ const index2 = parent ? parent.cursor : this._rootCursors.get(test.id) ?? 0;
5149
+ const prefix = parent ? `${parent.manifest.id}:` : resolved.passthroughRootId ? `${resolved.passthroughRootId}:` : "";
5150
+ if (parent)
5151
+ parent.cursor = index2 + 1;
5152
+ else
5153
+ this._rootCursors.set(test.id, index2 + 1);
5154
+ const action = step.category === "test.step" ? "group" : shortApi(stepLike) ?? step.category;
5155
+ return { id: `${prefix}${index2}`, action, title: step.title, children: [] };
5156
+ }
5157
+ if (parent && parent.manifest.children.length === 0)
5158
+ return null;
5159
+ const siblings = parent ? parent.manifest.children : resolved.manifestTest.steps;
5160
+ const cursor = parent ? parent.cursor : this._rootCursors.get(test.id) ?? 0;
5161
+ let index = matchStep(stepLike, siblings, cursor);
5162
+ const retry = this._nearestRetry(step);
5163
+ if (index < 0 && retry && retry.parent === parent && cursor > retry.startCursor) {
5164
+ index = matchStep(stepLike, siblings.slice(0, cursor), retry.startCursor);
5165
+ if (index >= 0)
5166
+ this._discardAttempt(test, retry);
5167
+ }
5168
+ if (index < 0)
5169
+ return null;
5170
+ if (parent)
5171
+ parent.cursor = index + 1;
5172
+ else
5173
+ this._rootCursors.set(test.id, index + 1);
5174
+ return siblings[index];
5175
+ }
5176
+ _discardAttempt(test, retry) {
5177
+ const list = retry.parent ? retry.parent.output.children : this._testSteps.get(test.id);
5178
+ for (const output of retry.outputs) {
5179
+ const i = list ? list.indexOf(output) : -1;
5180
+ if (i >= 0)
5181
+ list.splice(i, 1);
5182
+ }
5183
+ retry.outputs = [];
5184
+ retry.events = [];
5026
5185
  }
5027
5186
  onStepBegin(test, result, step) {
5028
- if (!this._isUserStep(step))
5187
+ if (!isUserStep(step))
5029
5188
  return;
5030
5189
  const resolved = this._resolvedTests.get(test.id);
5031
5190
  if (!resolved)
5032
5191
  return;
5033
- let parentStep = step.parent;
5034
- while (parentStep && !this._stepToOutput.has(parentStep))
5035
- parentStep = parentStep.parent;
5036
- const parentKey = parentStep ?? test.id;
5037
- const parentManifest = parentStep ? this._stepToManifest.get(parentStep) : void 0;
5038
- const parentSteps = parentManifest ? parentManifest.children : resolved.manifestTest.steps;
5039
- const idx = this._childCounters.get(parentKey) ?? 0;
5040
- this._childCounters.set(parentKey, idx + 1);
5041
- const manifestStep = parentSteps?.[idx] ?? null;
5042
- if (manifestStep)
5043
- this._stepToManifest.set(step, manifestStep);
5044
- this._childCounters.set(step, 0);
5045
- const outputStep = {
5046
- id: manifestStep?.id,
5047
- action: manifestStep?.action,
5192
+ const { matched: parent, blocked } = this._nearestMatchedAncestor(step);
5193
+ const manifestStep = blocked ? null : this._resolveStep(test, resolved, step, parent);
5194
+ if (!manifestStep) {
5195
+ if (blocked || !isToPassWrapper({ title: step.title, category: step.category, apiName: step._apiName }))
5196
+ this._opaqueFiller.add(step);
5197
+ else
5198
+ this._retries.set(step, { parent, startCursor: parent ? parent.cursor : this._rootCursors.get(test.id) ?? 0, events: [], outputs: [] });
5199
+ return;
5200
+ }
5201
+ const output = {
5202
+ id: manifestStep.id,
5203
+ action: manifestStep.action,
5048
5204
  title: step.title,
5049
5205
  category: step.category,
5050
5206
  duration: 0,
@@ -5052,97 +5208,106 @@ var SmoothDeployReporter = class {
5052
5208
  screenshots: null,
5053
5209
  children: []
5054
5210
  };
5055
- this._stepToOutput.set(step, outputStep);
5056
- const parentOutput = parentStep ? this._stepToOutput.get(parentStep) : void 0;
5057
- if (parentOutput)
5058
- parentOutput.children.push(outputStep);
5211
+ this._matched.set(step, { manifest: manifestStep, output, cursor: 0 });
5212
+ const retry = this._nearestRetry(step);
5213
+ if (retry && retry.parent === parent)
5214
+ retry.outputs.push(output);
5215
+ if (parent)
5216
+ parent.output.children.push(output);
5059
5217
  else
5060
- this._testSteps.get(test.id)?.push(outputStep);
5218
+ this._testSteps.get(test.id)?.push(output);
5061
5219
  this._emit({
5062
5220
  event: "stepBegin",
5063
5221
  testId: resolved.manifestTest.id,
5064
5222
  paramIndex: resolved.paramIndex,
5065
- id: manifestStep?.id,
5066
- action: manifestStep?.action,
5223
+ id: manifestStep.id,
5224
+ action: manifestStep.action,
5067
5225
  title: step.title,
5068
5226
  category: step.category,
5069
5227
  timestamp: Date.now()
5070
- });
5228
+ }, step);
5229
+ }
5230
+ _screenshotsFor(test, step) {
5231
+ const hasScreenshot = step.category === "pw:api" && !NO_SCREENSHOT_PREFIXES.some((prefix) => step.title.startsWith(prefix));
5232
+ if (!hasScreenshot)
5233
+ return null;
5234
+ const safeStepId = safeId(step._stepId ?? step.title);
5235
+ return {
5236
+ safeStepId,
5237
+ paths: {
5238
+ page: `.smoothdeploy-output/screenshots/${safeId(test.id)}/${safeStepId}-page.png`,
5239
+ element: `.smoothdeploy-output/screenshots/${safeId(test.id)}/${safeStepId}-element.png`
5240
+ }
5241
+ };
5071
5242
  }
5072
5243
  onStepEnd(test, result, step) {
5073
- if (!this._isUserStep(step))
5244
+ if (!isUserStep(step))
5074
5245
  return;
5075
5246
  const resolved = this._resolvedTests.get(test.id);
5076
5247
  if (!resolved)
5077
5248
  return;
5078
- const manifestStep = this._stepToManifest.get(step) ?? null;
5079
- const outputStep = this._stepToOutput.get(step);
5080
- const safeTestId = test.id.replace(/[^a-zA-Z0-9_-]/g, "-");
5081
- const noScreenshotPrefixes = [
5082
- "Navigate",
5083
- "Go back",
5084
- "Go forward",
5085
- "Reload",
5086
- "Screenshot",
5087
- "Wait for",
5088
- "Pause",
5089
- "Evaluate"
5090
- ];
5091
- const hasScreenshot = step.category === "pw:api" && !noScreenshotPrefixes.some((prefix) => step.title.startsWith(prefix));
5092
- const internalStepId = step._stepId ?? step.title;
5093
- const safeStepId = internalStepId.replace(/[^a-zA-Z0-9_-]/g, "-");
5094
- const screenshots = hasScreenshot ? {
5095
- page: `.smoothdeploy-output/screenshots/${safeTestId}/${safeStepId}-page.png`,
5096
- element: `.smoothdeploy-output/screenshots/${safeTestId}/${safeStepId}-element.png`
5097
- } : null;
5098
- if (manifestStep) {
5099
- const safeManifestStepId = manifestStep.id.replace(/[^a-zA-Z0-9_-]/g, "-");
5100
- this._stepIdMap.set(safeStepId, safeManifestStepId);
5101
- }
5102
- if (outputStep) {
5103
- outputStep.duration = step.duration;
5104
- const hasDescendantError = (steps) => steps.some((c) => c.error !== null || hasDescendantError(c.children));
5105
- outputStep.error = step.error && !hasDescendantError(outputStep.children) ? { message: step.error.message ?? "" } : null;
5106
- outputStep.screenshots = screenshots;
5107
- }
5108
- this._childCounters.delete(step);
5249
+ const retry = this._retries.get(step);
5250
+ if (retry) {
5251
+ this._retries.delete(step);
5252
+ for (const event of retry.events)
5253
+ this._emit(event, step);
5254
+ return;
5255
+ }
5256
+ const matched = this._matched.get(step);
5257
+ const screenshots = this._screenshotsFor(test, step);
5258
+ if (!matched) {
5259
+ const leaf = this._nearestMatchedAncestor(step).matched;
5260
+ if (screenshots && leaf && leaf.manifest.children.length === 0 && !leaf.output.screenshots) {
5261
+ this._stepIdMap.set(screenshots.safeStepId, safeId(leaf.manifest.id));
5262
+ leaf.output.screenshots = screenshots.paths;
5263
+ }
5264
+ return;
5265
+ }
5266
+ if (screenshots) {
5267
+ this._stepIdMap.set(screenshots.safeStepId, safeId(matched.manifest.id));
5268
+ matched.output.screenshots = screenshots.paths;
5269
+ }
5270
+ matched.output.duration = step.duration;
5271
+ const skipped = step.annotations.some((a) => a.type === "skip");
5272
+ if (skipped)
5273
+ matched.output.skipped = true;
5274
+ const hasDescendantError = (steps) => steps.some((c) => c.error !== null || hasDescendantError(c.children));
5275
+ matched.output.error = step.error && !hasDescendantError(matched.output.children) ? { message: step.error.message ?? "" } : null;
5109
5276
  this._emit({
5110
5277
  event: "stepEnd",
5111
5278
  testId: resolved.manifestTest.id,
5112
5279
  paramIndex: resolved.paramIndex,
5113
- id: manifestStep?.id,
5114
- action: manifestStep?.action,
5280
+ id: matched.manifest.id,
5281
+ action: matched.manifest.action,
5115
5282
  title: step.title,
5116
5283
  duration: step.duration,
5117
5284
  error: step.error ? { message: step.error.message } : null,
5285
+ skipped,
5118
5286
  timestamp: Date.now()
5119
- });
5287
+ }, step);
5120
5288
  }
5121
5289
  onEnd(result) {
5122
5290
  const outputDir = path12.join(process.cwd(), ".smoothdeploy-output");
5123
5291
  const screenshotsDir = path12.join(outputDir, "screenshots");
5124
- if (this._manifest) {
5125
- for (const [safePwTestId] of this._testIdMap) {
5126
- const testDir = path12.join(screenshotsDir, safePwTestId);
5127
- if (!fs9.existsSync(testDir))
5128
- continue;
5129
- for (const [safePwStepId, safeManifestStepId] of this._stepIdMap) {
5130
- for (const suffix of ["-page.png", "-element.png"]) {
5131
- const src = path12.join(testDir, `${safePwStepId}${suffix}`);
5132
- const dst = path12.join(testDir, `${safeManifestStepId}${suffix}`);
5133
- if (fs9.existsSync(src))
5134
- fs9.renameSync(src, dst);
5135
- }
5292
+ for (const [safePwTestId] of this._testIdMap) {
5293
+ const testDir = path12.join(screenshotsDir, safePwTestId);
5294
+ if (!fs9.existsSync(testDir))
5295
+ continue;
5296
+ for (const [safePwStepId, safeManifestStepId] of this._stepIdMap) {
5297
+ for (const suffix of ["-page.png", "-element.png"]) {
5298
+ const src = path12.join(testDir, `${safePwStepId}${suffix}`);
5299
+ if (fs9.existsSync(src))
5300
+ fs9.renameSync(src, path12.join(testDir, `${safeManifestStepId}${suffix}`));
5136
5301
  }
5137
5302
  }
5138
- for (const [safePwTestId, safeManifestTestId] of this._testIdMap) {
5139
- const src = path12.join(screenshotsDir, safePwTestId);
5140
- const dst = path12.join(screenshotsDir, safeManifestTestId);
5141
- if (fs9.existsSync(src)) {
5142
- if (fs9.existsSync(dst))
5143
- fs9.rmSync(dst, { recursive: true });
5144
- fs9.renameSync(src, dst);
5145
- }
5303
+ }
5304
+ for (const [safePwTestId, safeManifestTestId] of this._testIdMap) {
5305
+ const src = path12.join(screenshotsDir, safePwTestId);
5306
+ const dst = path12.join(screenshotsDir, safeManifestTestId);
5307
+ if (src !== dst && fs9.existsSync(src)) {
5308
+ if (fs9.existsSync(dst))
5309
+ fs9.rmSync(dst, { recursive: true });
5310
+ fs9.renameSync(src, dst);
5146
5311
  }
5147
5312
  }
5148
5313
  const remapScreenshotPaths = (steps) => {
@@ -5160,7 +5325,7 @@ var SmoothDeployReporter = class {
5160
5325
  if (!resolved)
5161
5326
  continue;
5162
5327
  remapScreenshotPaths(steps);
5163
- const safeManifestTestId = resolved.manifestTest.id.replace(/[^a-zA-Z0-9_-]/g, "-");
5328
+ const safeManifestTestId = safeId(resolved.manifestTest.id);
5164
5329
  const failurePath = path12.join(screenshotsDir, safeManifestTestId, "failure.png");
5165
5330
  const failureScreenshot = fs9.existsSync(failurePath) ? `.smoothdeploy-output/screenshots/${safeManifestTestId}/failure.png` : null;
5166
5331
  const key = resolved.manifestTest.id;
@@ -5169,15 +5334,8 @@ var SmoothDeployReporter = class {
5169
5334
  manifest[key].push({ paramIndex: resolved.paramIndex, steps, failureScreenshot });
5170
5335
  }
5171
5336
  fs9.mkdirSync(outputDir, { recursive: true });
5172
- fs9.writeFileSync(
5173
- path12.join(outputDir, "manifest.json"),
5174
- JSON.stringify(manifest, null, 2)
5175
- );
5176
- this._emit({
5177
- event: "runEnd",
5178
- status: result.status,
5179
- timestamp: Date.now()
5180
- });
5337
+ fs9.writeFileSync(path12.join(outputDir, "manifest.json"), JSON.stringify(manifest, null, 2));
5338
+ this._emit({ event: "runEnd", status: result.status, timestamp: Date.now() });
5181
5339
  }
5182
5340
  _remapPath(screenshotPath) {
5183
5341
  let result = screenshotPath;
@@ -5798,7 +5956,9 @@ var JobDispatcher = class {
5798
5956
  attachments: [],
5799
5957
  annotations: [],
5800
5958
  location: params.location,
5801
- _stepId: params.stepId
5959
+ _stepId: params.stepId,
5960
+ _apiName: params.apiName,
5961
+ _channelMethod: params.channelMethod
5802
5962
  };
5803
5963
  steps.set(params.stepId, step);
5804
5964
  (parentStep || result).steps.push(step);
@@ -1,7 +1,7 @@
1
1
  # packages/playwright/lib/runner/index.js
2
- # total: 308.7 KB
2
+ # total: 314.3 KB
3
3
 
4
- ## Inlined (47)
4
+ ## Inlined (48)
5
5
  1.3 KB packages/playwright/src/isomorphic/events.ts
6
6
  0.1 KB packages/playwright/src/isomorphic/folders.ts
7
7
  0.9 KB packages/playwright/src/isomorphic/stringInternPool.ts
@@ -26,9 +26,10 @@
26
26
  18.5 KB packages/playwright/src/reporters/merge.ts
27
27
  3.0 KB packages/playwright/src/reporters/multiplexer.ts
28
28
  2.1 KB packages/playwright/src/reporters/reporterV2.ts
29
- 11.0 KB packages/playwright/src/reporters/smoothdeploy.ts
29
+ 13.3 KB packages/playwright/src/reporters/smoothdeploy.ts
30
+ 3.1 KB packages/playwright/src/reporters/smoothdeployMatch.ts
30
31
  8.8 KB packages/playwright/src/reporters/teleEmitter.ts
31
- 20.0 KB packages/playwright/src/runner/dispatcher.ts
32
+ 20.1 KB packages/playwright/src/runner/dispatcher.ts
32
33
  1.5 KB packages/playwright/src/runner/fsWatcher.ts
33
34
  0.5 KB packages/playwright/src/runner/index.ts
34
35
  1.4 KB packages/playwright/src/runner/lastRun.ts
@@ -4414,16 +4414,13 @@ function loadTsConfig(configPath) {
4414
4414
  ${e.message}`);
4415
4415
  }
4416
4416
  }
4417
- function resolveConfigFile(baseConfigFile, referencedConfigFile, kind) {
4418
- const originalReferencedConfigFile = referencedConfigFile;
4417
+ function resolveConfigFile(baseConfigFile, referencedConfigFile) {
4419
4418
  if (!referencedConfigFile.endsWith(".json"))
4420
4419
  referencedConfigFile += ".json";
4421
4420
  const currentDir = import_path2.default.dirname(baseConfigFile);
4422
4421
  let resolvedConfigFile = import_path2.default.resolve(currentDir, referencedConfigFile);
4423
4422
  if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs2.default.existsSync(resolvedConfigFile))
4424
4423
  resolvedConfigFile = import_path2.default.join(currentDir, "node_modules", referencedConfigFile);
4425
- if (!import_fs2.default.existsSync(resolvedConfigFile))
4426
- throw new Error(`Failed to resolve "${kind}" path "${originalReferencedConfigFile}" referenced from ${baseConfigFile}`);
4427
4424
  return resolvedConfigFile;
4428
4425
  }
4429
4426
  function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
@@ -4440,7 +4437,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
4440
4437
  const parsedConfig = import_json5.default.parse(cleanedJson);
4441
4438
  const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
4442
4439
  for (const extendedConfig of extendsArray) {
4443
- const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig, "extends");
4440
+ const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
4444
4441
  const base = innerLoadTsConfig(extendedConfigPath, references, visited);
4445
4442
  Object.assign(result2, base, { tsConfigPath: configFilePath });
4446
4443
  }
@@ -4456,7 +4453,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
4456
4453
  result2.absoluteBaseUrl = import_path2.default.resolve(import_path2.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
4457
4454
  }
4458
4455
  for (const ref of parsedConfig.references || [])
4459
- references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path, "references"), references, visited));
4456
+ references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
4460
4457
  if (import_path2.default.basename(configFilePath) === "jsconfig.json" && result2.allowJs === void 0)
4461
4458
  result2.allowJs = true;
4462
4459
  return result2;
@@ -1,5 +1,5 @@
1
1
  # packages/playwright/lib/transform/esmLoader.js
2
- # total: 283.9 KB
2
+ # total: 283.6 KB
3
3
 
4
4
  ## Inlined (51)
5
5
  1.3 KB node_modules/balanced-match/dist/esm/index.js
@@ -47,7 +47,7 @@
47
47
  1.1 KB packages/playwright/src/transform/pirates.ts
48
48
  1.1 KB packages/playwright/src/transform/portTransport.ts
49
49
  11.7 KB packages/playwright/src/transform/transform.ts
50
- 3.2 KB packages/playwright/src/transform/tsconfig-loader.ts
50
+ 2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
51
51
  4.7 KB packages/playwright/src/util.ts
52
52
  0.2 KB packages/utils/crypto.ts
53
53
  0.1 KB packages/utils/debug.ts
@@ -1070,7 +1070,9 @@ ${stringifyStackFrames2(step.boxedStack).join("\n")}`;
1070
1070
  title: step.title,
1071
1071
  category: step.category,
1072
1072
  wallTime: Date.now(),
1073
- location: step.location
1073
+ location: step.location,
1074
+ apiName: step.apiName,
1075
+ channelMethod: step.channelMethod
1074
1076
  };
1075
1077
  this._callbacks.onStepBegin(payload);
1076
1078
  }
@@ -1,10 +1,10 @@
1
1
  # packages/playwright/lib/worker/workerProcessEntry.js
2
- # total: 73.9 KB
2
+ # total: 74.0 KB
3
3
 
4
4
  ## Inlined (8)
5
5
  3.7 KB packages/playwright/src/util.ts
6
6
  8.7 KB packages/playwright/src/worker/fixtureRunner.ts
7
- 21.1 KB packages/playwright/src/worker/testInfo.ts
7
+ 21.2 KB packages/playwright/src/worker/testInfo.ts
8
8
  11.7 KB packages/playwright/src/worker/testTracing.ts
9
9
  5.4 KB packages/playwright/src/worker/timeoutManager.ts
10
10
  0.3 KB packages/playwright/src/worker/util.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothdeploy/playwright",
3
- "version": "1.62.0",
3
+ "version": "1.62.1-beta-1790342324000",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "license": "Apache-2.0",
52
52
  "dependencies": {
53
- "playwright-core": "npm:@smoothdeploy/playwright-core@1.62.0"
53
+ "playwright-core": "npm:@smoothdeploy/playwright-core@1.62.1-beta-1790342324000"
54
54
  },
55
55
  "optionalDependencies": {
56
56
  "fsevents": "2.3.2"