@intuned/browser-dev 2.2.3-test-build.1 → 2.2.3-test-build.2
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/BROWSER_SCRIPTS_SETUP.md +78 -0
- package/dist/common/ensureBrowserScripts.js +2 -5
- package/dist/common/script.js +20 -20
- package/dist/helpers/clickUntilExhausted.js +3 -3
- package/dist/helpers/export.d.ts +5 -5
- package/dist/helpers/index.d.ts +5 -5
- package/dist/helpers/index.js +2 -8
- package/dist/helpers/tests/testClickUntilExhausted.spec.js +10 -25
- package/package.json +4 -2
- package/dist/common/assets/browser_scripts.js +0 -2596
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Browser Scripts Setup
|
|
2
|
+
|
|
3
|
+
This document explains how the TypeScript SDK handles the shared `browser_scripts.js` file from the monorepo root.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `common/browser_scripts.js` file at the root of the monorepo needs to be included in both the TypeScript and Python SDK builds. Instead of copying the file at runtime, we generate a TypeScript module that exports the script content as a constant.
|
|
8
|
+
|
|
9
|
+
## How It Works
|
|
10
|
+
|
|
11
|
+
1. **Source File**: `/common/browser_scripts.js` - The shared browser scripts file
|
|
12
|
+
2. **Generated File**: `/typescript-sdk/src/common/script.ts` - Auto-generated TypeScript module
|
|
13
|
+
3. **Generator Script**: `/typescript-sdk/scripts/generate-browser-script.js` - Node.js script that reads the source and generates the TS module
|
|
14
|
+
|
|
15
|
+
## Build Process
|
|
16
|
+
|
|
17
|
+
The generation happens automatically:
|
|
18
|
+
|
|
19
|
+
### During Installation
|
|
20
|
+
|
|
21
|
+
When you run `yarn install`, the `postinstall` hook automatically generates `script.ts`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn install # automatically runs generate-browser-script
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### During Build
|
|
28
|
+
|
|
29
|
+
The build script also regenerates `script.ts` before compiling:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn build # runs generate-browser-script → tsc → babel
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Manual Generation
|
|
36
|
+
|
|
37
|
+
You can manually regenerate the file:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn generate-browser-script
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage in Code
|
|
44
|
+
|
|
45
|
+
In `ensureBrowserScripts.ts`:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { BROWSER_SCRIPT } from "./script";
|
|
49
|
+
|
|
50
|
+
async function ensureBrowserScripts(page: Page): Promise<void> {
|
|
51
|
+
// Check if already loaded
|
|
52
|
+
const pageHasScript = await page.evaluate(
|
|
53
|
+
'() => typeof window.__INTUNED__ !== "undefined"'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (pageHasScript) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Inject the script
|
|
61
|
+
await page.evaluate(BROWSER_SCRIPT);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Important Notes
|
|
66
|
+
|
|
67
|
+
- **DO NOT** edit `script.ts` manually - it's auto-generated
|
|
68
|
+
- **DO NOT** commit `script.ts` to git - it's in `.gitignore`
|
|
69
|
+
- The file is regenerated on every build and install
|
|
70
|
+
- If you update `common/browser_scripts.js`, run `yarn generate-browser-script` to update
|
|
71
|
+
|
|
72
|
+
## Benefits
|
|
73
|
+
|
|
74
|
+
1. ✅ **No runtime file reading** - Script is bundled as a string constant
|
|
75
|
+
2. ✅ **Type-safe** - TypeScript can check imports
|
|
76
|
+
3. ✅ **Better performance** - No filesystem access at runtime
|
|
77
|
+
4. ✅ **Cleaner builds** - No need to copy .js files during build
|
|
78
|
+
5. ✅ **Single source of truth** - Always uses the latest from `common/`
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ensureBrowserScripts = ensureBrowserScripts;
|
|
7
|
-
var
|
|
8
|
-
var _path = require("path");
|
|
7
|
+
var _script = require("./script");
|
|
9
8
|
async function ensureBrowserScripts(page) {
|
|
10
9
|
const pageHasScript = await page.evaluate('() => typeof window.__INTUNED__ !== "undefined"');
|
|
11
10
|
if (pageHasScript) {
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
const scriptContent = (0, _fs.readFileSync)(scriptPath, "utf-8");
|
|
16
|
-
await page.evaluate(scriptContent);
|
|
13
|
+
await page.evaluate(_script.BROWSER_SCRIPT);
|
|
17
14
|
}
|
package/dist/common/script.js
CHANGED
|
@@ -822,7 +822,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
822
822
|
const mdCharsMatcher = /([\\\\[\\]()])/g;
|
|
823
823
|
function escapeMd(text) {
|
|
824
824
|
// Escapes markdown-sensitive characters within other markdown constructs.
|
|
825
|
-
return text.replace(mdCharsMatcher, "
|
|
825
|
+
return text.replace(mdCharsMatcher, "\\\\$1");
|
|
826
826
|
}
|
|
827
827
|
function listNumberingStart(attrs) {
|
|
828
828
|
const start = attrs.getNamedItem("start")?.value;
|
|
@@ -836,8 +836,8 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
836
836
|
const slashChars = "\\\\\`*_{}[]()#+-.!";
|
|
837
837
|
// Escape any special regex characters in slashChars
|
|
838
838
|
const escapedSlashChars = slashChars.replace(
|
|
839
|
-
/[
|
|
840
|
-
"
|
|
839
|
+
/[-/\\\\^$*+?.()|[\\]{}]/g,
|
|
840
|
+
"\\\\$&"
|
|
841
841
|
);
|
|
842
842
|
// Create the regular expression
|
|
843
843
|
const mdBackslashMatcher = new RegExp(
|
|
@@ -849,9 +849,9 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
849
849
|
const mdDashMatcher = new RegExp(\`^(\\\\s*)(-)(?=\\\\s|-)\`, "gm");
|
|
850
850
|
function escapeMdSection(text) {
|
|
851
851
|
text = text.replace(mdBackslashMatcher, "\\\\\\\\");
|
|
852
|
-
text = text.replace(mdDotMatcher, "
|
|
853
|
-
text = text.replace(mdPlusMatcher, "
|
|
854
|
-
text = text.replace(mdDashMatcher, "
|
|
852
|
+
text = text.replace(mdDotMatcher, "$1\\\\$2");
|
|
853
|
+
text = text.replace(mdPlusMatcher, "$1\\\\$2");
|
|
854
|
+
text = text.replace(mdDashMatcher, "$1\\\\$2");
|
|
855
855
|
return text;
|
|
856
856
|
}
|
|
857
857
|
function isFirstTbody(element) {
|
|
@@ -860,7 +860,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
860
860
|
element.nodeName === "TBODY" &&
|
|
861
861
|
(!previousSibling ||
|
|
862
862
|
(previousSibling.nodeName === "THEAD" &&
|
|
863
|
-
/^\\s
|
|
863
|
+
/^\\s*$/i.test(previousSibling.textContent ?? "")))
|
|
864
864
|
);
|
|
865
865
|
}
|
|
866
866
|
function isHeadingRow(tr) {
|
|
@@ -1324,7 +1324,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1324
1324
|
|
|
1325
1325
|
var node = {};
|
|
1326
1326
|
|
|
1327
|
-
var htmlToMarkdownAST
|
|
1327
|
+
var htmlToMarkdownAST$1 = {};
|
|
1328
1328
|
|
|
1329
1329
|
var ElementNode = {};
|
|
1330
1330
|
|
|
@@ -1365,9 +1365,9 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1365
1365
|
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20,
|
|
1366
1366
|
};
|
|
1367
1367
|
|
|
1368
|
-
Object.defineProperty(htmlToMarkdownAST
|
|
1369
|
-
htmlToMarkdownAST
|
|
1370
|
-
const ElementNode_1
|
|
1368
|
+
Object.defineProperty(htmlToMarkdownAST$1, "__esModule", { value: true });
|
|
1369
|
+
htmlToMarkdownAST$1.htmlToMarkdownAST = htmlToMarkdownAST;
|
|
1370
|
+
const ElementNode_1$1 = ElementNode;
|
|
1371
1371
|
function htmlToMarkdownAST(element, options, indentLevel = 0) {
|
|
1372
1372
|
let result = [];
|
|
1373
1373
|
const debugLog = (message) => {
|
|
@@ -1384,7 +1384,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1384
1384
|
if (overriddenElementProcessing) {
|
|
1385
1385
|
debugLog(\`Element Processing Overridden: '\${childElement.nodeType}'\`);
|
|
1386
1386
|
result.push(...overriddenElementProcessing);
|
|
1387
|
-
} else if (childElement.nodeType === ElementNode_1
|
|
1387
|
+
} else if (childElement.nodeType === ElementNode_1$1._Node.TEXT_NODE) {
|
|
1388
1388
|
const textContent = escapeMarkdownCharacters(
|
|
1389
1389
|
childElement.textContent?.trim() ?? ""
|
|
1390
1390
|
);
|
|
@@ -1396,9 +1396,9 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1396
1396
|
content: childElement.textContent?.trim(),
|
|
1397
1397
|
});
|
|
1398
1398
|
}
|
|
1399
|
-
} else if (childElement.nodeType === ElementNode_1
|
|
1399
|
+
} else if (childElement.nodeType === ElementNode_1$1._Node.ELEMENT_NODE) {
|
|
1400
1400
|
const elem = childElement;
|
|
1401
|
-
if (/^h[1-6]
|
|
1401
|
+
if (/^h[1-6]$/i.test(elem.tagName)) {
|
|
1402
1402
|
const level = parseInt(elem.tagName.substring(1));
|
|
1403
1403
|
const content = escapeMarkdownCharacters(
|
|
1404
1404
|
elem.textContent || ""
|
|
@@ -1443,7 +1443,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1443
1443
|
// if all children are text,
|
|
1444
1444
|
if (
|
|
1445
1445
|
Array.from(elem.childNodes).every(
|
|
1446
|
-
(_) => _.nodeType === ElementNode_1
|
|
1446
|
+
(_) => _.nodeType === ElementNode_1$1._Node.TEXT_NODE
|
|
1447
1447
|
)
|
|
1448
1448
|
) {
|
|
1449
1449
|
result.push({
|
|
@@ -1537,7 +1537,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1537
1537
|
const cellNode = {
|
|
1538
1538
|
type: "tableCell",
|
|
1539
1539
|
content:
|
|
1540
|
-
cell.nodeType === ElementNode_1
|
|
1540
|
+
cell.nodeType === ElementNode_1$1._Node.TEXT_NODE
|
|
1541
1541
|
? escapeMarkdownCharacters(cell.textContent?.trim() ?? "")
|
|
1542
1542
|
: htmlToMarkdownAST(cell, options, indentLevel + 1),
|
|
1543
1543
|
colId: colIds[columnIndex],
|
|
@@ -1751,7 +1751,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1751
1751
|
.replace(/</g, "<")
|
|
1752
1752
|
.replace(/>/g, ">");
|
|
1753
1753
|
// Then escape characters that have special meaning in Markdown
|
|
1754
|
-
escapedText = escapedText.replace(/([\\\\\`*_{}[\\]#+!|])/g, "
|
|
1754
|
+
escapedText = escapedText.replace(/([\\\\\`*_{}[\\]#+!|])/g, "\\\\$1");
|
|
1755
1755
|
return escapedText;
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
@@ -1763,9 +1763,9 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
1763
1763
|
if (hasRequiredMarkdownASTToString) return markdownASTToString;
|
|
1764
1764
|
hasRequiredMarkdownASTToString = 1;
|
|
1765
1765
|
Object.defineProperty(markdownASTToString, "__esModule", { value: true });
|
|
1766
|
-
markdownASTToString.markdownASTToString = markdownASTToString
|
|
1766
|
+
markdownASTToString.markdownASTToString = markdownASTToString$1;
|
|
1767
1767
|
const index_1 = requireNode();
|
|
1768
|
-
function markdownASTToString
|
|
1768
|
+
function markdownASTToString$1(nodes, options, indentLevel = 0) {
|
|
1769
1769
|
let markdownString = "";
|
|
1770
1770
|
markdownString += markdownMetaASTToString(nodes, options, indentLevel);
|
|
1771
1771
|
markdownString += markdownContentASTToString(nodes, options, indentLevel);
|
|
@@ -2477,7 +2477,7 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
|
|
|
2477
2477
|
exports.convertElementToMarkdown = convertElementToMarkdown;
|
|
2478
2478
|
exports.findInMarkdownAST = findInMarkdownAST;
|
|
2479
2479
|
exports.findAllInMarkdownAST = findAllInMarkdownAST;
|
|
2480
|
-
const htmlToMarkdownAST_1 = htmlToMarkdownAST
|
|
2480
|
+
const htmlToMarkdownAST_1 = htmlToMarkdownAST$1;
|
|
2481
2481
|
Object.defineProperty(exports, "htmlToMarkdownAST", {
|
|
2482
2482
|
enumerable: true,
|
|
2483
2483
|
get: function () {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.clickUntilExhausted = exports.clickButtonAndWait = void 0;
|
|
7
7
|
var _withNetworkSettledWait = require("./withNetworkSettledWait");
|
|
8
8
|
var _Logger = require("../common/Logger");
|
|
9
9
|
const getContainerState = async container => {
|
|
@@ -35,7 +35,7 @@ const clickButtonAndWait = async input => {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
exports.clickButtonAndWait = clickButtonAndWait;
|
|
38
|
-
const
|
|
38
|
+
const clickUntilExhausted = async input => {
|
|
39
39
|
const {
|
|
40
40
|
page,
|
|
41
41
|
buttonLocator,
|
|
@@ -82,4 +82,4 @@ const clickButtonUntilNoChange = async input => {
|
|
|
82
82
|
timeoutInMs: 30000
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
exports.
|
|
85
|
+
exports.clickUntilExhausted = clickUntilExhausted;
|
package/dist/helpers/export.d.ts
CHANGED
|
@@ -367,13 +367,13 @@ export declare function clickButtonAndWait(input: {
|
|
|
367
367
|
*
|
|
368
368
|
* @example
|
|
369
369
|
* ```typescript Load All Items
|
|
370
|
-
* import {
|
|
370
|
+
* import { clickUntilExhausted } from "@intuned/browser";
|
|
371
371
|
* export default async function handler(params, page, context){
|
|
372
372
|
* await page.goto("https://example.com/products");
|
|
373
373
|
* const loadMoreButton = page.locator("button:has-text('Load More')");
|
|
374
374
|
*
|
|
375
375
|
* // Click until button disappears or is disabled
|
|
376
|
-
* await
|
|
376
|
+
* await clickUntilExhausted({
|
|
377
377
|
* page,
|
|
378
378
|
* buttonLocator: loadMoreButton,
|
|
379
379
|
* maxClicks: 20
|
|
@@ -383,14 +383,14 @@ export declare function clickButtonAndWait(input: {
|
|
|
383
383
|
*
|
|
384
384
|
* @example
|
|
385
385
|
* ```typescript Track Container Changes
|
|
386
|
-
* import {
|
|
386
|
+
* import { clickUntilExhausted } from "@intuned/browser";
|
|
387
387
|
* export default async function handler(params, page, context){
|
|
388
388
|
* await page.goto("https://example.com/products");
|
|
389
389
|
* const loadMoreButton = page.locator("#load-more");
|
|
390
390
|
* const productsContainer = page.locator("#products-list");
|
|
391
391
|
*
|
|
392
392
|
* let clickCount = 0;
|
|
393
|
-
* await
|
|
393
|
+
* await clickUntilExhausted({
|
|
394
394
|
* page,
|
|
395
395
|
* buttonLocator: loadMoreButton,
|
|
396
396
|
* containerLocator: productsContainer,
|
|
@@ -405,7 +405,7 @@ export declare function clickButtonAndWait(input: {
|
|
|
405
405
|
* }
|
|
406
406
|
* ```
|
|
407
407
|
*/
|
|
408
|
-
export declare function
|
|
408
|
+
export declare function clickUntilExhausted(input: {
|
|
409
409
|
page: Page;
|
|
410
410
|
buttonLocator: Locator;
|
|
411
411
|
heartbeat?: CallableFunction;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -367,13 +367,13 @@ export declare function clickButtonAndWait(input: {
|
|
|
367
367
|
*
|
|
368
368
|
* @example
|
|
369
369
|
* ```typescript Load All Items
|
|
370
|
-
* import {
|
|
370
|
+
* import { clickUntilExhausted } from "@intuned/browser";
|
|
371
371
|
* export default async function handler(params, page, context){
|
|
372
372
|
* await page.goto("https://example.com/products");
|
|
373
373
|
* const loadMoreButton = page.locator("button:has-text('Load More')");
|
|
374
374
|
*
|
|
375
375
|
* // Click until button disappears or is disabled
|
|
376
|
-
* await
|
|
376
|
+
* await clickUntilExhausted({
|
|
377
377
|
* page,
|
|
378
378
|
* buttonLocator: loadMoreButton,
|
|
379
379
|
* maxClicks: 20
|
|
@@ -383,14 +383,14 @@ export declare function clickButtonAndWait(input: {
|
|
|
383
383
|
*
|
|
384
384
|
* @example
|
|
385
385
|
* ```typescript Track Container Changes
|
|
386
|
-
* import {
|
|
386
|
+
* import { clickUntilExhausted } from "@intuned/browser";
|
|
387
387
|
* export default async function handler(params, page, context){
|
|
388
388
|
* await page.goto("https://example.com/products");
|
|
389
389
|
* const loadMoreButton = page.locator("#load-more");
|
|
390
390
|
* const productsContainer = page.locator("#products-list");
|
|
391
391
|
*
|
|
392
392
|
* let clickCount = 0;
|
|
393
|
-
* await
|
|
393
|
+
* await clickUntilExhausted({
|
|
394
394
|
* page,
|
|
395
395
|
* buttonLocator: loadMoreButton,
|
|
396
396
|
* containerLocator: productsContainer,
|
|
@@ -405,7 +405,7 @@ export declare function clickButtonAndWait(input: {
|
|
|
405
405
|
* }
|
|
406
406
|
* ```
|
|
407
407
|
*/
|
|
408
|
-
export declare function
|
|
408
|
+
export declare function clickUntilExhausted(input: {
|
|
409
409
|
page: Page;
|
|
410
410
|
buttonLocator: Locator;
|
|
411
411
|
heartbeat?: CallableFunction;
|
package/dist/helpers/index.js
CHANGED
|
@@ -21,16 +21,10 @@ Object.defineProperty(exports, "CustomTypeValidator", {
|
|
|
21
21
|
return _types.CustomTypeValidator;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "clickUntilExhausted", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return _clickUntilExhausted.
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "clickButtonUntilNoChange", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _clickUntilExhausted.clickButtonUntilNoChange;
|
|
27
|
+
return _clickUntilExhausted.clickUntilExhausted;
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
30
|
Object.defineProperty(exports, "downloadFile", {
|
|
@@ -223,28 +223,13 @@ const noChangeThresholdHtml = `
|
|
|
223
223
|
(0, _extendedTest.afterEach)(async () => {
|
|
224
224
|
await page.close();
|
|
225
225
|
});
|
|
226
|
-
(0, _extendedTest.describe)("
|
|
227
|
-
(0, _extendedTest.test)("should click button and wait for content", async () => {
|
|
228
|
-
await page.setContent(basicClickHtml);
|
|
229
|
-
const initialCount = await page.locator(".item").count();
|
|
230
|
-
(0, _extendedTest.expect)(initialCount).toBe(3);
|
|
231
|
-
const buttonLocator = page.locator("#load-more");
|
|
232
|
-
await (0, _.clickButtonAndWait)({
|
|
233
|
-
page,
|
|
234
|
-
buttonLocator,
|
|
235
|
-
clickDelay: 0.1
|
|
236
|
-
});
|
|
237
|
-
const finalCount = await page.locator(".item").count();
|
|
238
|
-
(0, _extendedTest.expect)(finalCount).toBe(4);
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
(0, _extendedTest.describe)("clickButtonUntilNoChange", () => {
|
|
226
|
+
(0, _extendedTest.describe)("clickUntilExhausted", () => {
|
|
242
227
|
(0, _extendedTest.test)("should click button until max items loaded with default parameters", async () => {
|
|
243
228
|
await page.setContent(basicClickHtml);
|
|
244
229
|
const initialCount = await page.locator(".item").count();
|
|
245
230
|
(0, _extendedTest.expect)(initialCount).toBe(3);
|
|
246
231
|
const buttonLocator = page.locator("#load-more");
|
|
247
|
-
await (0, _.
|
|
232
|
+
await (0, _.clickUntilExhausted)({
|
|
248
233
|
page,
|
|
249
234
|
buttonLocator
|
|
250
235
|
});
|
|
@@ -256,7 +241,7 @@ const noChangeThresholdHtml = `
|
|
|
256
241
|
const initialCount = await page.locator(".item").count();
|
|
257
242
|
(0, _extendedTest.expect)(initialCount).toBe(3);
|
|
258
243
|
const buttonLocator = page.locator("#load-more");
|
|
259
|
-
await (0, _.
|
|
244
|
+
await (0, _.clickUntilExhausted)({
|
|
260
245
|
page,
|
|
261
246
|
buttonLocator,
|
|
262
247
|
maxClicks: 3,
|
|
@@ -272,7 +257,7 @@ const noChangeThresholdHtml = `
|
|
|
272
257
|
heartbeatCalls.push(1);
|
|
273
258
|
};
|
|
274
259
|
const buttonLocator = page.locator("#load-more");
|
|
275
|
-
await (0, _.
|
|
260
|
+
await (0, _.clickUntilExhausted)({
|
|
276
261
|
page,
|
|
277
262
|
buttonLocator,
|
|
278
263
|
heartbeat: onHeartbeat,
|
|
@@ -286,7 +271,7 @@ const noChangeThresholdHtml = `
|
|
|
286
271
|
const initialCount = await page.locator(".item").count();
|
|
287
272
|
(0, _extendedTest.expect)(initialCount).toBe(1);
|
|
288
273
|
const buttonLocator = page.locator("#load-more");
|
|
289
|
-
await (0, _.
|
|
274
|
+
await (0, _.clickUntilExhausted)({
|
|
290
275
|
page,
|
|
291
276
|
buttonLocator,
|
|
292
277
|
maxClicks: 20,
|
|
@@ -302,7 +287,7 @@ const noChangeThresholdHtml = `
|
|
|
302
287
|
const initialCount = await page.locator(".item").count();
|
|
303
288
|
(0, _extendedTest.expect)(initialCount).toBe(1);
|
|
304
289
|
const buttonLocator = page.locator("#load-more");
|
|
305
|
-
await (0, _.
|
|
290
|
+
await (0, _.clickUntilExhausted)({
|
|
306
291
|
page,
|
|
307
292
|
buttonLocator,
|
|
308
293
|
maxClicks: 20,
|
|
@@ -319,7 +304,7 @@ const noChangeThresholdHtml = `
|
|
|
319
304
|
(0, _extendedTest.expect)(initialCount).toBe(2);
|
|
320
305
|
const buttonLocator = page.locator("#load-more");
|
|
321
306
|
const containerLocator = page.locator("#container");
|
|
322
|
-
await (0, _.
|
|
307
|
+
await (0, _.clickUntilExhausted)({
|
|
323
308
|
page,
|
|
324
309
|
buttonLocator,
|
|
325
310
|
containerLocator,
|
|
@@ -335,7 +320,7 @@ const noChangeThresholdHtml = `
|
|
|
335
320
|
(0, _extendedTest.expect)(initialCount).toBe(1);
|
|
336
321
|
const buttonLocator = page.locator("#load-more");
|
|
337
322
|
const containerLocator = page.locator("#content");
|
|
338
|
-
await (0, _.
|
|
323
|
+
await (0, _.clickUntilExhausted)({
|
|
339
324
|
page,
|
|
340
325
|
buttonLocator,
|
|
341
326
|
containerLocator,
|
|
@@ -351,7 +336,7 @@ const noChangeThresholdHtml = `
|
|
|
351
336
|
const initialCount = await page.locator(".item").count();
|
|
352
337
|
(0, _extendedTest.expect)(initialCount).toBe(3);
|
|
353
338
|
const buttonLocator = page.locator("#load-more");
|
|
354
|
-
await (0, _.
|
|
339
|
+
await (0, _.clickUntilExhausted)({
|
|
355
340
|
page,
|
|
356
341
|
buttonLocator,
|
|
357
342
|
maxClicks: 3,
|
|
@@ -370,7 +355,7 @@ const noChangeThresholdHtml = `
|
|
|
370
355
|
(0, _extendedTest.expect)(initialCount).toBe(2);
|
|
371
356
|
const buttonLocator = page.locator("#load-more");
|
|
372
357
|
const containerLocator = page.locator("#container");
|
|
373
|
-
await (0, _.
|
|
358
|
+
await (0, _.clickUntilExhausted)({
|
|
374
359
|
page,
|
|
375
360
|
buttonLocator,
|
|
376
361
|
heartbeat: onHeartbeat,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/browser-dev",
|
|
3
|
-
"version": "2.2.3-test-build.
|
|
3
|
+
"version": "2.2.3-test-build.2",
|
|
4
4
|
"description": "runner package for intuned functions",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"typesVersions": {
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"author": "Intuned Team",
|
|
36
36
|
"license": "Elastic-2.0",
|
|
37
37
|
"scripts": {
|
|
38
|
-
"
|
|
38
|
+
"generate-browser-script": "node scripts/generate-browser-script.js",
|
|
39
|
+
"postinstall": "yarn generate-browser-script",
|
|
40
|
+
"build": "rm -rf dist && yarn generate-browser-script && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && node scripts/ensure-index-types.js",
|
|
39
41
|
"ensure-types": "node scripts/ensure-index-types.js",
|
|
40
42
|
"test": "vitest run",
|
|
41
43
|
"test:dev": "vitest",
|