@applitools/mcp 0.5.17 → 0.7.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.
- package/CHANGELOG.md +35 -0
- package/dist/docs/README.md +18 -0
- package/dist/docs/dom-search.md +164 -0
- package/dist/index.js +10773 -2480
- package/dist/index.js.map +1 -1
- package/docs/README.md +18 -0
- package/docs/dom-search.md +164 -0
- package/package.json +13 -4
package/docs/README.md
CHANGED
|
@@ -192,6 +192,24 @@ Retrieves structured visual test results, including:
|
|
|
192
192
|
### eyes_get_batch_url
|
|
193
193
|
Extracts and converts Eyes test result URLs from console output. Parses test execution output to find session URLs and converts them to batch URLs for viewing all test results together in the Eyes dashboard.
|
|
194
194
|
|
|
195
|
+
### Experimental tools
|
|
196
|
+
The inspection, resolution, and review tool families below are in a **closed beta for design partners** and are not available by default. If you are interested in trying them, [contact Applitools](https://help.applitools.com/hc/en-us/requests/new) to join the beta and receive the server configuration snippet.
|
|
197
|
+
|
|
198
|
+
For beta participants, these families replace the legacy results tools: `eyes_get_batch_url`, `eyes_fetch_visual_results`, and `eyes_analyze_batch` are not registered, and the setup tools' instructions describe the review flow instead.
|
|
199
|
+
|
|
200
|
+
### Inspection tools (eyes_inspect_*)
|
|
201
|
+
Read-only primitives for digging into an Eyes batch, session, or step: `eyes_inspect_sessions`, `eyes_inspect_steps`, `eyes_inspect_changed_areas`, `eyes_inspect_image_diff`, `eyes_inspect_image`, `eyes_inspect_dom`, `eyes_inspect_dom_search`, `eyes_inspect_dom_diff`, `eyes_inspect_regions`, `eyes_inspect_history`.
|
|
202
|
+
|
|
203
|
+
These require a read-only API key in the `APPLITOOLS_READ_KEY` environment variable (separate from `APPLITOOLS_API_KEY`, which is used for test execution).
|
|
204
|
+
|
|
205
|
+
### Resolution tools (eyes_resolve_*)
|
|
206
|
+
Accept or reject checkpoints, edit match regions (ignore/strict/layout/dynamic), and save or reset baselines: `eyes_resolve_checkpoint`, `eyes_resolve_regions`, `eyes_resolve_save`, `eyes_resolve_reset`.
|
|
207
|
+
|
|
208
|
+
These additionally require a write-capable API key in the `APPLITOOLS_WRITE_KEY` environment variable.
|
|
209
|
+
|
|
210
|
+
### Review tools (eyes_review_*)
|
|
211
|
+
Drive a complete, gated review of a batch, session, or step on top of the inspection and resolution tools: `eyes_review_progress`, `eyes_review_diff_report`, `eyes_review_end`. Start with `eyes_review_progress` — it tells the assistant exactly what to inspect next and, in resolve mode, acts on the findings.
|
|
212
|
+
|
|
195
213
|
## Getting started & Usage
|
|
196
214
|
Ask your AI assistant about Applitools:
|
|
197
215
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# dom-search predicate language
|
|
2
|
+
|
|
3
|
+
`dom-search` searches a DOM capture (the JSON produced by eyes-inspect's `dom` command) for elements matching a predicate, and prints one line per match — indented to show its depth in the tree.
|
|
4
|
+
|
|
5
|
+
Only real tag elements are matched; text and comment nodes are never matched directly. Every element also gets a virtual `text` property: the concatenation of its own direct text content. A matching element with non-empty text has that text appended to its output line after a `#`.
|
|
6
|
+
|
|
7
|
+
A predicate is one of seven kinds of check — a **property comparison**, a **bounds (geometry) check**, a **size comparison**, a **direction check**, a **relationship check**, an **attribute-presence check**, or a **shortcut keyword** — combined with `and`, `or`, `not`, and parentheses.
|
|
8
|
+
|
|
9
|
+
Several of these checks need to reference *another* element rather than the one being tested. Do that with `node <id>`, using the element's `id` field — e.g. `node 12`; it shows up in bounds checks, size comparisons, direction checks, and relationship checks below. Relationship checks additionally accept a sub-predicate in place of `node <id>`, describing the other element instead of naming its id — see "Checking relationships" below.
|
|
10
|
+
|
|
11
|
+
## Boolean combinations
|
|
12
|
+
|
|
13
|
+
Combine any predicates with `and`, `or`, `not` (or the symbols `&&`, `||`, `!`) and parentheses. `not` binds tighter than `and`, which binds tighter than `or` — same as most programming languages. Use parentheses to override that.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
image and gif
|
|
17
|
+
tagName = 'DIV' or tagName = 'SPAN'
|
|
18
|
+
not (tagName = 'SPAN')
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Comparing a property
|
|
22
|
+
|
|
23
|
+
Reference a property by its path — `tagName`, `attributes.class`, `attributes.data-testid`, `style.display`, `rect.width`, `rect.left`, or the virtual `text` property — and compare it to a value:
|
|
24
|
+
|
|
25
|
+
- **Equality**: `=` or `equals`, and `!=` or `not-equals`.
|
|
26
|
+
- **Ordering** (numeric — also handles CSS lengths like `"16px"`): `<`/`less-than`, `<=`/`less-than-or-equal`, `>`/`greater-than`, `>=`/`greater-than-or-equal`.
|
|
27
|
+
- **String matching**: `starts-with`, `ends-with`, `contains`.
|
|
28
|
+
- **Regex**: `matches`, `regex`, or `=~`, with the value written as `/pattern/flags`.
|
|
29
|
+
- **Membership**: `in`, with a parenthesized, comma-separated list of values.
|
|
30
|
+
|
|
31
|
+
String comparisons are case-insensitive. A property that doesn't exist on an element just fails to match — it never causes an error. Examples:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
tagName = 'DIV'
|
|
35
|
+
attributes.class contains 'btn'
|
|
36
|
+
rect.width > 200
|
|
37
|
+
style.display != 'none'
|
|
38
|
+
attributes.href starts-with 'https://'
|
|
39
|
+
tagName =~ /^H[1-6]$/
|
|
40
|
+
attributes.type in ('button', 'submit', 'reset')
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Values with no spaces can be written bare (`tagName = DIV`). A value containing spaces or special characters must be single-quoted (`attributes.class = 'nav item'`) — there is no double-quoted form, so a literal `"` never needs escaping and isn't itself an escape sequence. Inside a quoted value, `\'`, `\\`, `\n`, `\t`, and `\r` are recognized escapes — so `text = 'line one\nline two'` matches an element whose text spans two lines. A regex literal (`/pattern/flags`) doesn't need this — its own `\n`/`\t`/etc. are interpreted by the regex engine directly.
|
|
44
|
+
|
|
45
|
+
## Checking geometry
|
|
46
|
+
|
|
47
|
+
Test an element's bounding rectangle against a point, a rectangle, or another element:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
bounds contains 400,300 (a point, "x,y")
|
|
51
|
+
bounds contains 0,0,500,200 (a rectangle, "left,top,width,height")
|
|
52
|
+
bounds contains node 12 (the element with id 12)
|
|
53
|
+
bounds intersects node 12
|
|
54
|
+
bounds contained-by node 12
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`bounds` and `rect` are interchangeable here. An element with no rectangle never matches a geometry check. (Writing `rect.width` or another dotted path still works as an ordinary property comparison — only a bare `rect`/`bounds` followed directly by `contains`/`intersects`/`contained-by` is a geometry check.)
|
|
58
|
+
|
|
59
|
+
## Comparing size
|
|
60
|
+
|
|
61
|
+
Compare an element's area, width, or height against a literal number, another element's dimensions, or a plain size/rectangle:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
larger-than node 12 (area bigger than element 12's area)
|
|
65
|
+
smaller-than 5000 (area smaller than 5000 square px)
|
|
66
|
+
wider-than node 12 (width greater than element 12's width)
|
|
67
|
+
narrower-than 300 (width less than 300px)
|
|
68
|
+
taller-than 0,0,200,80 (height greater than 80 — a rect's own height, position ignored)
|
|
69
|
+
shorter-than 200,80 (height less than 80 — a plain "width,height" size)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The target can be `node <id>` (use that element's dimensions), a rectangle (4 numbers — only its width/height matter, not its position), a plain size (2 numbers, `width,height`), or a single bare number — interpreted as area for `larger-than`/`smaller-than`, width for `wider-than`/`narrower-than`, height for `taller-than`/`shorter-than`. An element with no rectangle (as either the subject or the `node` target) never matches.
|
|
73
|
+
|
|
74
|
+
## Checking direction
|
|
75
|
+
|
|
76
|
+
Test whether an element is entirely above, below, left of, or right of another element or rectangle — not just overlapping it, but fully past the relevant edge:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
above node 12
|
|
80
|
+
below node 12
|
|
81
|
+
left-of node 12
|
|
82
|
+
right-of 0,0,500,200
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`right-of T` means entirely to the right of T's right edge; `left-of T` entirely to the left of T's left edge; `above`/`below` work the same way against T's top/bottom edge. An element that merely overlaps the target matches none of the four.
|
|
86
|
+
|
|
87
|
+
## Checking relationships
|
|
88
|
+
|
|
89
|
+
Test an element's position in the tree relative to another element:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
descendant-of node 12
|
|
93
|
+
ancestor-of node 12
|
|
94
|
+
child-of node 12
|
|
95
|
+
parent-of node 12
|
|
96
|
+
sibling-of node 12
|
|
97
|
+
2nd child-of node 12
|
|
98
|
+
first child-of node 12
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Ordinal forms (`1st`, `2nd`, ... `20th`, or `first`, `second`, ... `twentieth`) count only element children, ignoring text.
|
|
102
|
+
|
|
103
|
+
Instead of `node <id>`, you can give a whole sub-predicate in parentheses, describing the other element instead of naming it — this lets you say "some ancestor/descendant/sibling that looks like X" without knowing its id:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
child-of (tagName = 'FORM')
|
|
107
|
+
2nd child-of (ancestor-of text and tagName = 'BUTTON')
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The second example reads as: "the 2nd child of some element that is itself a BUTTON with a descendant that has text."
|
|
111
|
+
|
|
112
|
+
## Checking attribute presence
|
|
113
|
+
|
|
114
|
+
Test whether an element has a given attribute at all, regardless of its value:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
has-attribute src
|
|
118
|
+
has-attribute 'data-testid'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The name is matched case-insensitively and can be written bare (no spaces) or single-quoted. This differs from `attributes.<name> != ''` in one case: an attribute present with an empty value (e.g. `alt=""`) counts as present for `has-attribute`, but would fail a `!= ''` check.
|
|
122
|
+
|
|
123
|
+
## Shortcut keywords
|
|
124
|
+
|
|
125
|
+
A handful of common checks are a single word, with no operator or value:
|
|
126
|
+
|
|
127
|
+
| Keyword | Matches |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `text` | Has non-empty text |
|
|
130
|
+
| `image` | Looks like a visual image (broad heuristic — see below) |
|
|
131
|
+
| `gif` | Is an `IMG` (specifically, not the broader `image` set) whose `src` ends with `.gif` |
|
|
132
|
+
| `logo` | `class`/`id`/`alt` contains "logo" |
|
|
133
|
+
| `link` | Is an `A` |
|
|
134
|
+
| `button` | Is a `BUTTON`, a `button`/`submit`/`reset` `INPUT`, or has `role="button"` |
|
|
135
|
+
| `heading` | Is `H1` through `H6` |
|
|
136
|
+
| `hidden` | `display:none`, `visibility:hidden`, `opacity:0`, zero width/height (or no rect), or has a `hidden` attribute |
|
|
137
|
+
| `visible` | The exact inverse of `hidden` |
|
|
138
|
+
| `empty` | Has no text and no element children |
|
|
139
|
+
| `true` | Always matches — every element |
|
|
140
|
+
| `false` | Never matches |
|
|
141
|
+
|
|
142
|
+
`image` is a broad heuristic, not a single structural check — it's meant to answer "does this look like an image to a person looking at the page", not "is this literally an `<img>` tag". It matches any of:
|
|
143
|
+
|
|
144
|
+
- an `IMG`, `SVG`, or `PICTURE` element (by tag, regardless of attributes)
|
|
145
|
+
- any element with a CSS `background-image` other than `none`
|
|
146
|
+
|
|
147
|
+
Because it's a heuristic, expect both false positives and false negatives: a `DIV` styled with a decorative `background-image` counts as an "image" even though it's not meaningfully one, while an icon rendered via an icon font (a glyph character styled with a special font, no image-related attribute or style at all) is invisible to this check and will never match. When you need the strict "literally an `<img>` tag" meaning instead, write `tagName = 'IMG'` directly.
|
|
148
|
+
|
|
149
|
+
**Results include hidden elements by default** — dom-search doesn't filter anything out unless the predicate says so, since silently hiding a match is worse than an unwanted one (you might be searching precisely because an element is unexpectedly hidden). **To skip hidden elements, start the predicate with `visible and ...`**, e.g. `visible and tagName = 'BUTTON'`.
|
|
150
|
+
|
|
151
|
+
## More examples
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
tagName = 'DIV' and attributes.class contains 'btn'
|
|
155
|
+
image and gif
|
|
156
|
+
heading and text
|
|
157
|
+
rect.width > 200 and not (tagName = 'SPAN')
|
|
158
|
+
attributes.type in ('button', 'submit')
|
|
159
|
+
bounds contains 400,300
|
|
160
|
+
descendant-of node 12
|
|
161
|
+
larger-than node 12
|
|
162
|
+
right-of node 12
|
|
163
|
+
has-attribute 'aria-label'
|
|
164
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/mcp",
|
|
3
3
|
"mcpName": "io.github.applitools/applitools",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "Applitools MCP server for AI coding assistants",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"bin": "./dist/index.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"build:bundle": "yarn clean && yarn build && BUILD_MODE=bundle yarn type-check && BUILD_MODE=bundle rollup -c",
|
|
13
13
|
"build:watch": "rollup -c --watch",
|
|
14
14
|
"prepublishOnly": "yarn build",
|
|
15
|
-
"test": "mocha test
|
|
15
|
+
"test": "yarn test:mocha && yarn test:tools",
|
|
16
|
+
"test:mocha": "mocha test/**/*.spec.ts --parallel",
|
|
17
|
+
"test:tools": "vitest run",
|
|
16
18
|
"test:watch": "mocha test/**/*.spec.ts --watch",
|
|
17
19
|
"lint": "eslint 'src/**/*.ts'",
|
|
18
20
|
"lint:fix": "eslint 'src/**/*.ts' --fix"
|
|
@@ -58,6 +60,8 @@
|
|
|
58
60
|
},
|
|
59
61
|
"dependencies": {
|
|
60
62
|
"@applitools/core-base": "1.38.2",
|
|
63
|
+
"@applitools/eyes-results": "0.2.2",
|
|
64
|
+
"@applitools/image": "1.3.2",
|
|
61
65
|
"@applitools/logger": "2.3.1",
|
|
62
66
|
"@applitools/req": "1.11.3",
|
|
63
67
|
"@applitools/utils": "1.15.2",
|
|
@@ -89,14 +93,19 @@
|
|
|
89
93
|
"rollup": "^4.9.6",
|
|
90
94
|
"rollup-plugin-copy": "^3.5.0",
|
|
91
95
|
"rollup-plugin-node-externals": "^8.1.2",
|
|
92
|
-
"typescript": "~5.
|
|
96
|
+
"typescript": "~5.9.3",
|
|
97
|
+
"vitest": "^4.1.9"
|
|
93
98
|
},
|
|
94
99
|
"publishConfig": {
|
|
95
100
|
"access": "public"
|
|
96
101
|
},
|
|
97
102
|
"lavamoat": {
|
|
98
103
|
"allowScripts": {
|
|
99
|
-
"@applitools/core-base>@applitools/image>sharp": false
|
|
104
|
+
"@applitools/core-base>@applitools/image>sharp": false,
|
|
105
|
+
"@applitools/image>sharp": false,
|
|
106
|
+
"vitest>vite>esbuild": false,
|
|
107
|
+
"vitest>jsdom>ws>bufferutil": false,
|
|
108
|
+
"vitest>jsdom>ws>utf-8-validate": false
|
|
100
109
|
}
|
|
101
110
|
}
|
|
102
111
|
}
|