@rickcedwhat/playwright-smart-table 2.0.6 → 2.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.
|
@@ -20,9 +20,11 @@ export declare const TableStrategies: {
|
|
|
20
20
|
* * @param options.timeout - Wait timeout (default: 5000ms)
|
|
21
21
|
* @param options.scrollerSelector - (Optional) Selector for the scrollable container.
|
|
22
22
|
* If omitted, tries to scroll the table root.
|
|
23
|
+
* @param options.interval - (Optional) Polling interval in ms (default: 1000ms)
|
|
23
24
|
*/
|
|
24
25
|
infiniteScroll: (options?: {
|
|
25
26
|
timeout?: number;
|
|
26
27
|
scrollerSelector?: Selector;
|
|
28
|
+
interval?: number;
|
|
27
29
|
}) => PaginationStrategy;
|
|
28
30
|
};
|
package/dist/strategies/index.js
CHANGED
|
@@ -79,14 +79,18 @@ exports.TableStrategies = {
|
|
|
79
79
|
* * @param options.timeout - Wait timeout (default: 5000ms)
|
|
80
80
|
* @param options.scrollerSelector - (Optional) Selector for the scrollable container.
|
|
81
81
|
* If omitted, tries to scroll the table root.
|
|
82
|
+
* @param options.interval - (Optional) Polling interval in ms (default: 1000ms)
|
|
82
83
|
*/
|
|
83
84
|
infiniteScroll: (options) => {
|
|
84
|
-
const { timeout = 5000, scrollerSelector } = options || {};
|
|
85
|
+
const { timeout = 5000, scrollerSelector, interval = 1000 } = options || {};
|
|
85
86
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ root, config, resolve, page }) {
|
|
86
87
|
const rows = resolve(config.rowSelector, root);
|
|
87
88
|
const oldCount = yield rows.count();
|
|
88
89
|
if (oldCount === 0)
|
|
89
90
|
return false;
|
|
91
|
+
// Aggressive Scroll Logic:
|
|
92
|
+
// We use expect.poll to RETRY the scroll action if the count hasn't increased.
|
|
93
|
+
// This fixes flakiness where the first scroll might be missed by the intersection observer.
|
|
90
94
|
try {
|
|
91
95
|
yield test_1.expect.poll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
96
|
// 1. Determine target container
|
|
@@ -108,7 +112,11 @@ exports.TableStrategies = {
|
|
|
108
112
|
yield page.keyboard.press('End');
|
|
109
113
|
// 3. Return count for assertion
|
|
110
114
|
return rows.count();
|
|
111
|
-
}), {
|
|
115
|
+
}), {
|
|
116
|
+
timeout,
|
|
117
|
+
// ✅ FIX: Use user-provided interval (default 1000ms)
|
|
118
|
+
intervals: [interval]
|
|
119
|
+
}).toBeGreaterThan(oldCount);
|
|
112
120
|
return true;
|
|
113
121
|
}
|
|
114
122
|
catch (e) {
|
package/package.json
CHANGED