@empiricalrun/test-gen 0.38.9 → 0.38.11

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.38.11
4
+
5
+ ### Patch Changes
6
+
7
+ - fb4c866: fix: parent and child elements getting highlighted
8
+
9
+ ## 0.38.10
10
+
11
+ ### Patch Changes
12
+
13
+ - e3f04e6: fix: add support for injecting script before agent action
14
+
3
15
  ## 0.38.9
4
16
 
5
17
  ### Patch Changes
@@ -157,10 +157,27 @@ function annotateClickableElements(options = {}) {
157
157
  isClickable = true;
158
158
  }
159
159
 
160
+ // Tag-specific clickability
161
+ const focusableTags = [
162
+ "a",
163
+ "button",
164
+ "input",
165
+ "select",
166
+ "textarea",
167
+ "object",
168
+ "embed",
169
+ "label",
170
+ "details",
171
+ ];
172
+
160
173
  // Check for onclick attribute or listener
161
174
  if (
162
- element.hasAttribute("onclick") ||
163
- typeof element.onclick === "function"
175
+ (element.hasAttribute("onclick") ||
176
+ typeof element.onclick === "function")
177
+ // check for parent element having same on click
178
+ && element.parentNode.onclick !== element.onclick
179
+ // parent element should not be a focusable tag like button
180
+ && focusableTags.indexOf(element.parentNode.tagName.toLowerCase()) === -1
164
181
  ) {
165
182
  isClickable = true;
166
183
  }
@@ -210,18 +227,7 @@ function annotateClickableElements(options = {}) {
210
227
  }
211
228
  }
212
229
 
213
- // Tag-specific clickability
214
- const focusableTags = [
215
- "a",
216
- "button",
217
- "input",
218
- "select",
219
- "textarea",
220
- "object",
221
- "embed",
222
- "label",
223
- "details",
224
- ];
230
+
225
231
  if (focusableTags.includes(tagName)) {
226
232
  switch (tagName) {
227
233
  case "a":
@@ -189,9 +189,9 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
189
189
  page = actions.getStateVariables()[plannerResp.pageName];
190
190
  // update page in actions
191
191
  testGenPage.updatePage({ page, name: plannerResp.pageName });
192
- // inject scripts in the updated
193
- await (0, utils_2.injectPwLocatorGenerator)(testGenPage.pwPageInstance);
194
192
  }
193
+ // inject scripts in the page
194
+ await (0, utils_2.injectPwLocatorGenerator)(testGenPage.pwPageInstance);
195
195
  const buffer = await page.screenshot({
196
196
  //This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
197
197
  // fullPage: true,
@@ -157,10 +157,27 @@ function annotateClickableElements(options = {}) {
157
157
  isClickable = true;
158
158
  }
159
159
 
160
+ // Tag-specific clickability
161
+ const focusableTags = [
162
+ "a",
163
+ "button",
164
+ "input",
165
+ "select",
166
+ "textarea",
167
+ "object",
168
+ "embed",
169
+ "label",
170
+ "details",
171
+ ];
172
+
160
173
  // Check for onclick attribute or listener
161
174
  if (
162
- element.hasAttribute("onclick") ||
163
- typeof element.onclick === "function"
175
+ (element.hasAttribute("onclick") ||
176
+ typeof element.onclick === "function")
177
+ // check for parent element having same on click
178
+ && element.parentNode.onclick !== element.onclick
179
+ // parent element should not be a focusable tag like button
180
+ && focusableTags.indexOf(element.parentNode.tagName.toLowerCase()) === -1
164
181
  ) {
165
182
  isClickable = true;
166
183
  }
@@ -210,18 +227,7 @@ function annotateClickableElements(options = {}) {
210
227
  }
211
228
  }
212
229
 
213
- // Tag-specific clickability
214
- const focusableTags = [
215
- "a",
216
- "button",
217
- "input",
218
- "select",
219
- "textarea",
220
- "object",
221
- "embed",
222
- "label",
223
- "details",
224
- ];
230
+
225
231
  if (focusableTags.includes(tagName)) {
226
232
  switch (tagName) {
227
233
  case "a":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.38.9",
3
+ "version": "0.38.11",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"