ff-automationv2 2.2.20 โ†’ 2.2.21

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.
@@ -4,7 +4,7 @@ import path from "path";
4
4
  import fs from "fs";
5
5
  const certPath = path.join("D:", "Bitbucket", "automationV2", "Certificates", "certificate.crt");
6
6
  const ssl = {
7
- cert: fs.readFileSync(certPath, "utf-8"),
7
+ ca: [fs.readFileSync(certPath, "utf-8")],
8
8
  rejectUnauthorized: false,
9
9
  };
10
10
  const runner = new AutomationRunner();
@@ -51,7 +51,7 @@ runner.run({
51
51
  browser: {
52
52
  browserName: "Google Chrome",
53
53
  },
54
- broker: ["test3.fireflink.com"],
54
+ broker: ["test3.fireflink.com:9092"],
55
55
  sslConfig: ssl,
56
56
  env: "test3",
57
57
  version: "asdfg",
@@ -1 +0,0 @@
1
- export {};
@@ -1,82 +1,87 @@
1
- import { remote } from 'webdriverio';
2
- import { encode } from '@toon-format/toon';
3
- import * as cheerio from 'cheerio';
4
- import fs from 'fs';
5
- import { encoding_for_model } from "@dqbd/tiktoken";
6
- // ๐Ÿ”„ HTML โ†’ JSON
7
- function htmlToJson(html) {
8
- const $ = cheerio.load(html);
9
- // ๐Ÿงน remove useless elements
10
- $('script, style, noscript, iframe').remove();
11
- function parseElement(elem, depth = 0) {
12
- if (!elem || depth > 6)
13
- return null;
14
- const node = {
15
- tag: elem.name,
16
- attrs: elem.attribs || {},
17
- children: [] // โœ… FIX
18
- };
19
- for (const child of elem.children || []) {
20
- if (child.type === 'text') {
21
- const text = child.data.trim();
22
- if (text) {
23
- node.children.push({ text });
24
- }
25
- }
26
- else if (child.type === 'tag') {
27
- const parsed = parseElement(child, depth + 1);
28
- if (parsed) {
29
- node.children.push(parsed);
30
- }
31
- }
32
- }
33
- return node;
34
- }
35
- return parseElement($('body')[0]);
36
- }
37
- // ๐Ÿš€ Main runner
38
- async function run() {
39
- const browser = await remote({
40
- capabilities: {
41
- browserName: 'chrome'
42
- }
43
- });
44
- try {
45
- // ๐ŸŒ Open Amazon
46
- await browser.url('https://www.amzon.in/');
47
- // โณ wait for search box
48
- const searchBox = await browser.$('#twotabsearchtextbox');
49
- await searchBox.waitForDisplayed({ timeout: 10000 });
50
- // ๐Ÿ“„ Get HTML
51
- const html = await browser.getPageSource();
52
- // ๐Ÿ”„ Convert HTML โ†’ JSON
53
- const json = htmlToJson(html);
54
- // ๐Ÿ”„ JSON โ†’ TOON
55
- const start = performance.now();
56
- const encoded = encode({ data: json });
57
- const end = performance.now();
58
- console.log('HTML :', html.length);
59
- console.log('json size:', JSON.stringify(json).length);
60
- console.log('Encoded length:', encoded.length);
61
- console.log(`Time taken: ${(end - start).toFixed(2)} ms`);
62
- // ๐Ÿ’พ Save outputs (optional but useful)
63
- fs.writeFileSync('output.json', JSON.stringify(json, null, 2));
64
- fs.writeFileSync('output.toon', encoded);
65
- const enc = encoding_for_model("gpt-4"); // closest available
66
- function countTokens(text) {
67
- return enc.encode(text).length;
68
- }
69
- const jsonString = JSON.stringify(json);
70
- console.log("Token JSON count:", countTokens(jsonString));
71
- const jsonStringencoded = JSON.stringify(encoded);
72
- console.log("Token TOON count:", countTokens(jsonStringencoded));
73
- }
74
- catch (err) {
75
- console.error(err);
76
- }
77
- finally {
78
- await browser.deleteSession();
79
- }
80
- }
81
- run();
82
- console.log("hi");
1
+ "use strict";
2
+ // import { remote } from 'webdriverio'
3
+ // import { encode } from '@toon-format/toon'
4
+ // import * as cheerio from 'cheerio'
5
+ // import fs from 'fs'
6
+ // import { Tokenizer } from "@huggingface/tokenizers"
7
+ // import { encoding_for_model } from "@dqbd/tiktoken"
8
+ // // ๐Ÿง  Define proper type (fixes "never" error)
9
+ // type NodeType = {
10
+ // tag?: string
11
+ // attrs?: Record<string, string>
12
+ // children?: NodeType[]
13
+ // text?: string
14
+ // }
15
+ // // ๐Ÿ”„ HTML โ†’ JSON
16
+ // function htmlToJson(html: string): NodeType | null {
17
+ // const $ = cheerio.load(html)
18
+ // // ๐Ÿงน remove useless elements
19
+ // $('script, style, noscript, iframe').remove()
20
+ // function parseElement(elem: any, depth = 0): NodeType | null {
21
+ // if (!elem || depth > 6) return null
22
+ // const node: NodeType = {
23
+ // tag: elem.name,
24
+ // attrs: elem.attribs || {},
25
+ // children: [] as NodeType[] // โœ… FIX
26
+ // }
27
+ // for (const child of elem.children || []) {
28
+ // if (child.type === 'text') {
29
+ // const text = child.data.trim()
30
+ // if (text) {
31
+ // node.children!.push({ text })
32
+ // }
33
+ // } else if (child.type === 'tag') {
34
+ // const parsed = parseElement(child, depth + 1)
35
+ // if (parsed) {
36
+ // node.children!.push(parsed)
37
+ // }
38
+ // }
39
+ // }
40
+ // return node
41
+ // }
42
+ // return parseElement($('body')[0])
43
+ // }
44
+ // // ๐Ÿš€ Main runner
45
+ // async function run() {
46
+ // const browser = await remote({
47
+ // capabilities: {
48
+ // browserName: 'chrome'
49
+ // }
50
+ // })
51
+ // try {
52
+ // // ๐ŸŒ Open Amazon
53
+ // await browser.url('https://www.amzon.in/')
54
+ // // โณ wait for search box
55
+ // const searchBox = await browser.$('#twotabsearchtextbox')
56
+ // await searchBox.waitForDisplayed({ timeout: 10000 })
57
+ // // ๐Ÿ“„ Get HTML
58
+ // const html = await browser.getPageSource()
59
+ // // ๐Ÿ”„ Convert HTML โ†’ JSON
60
+ // const json = htmlToJson(html)
61
+ // // ๐Ÿ”„ JSON โ†’ TOON
62
+ // const start = performance.now()
63
+ // const encoded = encode({ data: json })
64
+ // const end = performance.now()
65
+ // console.log('HTML :', html.length)
66
+ // console.log('json size:', JSON.stringify(json).length)
67
+ // console.log('Encoded length:', encoded.length)
68
+ // console.log(`Time taken: ${(end - start).toFixed(2)} ms`)
69
+ // // ๐Ÿ’พ Save outputs (optional but useful)
70
+ // fs.writeFileSync('output.json', JSON.stringify(json, null, 2))
71
+ // fs.writeFileSync('output.toon', encoded)
72
+ // const enc = encoding_for_model("gpt-4") // closest available
73
+ // function countTokens(text: string) {
74
+ // return enc.encode(text).length
75
+ // }
76
+ // const jsonString = JSON.stringify(json)
77
+ // console.log("Token JSON count:", countTokens(jsonString))
78
+ // const jsonStringencoded = JSON.stringify(encoded)
79
+ // console.log("Token TOON count:", countTokens(jsonStringencoded))
80
+ // } catch (err) {
81
+ // console.error(err)
82
+ // } finally {
83
+ // await browser.deleteSession()
84
+ // }
85
+ // }
86
+ // run()
87
+ // console.log("hi")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-automationv2",
3
- "version": "2.2.20",
3
+ "version": "2.2.21",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "This lib is used to automate the manual testcase",