@rickcedwhat/playwright-smart-table 6.23.0 → 6.23.1-next.60d6b2c
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/filterEngine.d.ts +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/presets/glide/headers.d.ts +3 -1
- package/dist/presets/glide/headers.js +12 -47
- package/dist/smartRow.d.ts +1 -1
- package/dist/smartRow.js +1 -2
- package/dist/strategies/headers.js +10 -53
- package/dist/utils/elementTracker.d.ts +1 -1
- package/dist/utils/headerScroll.d.ts +13 -0
- package/dist/utils/headerScroll.js +47 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
package/dist/filterEngine.d.ts
CHANGED
package/dist/packageVersion.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Generated by scripts/embed-version.mjs from package.json
|
|
4
4
|
*/
|
|
5
5
|
/** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
|
|
6
|
-
export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.23.
|
|
6
|
+
export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.23.1-next.60d6b2c";
|
package/dist/packageVersion.js
CHANGED
|
@@ -6,4 +6,4 @@ exports.PLAYWRIGHT_SMART_TABLE_VERSION = void 0;
|
|
|
6
6
|
* Generated by scripts/embed-version.mjs from package.json
|
|
7
7
|
*/
|
|
8
8
|
/** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
|
|
9
|
-
exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.23.
|
|
9
|
+
exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.23.1-next.60d6b2c";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { StrategyContext } from '../../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Glide header discovery. Same scroll loop as `HeaderStrategies.horizontalScroll`, but the
|
|
4
|
+
* `.dvn-scroller` is a sibling of the canvas root rather than an ancestor/descendant, so the
|
|
5
|
+
* lookup falls back to a document-wide search.
|
|
4
6
|
*/
|
|
5
7
|
export declare const scrollRightHeader: (context: StrategyContext, options?: {
|
|
6
8
|
limit?: number;
|
|
@@ -1,59 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scrollRightHeader = void 0;
|
|
4
|
-
const
|
|
4
|
+
const headerScroll_1 = require("../../utils/headerScroll");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Glide header discovery. Same scroll loop as `HeaderStrategies.horizontalScroll`, but the
|
|
7
|
+
* `.dvn-scroller` is a sibling of the canvas root rather than an ancestor/descendant, so the
|
|
8
|
+
* lookup falls back to a document-wide search.
|
|
7
9
|
*/
|
|
8
10
|
const scrollRightHeader = async (context, options) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const limit = (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : 20;
|
|
12
|
-
const scrollAmount = (_b = options === null || options === void 0 ? void 0 : options.scrollAmount) !== null && _b !== void 0 ? _b : 300;
|
|
13
|
-
const collectedHeaders = new Set();
|
|
14
|
-
const getVisible = async () => {
|
|
15
|
-
const headerLoc = resolve(config.headerSelector, root);
|
|
16
|
-
const texts = await headerLoc.allInnerTexts();
|
|
17
|
-
return texts.map(t => t.trim());
|
|
18
|
-
};
|
|
19
|
-
let currentHeaders = await getVisible();
|
|
20
|
-
currentHeaders.forEach(h => collectedHeaders.add(h));
|
|
21
|
-
const scrollerHandle = await root.evaluateHandle((el, selector) => {
|
|
11
|
+
const findScroller = () => context.root.evaluateHandle((el, selector) => {
|
|
12
|
+
var _a;
|
|
22
13
|
if (selector && el.matches(selector))
|
|
23
14
|
return el;
|
|
24
15
|
const effectiveSelector = selector || '.dvn-scroller';
|
|
25
|
-
|
|
26
|
-
if (ancestor)
|
|
27
|
-
return ancestor;
|
|
28
|
-
return document.querySelector(effectiveSelector);
|
|
16
|
+
return (_a = el.closest(effectiveSelector)) !== null && _a !== void 0 ? _a : document.querySelector(effectiveSelector);
|
|
29
17
|
}, options === null || options === void 0 ? void 0 : options.selector);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const sizeBefore = collectedHeaders.size;
|
|
36
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
37
|
-
await page.waitForTimeout(300);
|
|
38
|
-
const newHeaders = await getVisible();
|
|
39
|
-
newHeaders.forEach(h => collectedHeaders.add(h));
|
|
40
|
-
if (collectedHeaders.size === sizeBefore) {
|
|
41
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
42
|
-
await page.waitForTimeout(300);
|
|
43
|
-
const retryHeaders = await getVisible();
|
|
44
|
-
retryHeaders.forEach(h => collectedHeaders.add(h));
|
|
45
|
-
if (collectedHeaders.size === sizeBefore)
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
(0, debugUtils_1.logDebug)(config, 'info', "HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.");
|
|
52
|
-
}
|
|
53
|
-
if (isScrollerFound) {
|
|
54
|
-
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
55
|
-
await page.waitForTimeout(200);
|
|
56
|
-
}
|
|
57
|
-
return Array.from(collectedHeaders);
|
|
18
|
+
return (0, headerScroll_1.scrollAndCollectHeaders)(context, findScroller, {
|
|
19
|
+
limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
20
|
+
scrollAmount: options === null || options === void 0 ? void 0 : options.scrollAmount,
|
|
21
|
+
notFoundMessage: 'HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.',
|
|
22
|
+
});
|
|
58
23
|
};
|
|
59
24
|
exports.scrollRightHeader = scrollRightHeader;
|
package/dist/smartRow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locator, Page } from '@playwright/test';
|
|
2
2
|
import { SmartRow as SmartRowType, FinalTableConfig, TableResult } from './types';
|
|
3
3
|
import { NavigationBarrier } from './utils/navigationBarrier';
|
|
4
4
|
/**
|
package/dist/smartRow.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_1 = require("@playwright/test");
|
|
4
3
|
const rowResolution_1 = require("./engine/rowResolution");
|
|
5
4
|
const fill_1 = require("./strategies/fill");
|
|
6
5
|
const stringUtils_1 = require("./utils/stringUtils");
|
|
@@ -80,7 +79,7 @@ const _navigateToCell = async (params) => {
|
|
|
80
79
|
cellAttached = true;
|
|
81
80
|
}
|
|
82
81
|
catch (error) {
|
|
83
|
-
if (
|
|
82
|
+
if ((error === null || error === void 0 ? void 0 : error.name) !== 'TimeoutError')
|
|
84
83
|
throw error;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HeaderStrategies = void 0;
|
|
4
4
|
const debugUtils_1 = require("../utils/debugUtils");
|
|
5
|
+
const headerScroll_1 = require("../utils/headerScroll");
|
|
5
6
|
exports.HeaderStrategies = {
|
|
6
7
|
/**
|
|
7
8
|
* Default strategy: Returns only the headers currently visible in the DOM.
|
|
@@ -30,62 +31,18 @@ exports.HeaderStrategies = {
|
|
|
30
31
|
*/
|
|
31
32
|
horizontalScroll: (options) => {
|
|
32
33
|
return async (context) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const { resolve, config, root, page } = context;
|
|
35
|
-
const limit = (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : 20;
|
|
36
|
-
const scrollAmount = (_b = options === null || options === void 0 ? void 0 : options.scrollAmount) !== null && _b !== void 0 ? _b : 300;
|
|
37
|
-
const collectedHeaders = new Set();
|
|
38
|
-
const getVisible = async () => {
|
|
39
|
-
const headerLoc = resolve(config.headerSelector, root);
|
|
40
|
-
const texts = await headerLoc.allInnerTexts();
|
|
41
|
-
return texts.map(t => t.trim());
|
|
42
|
-
};
|
|
43
|
-
let currentHeaders = await getVisible();
|
|
44
|
-
currentHeaders.forEach(h => collectedHeaders.add(h));
|
|
45
34
|
const selector = options === null || options === void 0 ? void 0 : options.selector;
|
|
46
35
|
if (!selector) {
|
|
47
|
-
(0, debugUtils_1.logDebug)(config, 'info', 'HeaderStrategies.horizontalScroll: no selector provided — returning visible headers only. Pass { selector } for the scroll container (e.g. ".dvn-scroller").');
|
|
48
|
-
return
|
|
36
|
+
(0, debugUtils_1.logDebug)(context.config, 'info', 'HeaderStrategies.horizontalScroll: no selector provided — returning visible headers only. Pass { selector } for the scroll container (e.g. ".dvn-scroller").');
|
|
37
|
+
return (0, headerScroll_1.readVisibleHeaders)(context);
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (child)
|
|
58
|
-
return child;
|
|
59
|
-
return null;
|
|
60
|
-
}, selector);
|
|
61
|
-
const isScrollerFound = await scrollerHandle.evaluate(el => !!el);
|
|
62
|
-
if (isScrollerFound) {
|
|
63
|
-
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
64
|
-
await page.waitForTimeout(200);
|
|
65
|
-
for (let i = 0; i < limit; i++) {
|
|
66
|
-
const sizeBefore = collectedHeaders.size;
|
|
67
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
68
|
-
await page.waitForTimeout(300);
|
|
69
|
-
const newHeaders = await getVisible();
|
|
70
|
-
newHeaders.forEach(h => collectedHeaders.add(h));
|
|
71
|
-
if (collectedHeaders.size === sizeBefore) {
|
|
72
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
73
|
-
await page.waitForTimeout(300);
|
|
74
|
-
const retryHeaders = await getVisible();
|
|
75
|
-
retryHeaders.forEach(h => collectedHeaders.add(h));
|
|
76
|
-
if (collectedHeaders.size === sizeBefore)
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
(0, debugUtils_1.logDebug)(config, 'info', `HeaderStrategies.horizontalScroll: Could not find scroller matching "${selector}". Returning visible headers.`);
|
|
83
|
-
}
|
|
84
|
-
if (isScrollerFound) {
|
|
85
|
-
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
86
|
-
await page.waitForTimeout(200);
|
|
87
|
-
}
|
|
88
|
-
return Array.from(collectedHeaders);
|
|
39
|
+
// Self, then ancestor, then descendant — scoped to the table, never document-wide.
|
|
40
|
+
const findScroller = () => context.root.evaluateHandle((el, sel) => { var _a; return el.matches(sel) ? el : (_a = el.closest(sel)) !== null && _a !== void 0 ? _a : el.querySelector(sel); }, selector);
|
|
41
|
+
return (0, headerScroll_1.scrollAndCollectHeaders)(context, findScroller, {
|
|
42
|
+
limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
43
|
+
scrollAmount: options === null || options === void 0 ? void 0 : options.scrollAmount,
|
|
44
|
+
notFoundMessage: `HeaderStrategies.horizontalScroll: Could not find scroller matching "${selector}". Returning visible headers.`,
|
|
45
|
+
});
|
|
89
46
|
};
|
|
90
47
|
}
|
|
91
48
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSHandle } from '@playwright/test';
|
|
2
|
+
import type { StrategyContext } from '../types';
|
|
3
|
+
export declare const readVisibleHeaders: ({ resolve, config, root }: StrategyContext) => Promise<string[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Horizontal header discovery shared by `HeaderStrategies.horizontalScroll` and the Glide preset:
|
|
6
|
+
* reset the scroller to the left, step right collecting headers until two consecutive steps add
|
|
7
|
+
* nothing (or `limit` is hit), then scroll back. Callers differ only in how they find the scroller.
|
|
8
|
+
*/
|
|
9
|
+
export declare function scrollAndCollectHeaders(context: StrategyContext, findScroller: () => Promise<JSHandle<Element | null>>, options: {
|
|
10
|
+
limit?: number;
|
|
11
|
+
scrollAmount?: number;
|
|
12
|
+
notFoundMessage: string;
|
|
13
|
+
}): Promise<string[]>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readVisibleHeaders = void 0;
|
|
4
|
+
exports.scrollAndCollectHeaders = scrollAndCollectHeaders;
|
|
5
|
+
const debugUtils_1 = require("./debugUtils");
|
|
6
|
+
const readVisibleHeaders = async ({ resolve, config, root }) => {
|
|
7
|
+
const texts = await resolve(config.headerSelector, root).allInnerTexts();
|
|
8
|
+
return texts.map(t => t.trim());
|
|
9
|
+
};
|
|
10
|
+
exports.readVisibleHeaders = readVisibleHeaders;
|
|
11
|
+
/**
|
|
12
|
+
* Horizontal header discovery shared by `HeaderStrategies.horizontalScroll` and the Glide preset:
|
|
13
|
+
* reset the scroller to the left, step right collecting headers until two consecutive steps add
|
|
14
|
+
* nothing (or `limit` is hit), then scroll back. Callers differ only in how they find the scroller.
|
|
15
|
+
*/
|
|
16
|
+
async function scrollAndCollectHeaders(context, findScroller, options) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const { config, page } = context;
|
|
19
|
+
const limit = (_a = options.limit) !== null && _a !== void 0 ? _a : 20;
|
|
20
|
+
const scrollAmount = (_b = options.scrollAmount) !== null && _b !== void 0 ? _b : 300;
|
|
21
|
+
const collectedHeaders = new Set(await (0, exports.readVisibleHeaders)(context));
|
|
22
|
+
const scrollerHandle = await findScroller();
|
|
23
|
+
const isScrollerFound = await scrollerHandle.evaluate(el => !!el);
|
|
24
|
+
if (!isScrollerFound) {
|
|
25
|
+
(0, debugUtils_1.logDebug)(config, 'info', options.notFoundMessage);
|
|
26
|
+
return Array.from(collectedHeaders);
|
|
27
|
+
}
|
|
28
|
+
const collectAfterStep = async () => {
|
|
29
|
+
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
30
|
+
await page.waitForTimeout(300);
|
|
31
|
+
(await (0, exports.readVisibleHeaders)(context)).forEach(h => collectedHeaders.add(h));
|
|
32
|
+
};
|
|
33
|
+
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
34
|
+
await page.waitForTimeout(200);
|
|
35
|
+
for (let i = 0; i < limit; i++) {
|
|
36
|
+
const sizeBefore = collectedHeaders.size;
|
|
37
|
+
await collectAfterStep();
|
|
38
|
+
if (collectedHeaders.size === sizeBefore) {
|
|
39
|
+
await collectAfterStep();
|
|
40
|
+
if (collectedHeaders.size === sizeBefore)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
45
|
+
await page.waitForTimeout(200);
|
|
46
|
+
return Array.from(collectedHeaders);
|
|
47
|
+
}
|
package/dist/utils.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rickcedwhat/playwright-smart-table",
|
|
3
|
-
"version": "6.23.
|
|
3
|
+
"version": "6.23.1-next.60d6b2c",
|
|
4
4
|
"description": "Smart, column-aware table interactions for Playwright",
|
|
5
5
|
"author": "Cedrick Catalan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"docs:verify-links": "node scripts/verify-vitepress-links.mjs",
|
|
30
30
|
"embed-version": "node scripts/embed-version.mjs",
|
|
31
31
|
"generate-og": "node scripts/generate-og.mjs",
|
|
32
|
-
"build": "pnpm run embed-version && pnpm run generate-types && pnpm run generate-config-types && pnpm run generate-docs && pnpm run generate-all-api-docs && pnpm run update-all-api-signatures && tsc",
|
|
32
|
+
"build": "pnpm run embed-version && pnpm run generate-types && pnpm run generate-config-types && pnpm run generate-docs && pnpm run generate-all-api-docs && pnpm run update-all-api-signatures && tsc && node scripts/check-no-runtime-playwright.mjs",
|
|
33
33
|
"prepublishOnly": "pnpm run build",
|
|
34
34
|
"clean-port": "lsof -ti:3000 | xargs kill -9 || true",
|
|
35
35
|
"pretest": "pnpm run clean-port",
|