ff-dom 1.0.13 → 1.0.14
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.
|
@@ -200,6 +200,20 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
200
200
|
let finalLocators = [];
|
|
201
201
|
locators: for (const locator of locators) {
|
|
202
202
|
try {
|
|
203
|
+
const isRecorded = String(locator.isRecorded || "");
|
|
204
|
+
const recordedNLocators = locators.filter((l) => l.isRecorded === "N");
|
|
205
|
+
if (recordedNLocators.length > 0) {
|
|
206
|
+
for (const locator of recordedNLocators) {
|
|
207
|
+
finalLocators.push({
|
|
208
|
+
name: locator.name,
|
|
209
|
+
type: locator.type,
|
|
210
|
+
value: locator.value,
|
|
211
|
+
reference: locator.reference,
|
|
212
|
+
status: locator.status,
|
|
213
|
+
isRecorded: locator.isRecorded,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
203
217
|
let relativeXpath = null;
|
|
204
218
|
const isDynamic = String(locator.value || locator.type || "");
|
|
205
219
|
if (isDynamic.includes("dynamic") ||
|
|
@@ -216,17 +230,6 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
216
230
|
});
|
|
217
231
|
continue;
|
|
218
232
|
}
|
|
219
|
-
const isRecorded = String(locator.isRecorded || "");
|
|
220
|
-
if (isRecorded.includes("N") || isRecorded.match("N")) {
|
|
221
|
-
finalLocators.push({
|
|
222
|
-
name: locator.name,
|
|
223
|
-
type: locator.type,
|
|
224
|
-
value: locator.value,
|
|
225
|
-
reference: locator.reference,
|
|
226
|
-
status: locator.status,
|
|
227
|
-
isRecorded: locator.isRecorded,
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
233
|
if (isShared.includes("Y")) {
|
|
231
234
|
break locators;
|
|
232
235
|
}
|
|
@@ -262,6 +265,18 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
262
265
|
if (tempDiv.innerHTML) {
|
|
263
266
|
const normalizedXPath = normalizeXPath(trimmedSelector);
|
|
264
267
|
targetElement = getElementFromXPath(tempDiv, normalizedXPath);
|
|
268
|
+
if (targetElement) {
|
|
269
|
+
finalLocators.push({
|
|
270
|
+
name: locator.name,
|
|
271
|
+
type: locator.type,
|
|
272
|
+
value: trimmedSelector,
|
|
273
|
+
reference: locator.reference,
|
|
274
|
+
status: locator.status,
|
|
275
|
+
isRecorded: String(locator.isRecorded).includes("N")
|
|
276
|
+
? "N"
|
|
277
|
+
: "Y",
|
|
278
|
+
});
|
|
279
|
+
}
|
|
265
280
|
}
|
|
266
281
|
}
|
|
267
282
|
else {
|
|
@@ -302,7 +317,7 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
302
317
|
const idValue = getId(targetElement);
|
|
303
318
|
if (idValue && !locatorExists("id", idValue)) {
|
|
304
319
|
locators.forEach((loc) => {
|
|
305
|
-
if (locator.value === idValue) {
|
|
320
|
+
if (locator.value === idValue && locator.name === "id") {
|
|
306
321
|
finalLocators.push({
|
|
307
322
|
name: "id",
|
|
308
323
|
type: locator.type,
|
|
@@ -353,36 +368,38 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
353
368
|
}
|
|
354
369
|
if (getName(targetElement)) {
|
|
355
370
|
const nameLocator = getName(targetElement);
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
371
|
+
if (nameLocator && !locatorExists("name", nameLocator)) {
|
|
372
|
+
locators.forEach((loc) => {
|
|
373
|
+
if (loc.value === nameLocator && locator.name === "name") {
|
|
374
|
+
finalLocators.push({
|
|
375
|
+
name: "name",
|
|
376
|
+
type: "static",
|
|
377
|
+
value: nameLocator,
|
|
378
|
+
reference: locator.reference,
|
|
379
|
+
status: locator.status,
|
|
380
|
+
isRecorded: locator.isRecorded,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
finalLocators.push({
|
|
385
|
+
name: "name",
|
|
386
|
+
type: "static",
|
|
387
|
+
value: nameLocator,
|
|
388
|
+
reference: locator.reference,
|
|
389
|
+
status: locator.status,
|
|
390
|
+
isRecorded: "Y",
|
|
391
|
+
isSelfHealed: "Y",
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
379
396
|
}
|
|
380
397
|
const classValue = getClassName(targetElement);
|
|
381
398
|
if (classValue &&
|
|
382
399
|
classValue.trim() !== "" &&
|
|
383
400
|
!locatorExists("className", classValue)) {
|
|
384
401
|
locators.forEach((loc) => {
|
|
385
|
-
if (loc.value === classValue) {
|
|
402
|
+
if (loc.value === classValue && locator.name === "className") {
|
|
386
403
|
finalLocators.push({
|
|
387
404
|
name: "className",
|
|
388
405
|
type: locator.type,
|
|
@@ -461,9 +478,14 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
|
|
|
461
478
|
}
|
|
462
479
|
let uniqueLocators = new Map();
|
|
463
480
|
finalLocators.forEach((loc) => {
|
|
464
|
-
if (
|
|
481
|
+
if (loc.isRecorded === "N") {
|
|
465
482
|
uniqueLocators.set(loc.value, loc);
|
|
466
483
|
}
|
|
484
|
+
else {
|
|
485
|
+
if (!uniqueLocators.has(loc.value)) {
|
|
486
|
+
uniqueLocators.set(loc.value, loc);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
467
489
|
});
|
|
468
490
|
let ffLoc = Array.from(uniqueLocators.values());
|
|
469
491
|
const jsonResult = [
|
package/package.json
CHANGED
|
@@ -308,6 +308,22 @@ const getElementsFromHTML = (
|
|
|
308
308
|
|
|
309
309
|
locators: for (const locator of locators) {
|
|
310
310
|
try {
|
|
311
|
+
const isRecorded = String(locator.isRecorded || "");
|
|
312
|
+
const recordedNLocators = locators.filter((l) => l.isRecorded === "N");
|
|
313
|
+
|
|
314
|
+
if (recordedNLocators.length > 0) {
|
|
315
|
+
for (const locator of recordedNLocators) {
|
|
316
|
+
finalLocators.push({
|
|
317
|
+
name: locator.name,
|
|
318
|
+
type: locator.type,
|
|
319
|
+
value: locator.value,
|
|
320
|
+
reference: locator.reference,
|
|
321
|
+
status: locator.status,
|
|
322
|
+
isRecorded: locator.isRecorded,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
311
327
|
let relativeXpath: string | null = null;
|
|
312
328
|
const isDynamic = String(locator.value || locator.type || "");
|
|
313
329
|
if (
|
|
@@ -326,18 +342,7 @@ const getElementsFromHTML = (
|
|
|
326
342
|
});
|
|
327
343
|
continue;
|
|
328
344
|
}
|
|
329
|
-
const isRecorded = String(locator.isRecorded || "");
|
|
330
345
|
|
|
331
|
-
if (isRecorded.includes("N") || isRecorded.match("N")) {
|
|
332
|
-
finalLocators.push({
|
|
333
|
-
name: locator.name,
|
|
334
|
-
type: locator.type,
|
|
335
|
-
value: locator.value,
|
|
336
|
-
reference: locator.reference,
|
|
337
|
-
status: locator.status,
|
|
338
|
-
isRecorded: locator.isRecorded,
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
346
|
if (isShared.includes("Y")) {
|
|
342
347
|
break locators;
|
|
343
348
|
}
|
|
@@ -383,10 +388,24 @@ const getElementsFromHTML = (
|
|
|
383
388
|
trimmedSelector.startsWith("//")) &&
|
|
384
389
|
!locator.type.match("dynamic")
|
|
385
390
|
) {
|
|
386
|
-
if(tempDiv.innerHTML)
|
|
387
|
-
{
|
|
391
|
+
if (tempDiv.innerHTML) {
|
|
388
392
|
const normalizedXPath = normalizeXPath(trimmedSelector);
|
|
389
|
-
targetElement = getElementFromXPath(
|
|
393
|
+
targetElement = getElementFromXPath(
|
|
394
|
+
tempDiv,
|
|
395
|
+
normalizedXPath
|
|
396
|
+
);
|
|
397
|
+
if (targetElement) {
|
|
398
|
+
finalLocators.push({
|
|
399
|
+
name: locator.name,
|
|
400
|
+
type: locator.type,
|
|
401
|
+
value: trimmedSelector,
|
|
402
|
+
reference: locator.reference,
|
|
403
|
+
status: locator.status,
|
|
404
|
+
isRecorded: String(locator.isRecorded).includes("N")
|
|
405
|
+
? "N"
|
|
406
|
+
: "Y",
|
|
407
|
+
});
|
|
408
|
+
}
|
|
390
409
|
}
|
|
391
410
|
} else {
|
|
392
411
|
targetElement = currentElement.querySelector(trimmedSelector);
|
|
@@ -407,8 +426,7 @@ const getElementsFromHTML = (
|
|
|
407
426
|
}
|
|
408
427
|
|
|
409
428
|
currentElement = targetElement;
|
|
410
|
-
}else
|
|
411
|
-
{
|
|
429
|
+
} else {
|
|
412
430
|
console.error("Element not found at:", selector);
|
|
413
431
|
break;
|
|
414
432
|
}
|
|
@@ -439,7 +457,7 @@ const getElementsFromHTML = (
|
|
|
439
457
|
const idValue = getId(targetElement);
|
|
440
458
|
if (idValue && !locatorExists("id", idValue)) {
|
|
441
459
|
locators.forEach((loc) => {
|
|
442
|
-
if (locator.value === idValue) {
|
|
460
|
+
if (locator.value === idValue && locator.name === "id") {
|
|
443
461
|
finalLocators.push({
|
|
444
462
|
name: "id",
|
|
445
463
|
type: locator.type,
|
|
@@ -489,28 +507,30 @@ const getElementsFromHTML = (
|
|
|
489
507
|
|
|
490
508
|
if (getName(targetElement)) {
|
|
491
509
|
const nameLocator = getName(targetElement);
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
if (nameLocator && !locatorExists("name", nameLocator)) {
|
|
511
|
+
locators.forEach((loc) => {
|
|
512
|
+
if (loc.value === nameLocator && locator.name === "name") {
|
|
513
|
+
finalLocators.push({
|
|
514
|
+
name: "name",
|
|
515
|
+
type: "static",
|
|
516
|
+
value: nameLocator,
|
|
517
|
+
reference: locator.reference,
|
|
518
|
+
status: locator.status,
|
|
519
|
+
isRecorded: locator.isRecorded,
|
|
520
|
+
});
|
|
521
|
+
} else {
|
|
522
|
+
finalLocators.push({
|
|
523
|
+
name: "name",
|
|
524
|
+
type: "static",
|
|
525
|
+
value: nameLocator,
|
|
526
|
+
reference: locator.reference,
|
|
527
|
+
status: locator.status,
|
|
528
|
+
isRecorded: "Y",
|
|
529
|
+
isSelfHealed: "Y",
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
514
534
|
}
|
|
515
535
|
|
|
516
536
|
const classValue = getClassName(targetElement);
|
|
@@ -520,7 +540,7 @@ const getElementsFromHTML = (
|
|
|
520
540
|
!locatorExists("className", classValue)
|
|
521
541
|
) {
|
|
522
542
|
locators.forEach((loc) => {
|
|
523
|
-
if (loc.value === classValue) {
|
|
543
|
+
if (loc.value === classValue && locator.name === "className") {
|
|
524
544
|
finalLocators.push({
|
|
525
545
|
name: "className",
|
|
526
546
|
type: locator.type,
|
|
@@ -604,8 +624,12 @@ const getElementsFromHTML = (
|
|
|
604
624
|
|
|
605
625
|
let uniqueLocators = new Map();
|
|
606
626
|
finalLocators.forEach((loc) => {
|
|
607
|
-
if (
|
|
627
|
+
if (loc.isRecorded === "N") {
|
|
608
628
|
uniqueLocators.set(loc.value, loc);
|
|
629
|
+
} else {
|
|
630
|
+
if (!uniqueLocators.has(loc.value)) {
|
|
631
|
+
uniqueLocators.set(loc.value, loc);
|
|
632
|
+
}
|
|
609
633
|
}
|
|
610
634
|
});
|
|
611
635
|
|