skopix 2.0.16 → 2.0.17

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/core/llm.js CHANGED
@@ -553,6 +553,7 @@ export async function processRecording({ steps, testName, url, provider, apiKey,
553
553
  + ' - Class-based selector for well-named classes e.g. .chart-container, .save-btn\n'
554
554
  + ' - Fall back to the original selector if nothing better\n'
555
555
  + ' CRITICAL RULES FOR SELECTORS:\n'
556
+ + ' - For icon elements (<i>, <span> with fa/icon classes): use the parent element as the anchor if it has a meaningful class/attribute, e.g. .chart-panel__panel-heading__panel-button i, [aria-label="Options"] i. NEVER generate a bare i.fa-something if there are multiple on the page — always scope it to its parent container\n'
556
557
  + ' - NEVER use IDs that look randomly generated (e.g. #highcharts-abc123-58, #ng-view-1, anything with random hex/numbers)\n'
557
558
  + ' - NEVER use :nth-child or :nth-of-type positional selectors\n'
558
559
  + ' - For chart/visualization containers: use class-based selectors like .highcharts-container, .chart-wrapper, [class*="chart"]\n'
package/core/recorder.js CHANGED
@@ -87,7 +87,7 @@ export class RecordingSession {
87
87
  }
88
88
 
89
89
  function getElementInfo(el) {
90
- return {
90
+ const info = {
91
91
  tag: el.tagName.toLowerCase(),
92
92
  id: el.id || null,
93
93
  name: el.name || null,
@@ -96,6 +96,17 @@ export class RecordingSession {
96
96
  selector: getSelector(el),
97
97
  classes: el.className ? el.className.toString().trim().slice(0, 100) : null,
98
98
  };
99
+ // For icon elements with no meaningful ID/text, capture parent context for better selector generation
100
+ const isIcon = ['i', 'span', 'svg'].includes(info.tag) && !info.id && !info.text;
101
+ if (isIcon && el.parentElement) {
102
+ const p = el.parentElement;
103
+ info.parentTag = p.tagName.toLowerCase();
104
+ info.parentClasses = p.className ? p.className.toString().trim().slice(0, 100) : null;
105
+ info.parentSelector = getSelector(p);
106
+ info.parentAriaLabel = p.getAttribute('aria-label') || null;
107
+ info.parentTestId = p.getAttribute('pi-test-identifier') || p.getAttribute('data-testid') || null;
108
+ }
109
+ return info;
99
110
  }
100
111
 
101
112
  // ─── Action listeners ─────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skopix",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "description": "Browser-based QA tool — record tests by using your app, replay them deterministically, generate Playwright code automatically",
5
5
  "main": "cli/index.js",
6
6
  "bin": {