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.
- package/dist/tests/test12.js +2 -2
- package/dist/tests/test254.d.ts +0 -1
- package/dist/tests/test254.js +87 -82
- package/package.json +1 -1
package/dist/tests/test12.js
CHANGED
|
@@ -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
|
-
|
|
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",
|
package/dist/tests/test254.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tests/test254.js
CHANGED
|
@@ -1,82 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
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")
|