@nextclaw/x-harness 0.2.50 → 0.2.51

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.50, commit 574f6379381dcf0bab9269f063474771df0067ee.
3
+ Version 0.2.51, commit 4fcb5b63209a99a05a176cc9a7242c1f7de614ea.
4
4
 
5
- Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/574f6379381dcf0bab9269f063474771df0067ee
5
+ Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/4fcb5b63209a99a05a176cc9a7242c1f7de614ea
6
6
 
7
7
  Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
8
8
 
@@ -26,6 +26,7 @@ export class DOMCapabilities {
26
26
  base.push(...missingMethods(this.#tab.playwright.locator("div"), [
27
27
  "filter",
28
28
  "count",
29
+ "nth",
29
30
  "click",
30
31
  "innerText",
31
32
  ]));
@@ -30,16 +30,23 @@ export class DOMNavigation {
30
30
  posts?.length !== 1 ||
31
31
  posts[0].quoteCards?.length !== 1 ||
32
32
  posts[0].quoteCards[0].text !== command.cardText)
33
- throw Error("unique-observed-quote-required");
33
+ throw Error(`unique-observed-quote-required:snapshot:${posts?.length ?? 0}:${posts?.[0]?.quoteCards?.length ?? 0}`);
34
34
  const article = this.#tab.playwright.getByRole("article").filter({
35
35
  has: this.#tab.playwright.locator(`a[href=${JSON.stringify(posts[0].primary)}]`),
36
36
  });
37
- const card = article
37
+ const cards = article
38
38
  .locator('[role="link"][tabindex="0"]')
39
- .filter({ visible: true, hasText: command.cardText });
40
- if ((await card.count()) !== 1 ||
41
- (await card.innerText()) !== command.cardText)
42
- throw Error("unique-observed-quote-required");
39
+ .filter({ visible: true });
40
+ const count = await cards.count();
41
+ const matches = [];
42
+ for (let i = 0; i < count; i++) {
43
+ const candidate = cards.nth(i);
44
+ if ((await candidate.innerText()) === command.cardText)
45
+ matches.push(candidate);
46
+ }
47
+ if (matches.length !== 1)
48
+ throw Error(`unique-observed-quote-required:controls:${count}:matches:${matches.length}`);
49
+ const card = matches[0];
43
50
  this.#session.current = null;
44
51
  await this.#tab.playwright.expectNavigation(() => card.click(), {
45
52
  waitUntil: "commit",
package/dist/browser.js CHANGED
@@ -138,7 +138,7 @@ export function readXSurface({ view, posts = [], targetId, replyTargetId, } = {}
138
138
  .querySelector?.("time")
139
139
  ?.getAttribute("datetime"),
140
140
  }))
141
- .filter((card) => card.text?.trim() && card.datetime)
141
+ .filter((card) => card.text?.trim())
142
142
  : [],
143
143
  };
144
144
  }),
@@ -640,7 +640,7 @@ export const readXObservation = (query) => {
640
640
  .querySelector?.("time")
641
641
  ?.getAttribute("datetime"),
642
642
  }))
643
- .filter((card) => card.text?.trim() && card.datetime)
643
+ .filter((card) => card.text?.trim())
644
644
  : [],
645
645
  };
646
646
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/x-harness",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
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": "574f6379381dcf0bab9269f063474771df0067ee"
45
+ "gitHead": "4fcb5b63209a99a05a176cc9a7242c1f7de614ea"
46
46
  }