@nextclaw/x-harness 0.2.41 → 0.2.42

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/SOURCE.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Corresponding source
2
2
 
3
- Version 0.2.41, commit abb1997d1e0d7208ed22a5b47d36c9b7dc3b6832.
3
+ Version 0.2.42, commit 56272553b4ce936e466e3139f56f1adbde4a353c.
4
4
 
5
- Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/abb1997d1e0d7208ed22a5b47d36c9b7dc3b6832
5
+ Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/56272553b4ce936e466e3139f56f1adbde4a353c
6
6
 
7
7
  Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
8
8
 
@@ -126,6 +126,14 @@ export class DOMCapabilities {
126
126
  "first",
127
127
  "waitFor",
128
128
  ]));
129
+ if (operation === "readBookmarks" &&
130
+ typeof this.#tab?.playwright?.locator === "function")
131
+ base.push(...missingMethods(this.#tab.playwright.locator("div"), [
132
+ "locator",
133
+ "filter",
134
+ "first",
135
+ "waitFor",
136
+ ]));
129
137
  if (operation !== "readFeedback") {
130
138
  base.push(...missingMethods(this.#tab?.playwright, [
131
139
  "getByRole",
@@ -64,6 +64,22 @@ export class DOMNavigation {
64
64
  return;
65
65
  }
66
66
  async handleWaitForFolder(command) {
67
+ if (command.folderDiscovery) {
68
+ // "All bookmarks" renders before the asynchronously loaded named cards.
69
+ // Wait for any named card inside that specific menu, never an unrelated
70
+ // dialog or arbitrary first clickable control.
71
+ const menu = this.#tab.playwright
72
+ .locator('[role="dialog"],[data-testid="Dropdown"]')
73
+ .filter({ hasText: command.folder });
74
+ await menu
75
+ .locator("span:not(:has(span))", {})
76
+ .filter({
77
+ hasText: /^(?!书签$|Bookmarks$|所有书签$|All bookmarks$).+$/i,
78
+ })
79
+ .first()
80
+ .waitFor({ state: "visible", timeoutMs: 2000 });
81
+ return;
82
+ }
67
83
  await this.#tab.playwright
68
84
  .getByText(command.folder, { exact: true })
69
85
  .waitFor({ state: "visible", timeoutMs: 2000 });
@@ -240,7 +240,7 @@ export class PlatformCollections {
240
240
  }
241
241
  if (discoverOnly) {
242
242
  if (!nav.bookmarkFolders?.length) {
243
- await this.waitForBookmarkLabel(nav, "所有书签", "All bookmarks");
243
+ await this.waitForBookmarkLabel(nav, "所有书签", "All bookmarks", true);
244
244
  nav = await this.#ready({
245
245
  view: "navigation",
246
246
  bookmarkNavigation: true,
@@ -250,7 +250,10 @@ export class PlatformCollections {
250
250
  }
251
251
  if (!(nav.controls ?? []).some((c) => c.label.split("\n")[0] === folder)) {
252
252
  try {
253
- await this.#browser.act({ operation: "waitForFolder", folder });
253
+ await this.#browser.act({
254
+ operation: "waitForFolder",
255
+ folder,
256
+ });
254
257
  }
255
258
  catch (error) {
256
259
  if (!/timed out|timeout/i.test(error.message))
@@ -304,12 +307,16 @@ export class PlatformCollections {
304
307
  missing: folders.length ? [] : ["bookmark-folder-menu-unconfirmed"],
305
308
  };
306
309
  }
307
- async waitForBookmarkLabel(nav, chinese, english) {
310
+ async waitForBookmarkLabel(nav, chinese, english, folderDiscovery = false) {
308
311
  const folder = (nav.controls ?? []).some((c) => /^(History|Bookmarks)$/i.test(c.label))
309
312
  ? english
310
313
  : chinese;
311
314
  try {
312
- await this.#browser.act({ operation: "waitForFolder", folder });
315
+ await this.#browser.act({
316
+ operation: "waitForFolder",
317
+ folder,
318
+ folderDiscovery,
319
+ });
313
320
  }
314
321
  catch (error) {
315
322
  if (!/timed out|timeout/i.test(error.message))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/x-harness",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "type": "module",
5
5
  "description": "Typed X task harness with compact business results and explicit diagnostics.",
6
6
  "main": "./dist/index.js",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "abb1997d1e0d7208ed22a5b47d36c9b7dc3b6832"
45
+ "gitHead": "56272553b4ce936e466e3139f56f1adbde4a353c"
46
46
  }