ff-dom 1.0.6 → 1.0.7

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/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # ff-dom
2
+
3
+
4
+
5
+ ## Getting started
6
+
7
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps.
8
+
9
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
10
+
11
+ ## Add your files
12
+
13
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
+ - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
+
16
+ ```
17
+ cd existing_repo
18
+ git remote add origin https://gitlab.com/ty_optimize/ff-dom.git
19
+ git branch -M main
20
+ git push -uf origin main
21
+ ```
22
+
23
+ ## Integrate with your tools
24
+
25
+ - [ ] [Set up project integrations](https://gitlab.com/ty_optimize/ff-dom/-/settings/integrations)
26
+
27
+ ## Collaborate with your team
28
+
29
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
+ - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
+
35
+ ## Test and Deploy
36
+
37
+ Use the built-in continuous integration in GitLab.
38
+
39
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
+
45
+ ***
46
+
47
+ # Editing this README
48
+
49
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
+
51
+ ## Suggestions for a good README
52
+
53
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
54
+
55
+ ## Name
56
+ Choose a self-explaining name for your project.
57
+
58
+ ## Description
59
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
+
61
+ ## Badges
62
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
+
64
+ ## Visuals
65
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
+
67
+ ## Installation
68
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
+
70
+ ## Usage
71
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
+
73
+ ## Support
74
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
+
76
+ ## Roadmap
77
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
78
+
79
+ ## Contributing
80
+ State if you are open to contributions and what your requirements are for accepting them.
81
+
82
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
83
+
84
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
85
+
86
+ ## Authors and acknowledgment
87
+ Show your appreciation to those who have contributed to the project.
88
+
89
+ ## License
90
+ For open source projects, say how it is licensed.
91
+
92
+ ## Project status
93
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
@@ -71,7 +71,6 @@ const getName = (element) => {
71
71
  if (elementEl.hasAttribute("name")) {
72
72
  const attrValue = elementEl.getAttribute("name");
73
73
  const name = `${attrValue}`;
74
- console.log("get name", name);
75
74
  return name || null;
76
75
  }
77
76
  return null;
@@ -184,7 +183,6 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
184
183
  locator.type.match("dynamic") ||
185
184
  locator.value.includes("{") ||
186
185
  locator.value.includes("}")) {
187
- console.log("Dynamic locator detected:", locator.value);
188
186
  finalLocators.push({
189
187
  name: locator.name,
190
188
  type: locator.type,
@@ -196,7 +194,6 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
196
194
  continue;
197
195
  }
198
196
  if (locator.isRecorded.includes("N") || locator.isRecorded.match("N")) {
199
- console.log("Manually added locator detected:", locator.value);
200
197
  finalLocators.push({
201
198
  name: locator.name,
202
199
  type: locator.type,
@@ -208,7 +205,6 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
208
205
  continue;
209
206
  }
210
207
  if (isShared.includes("Y")) {
211
- console.log("Shared element detected");
212
208
  break locators;
213
209
  }
214
210
  for (const relation of relations) {
@@ -275,59 +271,133 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
275
271
  if (targetElement) {
276
272
  const idValue = getId(targetElement);
277
273
  if (idValue && !locatorExists("id", idValue)) {
278
- finalLocators.push({
279
- name: "id",
280
- type: locator.type,
281
- value: idValue,
282
- reference: locator.reference,
283
- status: locator.status,
284
- isRecorded: locator.isRecorded,
274
+ locators.forEach((loc) => {
275
+ if (locator.value === idValue) {
276
+ finalLocators.push({
277
+ name: "id",
278
+ type: locator.type,
279
+ value: idValue,
280
+ reference: locator.reference,
281
+ status: locator.status,
282
+ isRecorded: locator.isRecorded,
283
+ });
284
+ }
285
+ else {
286
+ finalLocators.push({
287
+ name: "id",
288
+ type: locator.type,
289
+ value: idValue,
290
+ reference: locator.reference,
291
+ status: locator.status,
292
+ isRecorded: locator.isRecorded,
293
+ isSelfHealed: "Y",
294
+ });
295
+ }
285
296
  });
286
297
  }
287
298
  if (getVisibleText(targetElement)) {
288
299
  const textValue = getVisibleText(targetElement);
289
- finalLocators.push({
290
- name: "linkText",
291
- type: "static",
292
- value: textValue,
293
- reference: locator.reference,
294
- status: locator.status,
295
- isRecorded: locator.isRecorded,
300
+ locators.forEach((loc) => {
301
+ if (loc.value === textValue) {
302
+ finalLocators.push({
303
+ name: "linkText",
304
+ type: "static",
305
+ value: textValue,
306
+ reference: locator.reference,
307
+ status: locator.status,
308
+ isRecorded: locator.isRecorded,
309
+ });
310
+ }
311
+ else {
312
+ finalLocators.push({
313
+ name: "linkText",
314
+ type: "static",
315
+ value: textValue,
316
+ reference: locator.reference,
317
+ status: locator.status,
318
+ isRecorded: locator.isRecorded,
319
+ isSelfHealed: "Y",
320
+ });
321
+ }
296
322
  });
297
323
  }
298
324
  if (getName(targetElement)) {
299
- console.log("inside name if");
300
325
  const nameLocator = getName(targetElement);
301
- finalLocators.push({
302
- name: "name",
303
- type: "static",
304
- value: nameLocator,
305
- reference: locator.reference,
306
- status: locator.status,
307
- isRecorded: locator.isRecorded,
326
+ locators.forEach((loc) => {
327
+ if (loc.value === nameLocator) {
328
+ finalLocators.push({
329
+ name: "name",
330
+ type: "static",
331
+ value: nameLocator,
332
+ reference: locator.reference,
333
+ status: locator.status,
334
+ isRecorded: locator.isRecorded,
335
+ });
336
+ }
337
+ else {
338
+ finalLocators.push({
339
+ name: "name",
340
+ type: "static",
341
+ value: nameLocator,
342
+ reference: locator.reference,
343
+ status: locator.status,
344
+ isRecorded: locator.isRecorded,
345
+ isSelfHealed: "Y",
346
+ });
347
+ }
308
348
  });
309
349
  }
310
350
  const classValue = getClassName(targetElement);
311
351
  if (classValue &&
312
352
  classValue.trim() !== "" &&
313
353
  !locatorExists("className", classValue)) {
314
- finalLocators.push({
315
- name: "className",
316
- type: locator.type,
317
- value: classValue,
318
- reference: locator.reference,
319
- status: locator.status,
320
- isRecorded: locator.isRecorded,
354
+ locators.forEach((loc) => {
355
+ if (loc.value === classValue) {
356
+ finalLocators.push({
357
+ name: "className",
358
+ type: locator.type,
359
+ value: classValue,
360
+ reference: locator.reference,
361
+ status: locator.status,
362
+ isRecorded: locator.isRecorded,
363
+ });
364
+ }
365
+ else {
366
+ finalLocators.push({
367
+ name: "className",
368
+ type: locator.type,
369
+ value: classValue,
370
+ reference: locator.reference,
371
+ status: locator.status,
372
+ isRecorded: locator.isRecorded,
373
+ isSelfHealed: "Y",
374
+ });
375
+ }
321
376
  });
322
377
  }
323
378
  xpathFunctions.forEach((fn) => {
324
- finalLocators.push({
325
- name: fn.name,
326
- type: locator.type,
327
- value: fn.value(targetElement),
328
- reference: locator.reference,
329
- status: locator.status,
330
- isRecorded: locator.isRecorded,
379
+ locators.forEach((loc) => {
380
+ if (loc.value === fn.value(targetElement)) {
381
+ finalLocators.push({
382
+ name: fn.name,
383
+ type: locator.type,
384
+ value: fn.value(targetElement),
385
+ reference: locator.reference,
386
+ status: locator.status,
387
+ isRecorded: locator.isRecorded,
388
+ });
389
+ }
390
+ else {
391
+ finalLocators.push({
392
+ name: fn.name,
393
+ type: locator.type,
394
+ value: fn.value(targetElement),
395
+ reference: locator.reference,
396
+ status: locator.status,
397
+ isRecorded: locator.isRecorded,
398
+ isSelfHealed: "Y",
399
+ });
400
+ }
331
401
  });
332
402
  });
333
403
  for (const locator of locators) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-dom",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -109,7 +109,6 @@ const getName = (element: Element): string | null => {
109
109
  if (elementEl.hasAttribute("name")) {
110
110
  const attrValue = elementEl.getAttribute("name");
111
111
  const name = `${attrValue}`;
112
- console.log("get name", name);
113
112
  return name || null;
114
113
  }
115
114
 
@@ -286,7 +285,6 @@ const getElementsFromHTML = (
286
285
  locator.value.includes("{") ||
287
286
  locator.value.includes("}")
288
287
  ) {
289
- console.log("Dynamic locator detected:", locator.value);
290
288
  finalLocators.push({
291
289
  name: locator.name,
292
290
  type: locator.type,
@@ -298,7 +296,6 @@ const getElementsFromHTML = (
298
296
  continue;
299
297
  }
300
298
  if (locator.isRecorded.includes("N") || locator.isRecorded.match("N")) {
301
- console.log("Manually added locator detected:", locator.value);
302
299
  finalLocators.push({
303
300
  name: locator.name,
304
301
  type: locator.type,
@@ -310,7 +307,6 @@ const getElementsFromHTML = (
310
307
  continue;
311
308
  }
312
309
  if (isShared.includes("Y")) {
313
- console.log("Shared element detected");
314
310
  break locators;
315
311
  }
316
312
  for (const relation of relations) {
@@ -402,37 +398,78 @@ const getElementsFromHTML = (
402
398
  if (targetElement) {
403
399
  const idValue = getId(targetElement);
404
400
  if (idValue && !locatorExists("id", idValue)) {
405
- finalLocators.push({
406
- name: "id",
407
- type: locator.type,
408
- value: idValue,
409
- reference: locator.reference,
410
- status: locator.status,
411
- isRecorded: locator.isRecorded,
401
+ locators.forEach((loc) => {
402
+ if (locator.value === idValue) {
403
+ finalLocators.push({
404
+ name: "id",
405
+ type: locator.type,
406
+ value: idValue,
407
+ reference: locator.reference,
408
+ status: locator.status,
409
+ isRecorded: locator.isRecorded,
410
+ });
411
+ } else {
412
+ finalLocators.push({
413
+ name: "id",
414
+ type: locator.type,
415
+ value: idValue,
416
+ reference: locator.reference,
417
+ status: locator.status,
418
+ isRecorded: locator.isRecorded,
419
+ isSelfHealed: "Y",
420
+ });
421
+ }
412
422
  });
413
423
  }
414
424
  if (getVisibleText(targetElement)) {
415
425
  const textValue = getVisibleText(targetElement);
416
- finalLocators.push({
417
- name: "linkText",
418
- type: "static",
419
- value: textValue,
420
- reference: locator.reference,
421
- status: locator.status,
422
- isRecorded: locator.isRecorded,
426
+ locators.forEach((loc) => {
427
+ if (loc.value === textValue) {
428
+ finalLocators.push({
429
+ name: "linkText",
430
+ type: "static",
431
+ value: textValue,
432
+ reference: locator.reference,
433
+ status: locator.status,
434
+ isRecorded: locator.isRecorded,
435
+ });
436
+ } else {
437
+ finalLocators.push({
438
+ name: "linkText",
439
+ type: "static",
440
+ value: textValue,
441
+ reference: locator.reference,
442
+ status: locator.status,
443
+ isRecorded: locator.isRecorded,
444
+ isSelfHealed: "Y",
445
+ });
446
+ }
423
447
  });
424
448
  }
425
449
 
426
450
  if (getName(targetElement)) {
427
- console.log("inside name if");
428
451
  const nameLocator = getName(targetElement);
429
- finalLocators.push({
430
- name: "name",
431
- type: "static",
432
- value: nameLocator,
433
- reference: locator.reference,
434
- status: locator.status,
435
- isRecorded: locator.isRecorded,
452
+ locators.forEach((loc) => {
453
+ if (loc.value === nameLocator) {
454
+ finalLocators.push({
455
+ name: "name",
456
+ type: "static",
457
+ value: nameLocator,
458
+ reference: locator.reference,
459
+ status: locator.status,
460
+ isRecorded: locator.isRecorded,
461
+ });
462
+ } else {
463
+ finalLocators.push({
464
+ name: "name",
465
+ type: "static",
466
+ value: nameLocator,
467
+ reference: locator.reference,
468
+ status: locator.status,
469
+ isRecorded: locator.isRecorded,
470
+ isSelfHealed: "Y",
471
+ });
472
+ }
436
473
  });
437
474
  }
438
475
 
@@ -442,23 +479,51 @@ const getElementsFromHTML = (
442
479
  classValue.trim() !== "" &&
443
480
  !locatorExists("className", classValue)
444
481
  ) {
445
- finalLocators.push({
446
- name: "className",
447
- type: locator.type,
448
- value: classValue,
449
- reference: locator.reference,
450
- status: locator.status,
451
- isRecorded: locator.isRecorded,
482
+ locators.forEach((loc) => {
483
+ if (loc.value === classValue) {
484
+ finalLocators.push({
485
+ name: "className",
486
+ type: locator.type,
487
+ value: classValue,
488
+ reference: locator.reference,
489
+ status: locator.status,
490
+ isRecorded: locator.isRecorded,
491
+ });
492
+ } else {
493
+ finalLocators.push({
494
+ name: "className",
495
+ type: locator.type,
496
+ value: classValue,
497
+ reference: locator.reference,
498
+ status: locator.status,
499
+ isRecorded: locator.isRecorded,
500
+ isSelfHealed: "Y",
501
+ });
502
+ }
452
503
  });
453
504
  }
454
505
  xpathFunctions.forEach((fn) => {
455
- finalLocators.push({
456
- name: fn.name,
457
- type: locator.type,
458
- value: fn.value(targetElement),
459
- reference: locator.reference,
460
- status: locator.status,
461
- isRecorded: locator.isRecorded,
506
+ locators.forEach((loc) => {
507
+ if (loc.value === fn.value(targetElement)) {
508
+ finalLocators.push({
509
+ name: fn.name,
510
+ type: locator.type,
511
+ value: fn.value(targetElement),
512
+ reference: locator.reference,
513
+ status: locator.status,
514
+ isRecorded: locator.isRecorded,
515
+ });
516
+ } else {
517
+ finalLocators.push({
518
+ name: fn.name,
519
+ type: locator.type,
520
+ value: fn.value(targetElement),
521
+ reference: locator.reference,
522
+ status: locator.status,
523
+ isRecorded: locator.isRecorded,
524
+ isSelfHealed: "Y",
525
+ });
526
+ }
462
527
  });
463
528
  });
464
529