@rickcedwhat/playwright-smart-table 6.20.1-next.6671496 → 6.20.1-next.e170fdd
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/engine/rowFinder.d.ts +1 -0
- package/dist/engine/rowFinder.js +20 -16
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/useTable.js +10 -1
- package/package.json +1 -1
package/dist/engine/rowFinder.js
CHANGED
|
@@ -104,6 +104,22 @@ class RowFinder {
|
|
|
104
104
|
smartRow[sentinel_1.SENTINEL_ROW] = true;
|
|
105
105
|
return smartRow;
|
|
106
106
|
}
|
|
107
|
+
async waitForTableReady() {
|
|
108
|
+
var _a;
|
|
109
|
+
const isTableLoading = (_a = this.config.strategies.loading) === null || _a === void 0 ? void 0 : _a.isTableLoading;
|
|
110
|
+
if (!isTableLoading)
|
|
111
|
+
return;
|
|
112
|
+
const context = {
|
|
113
|
+
root: this.rootLocator,
|
|
114
|
+
config: this.config,
|
|
115
|
+
page: this.rootLocator.page(),
|
|
116
|
+
resolve: this.resolve
|
|
117
|
+
};
|
|
118
|
+
while (await isTableLoading(context)) {
|
|
119
|
+
(0, debugUtils_1.logDebug)(this.config, 'verbose', 'Table is loading... waiting');
|
|
120
|
+
await this.rootLocator.page().waitForTimeout(200);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
107
123
|
async findRows(filters = {}, options) {
|
|
108
124
|
var _a, _b, _c;
|
|
109
125
|
const filtersRecord = filters;
|
|
@@ -114,6 +130,7 @@ class RowFinder {
|
|
|
114
130
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `findRows: starting (maxPages=${effectiveMaxPages}, filters=${JSON.stringify(filtersRecord)})`);
|
|
115
131
|
const tracker = new elementTracker_1.ElementTracker('findRows');
|
|
116
132
|
try {
|
|
133
|
+
await this.waitForTableReady();
|
|
117
134
|
const { domFilters, overrideFilters, syntheticFilters } = this.splitFilters(filtersRecord);
|
|
118
135
|
const hasOverrideFilters = Object.keys(overrideFilters).length > 0;
|
|
119
136
|
const hasSyntheticFilters = Object.keys(syntheticFilters).length > 0;
|
|
@@ -186,26 +203,13 @@ class RowFinder {
|
|
|
186
203
|
return (0, smartRowArray_1.createSmartRowArray)(allRows);
|
|
187
204
|
}
|
|
188
205
|
async findRowLocator(filters, options = {}) {
|
|
189
|
-
var _a, _b
|
|
206
|
+
var _a, _b;
|
|
190
207
|
const map = await this.tableMapper.getMap();
|
|
191
208
|
const effectiveMaxPages = (_a = options.maxPages) !== null && _a !== void 0 ? _a : this.config.maxPages;
|
|
192
209
|
let pagesScanned = 1;
|
|
193
210
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `Looking for row: ${JSON.stringify(filters)} (MaxPages: ${effectiveMaxPages})`);
|
|
194
211
|
while (true) {
|
|
195
|
-
|
|
196
|
-
if ((_b = this.config.strategies.loading) === null || _b === void 0 ? void 0 : _b.isTableLoading) {
|
|
197
|
-
const isLoading = await this.config.strategies.loading.isTableLoading({
|
|
198
|
-
root: this.rootLocator,
|
|
199
|
-
config: this.config,
|
|
200
|
-
page: this.rootLocator.page(),
|
|
201
|
-
resolve: this.resolve
|
|
202
|
-
});
|
|
203
|
-
if (isLoading) {
|
|
204
|
-
(0, debugUtils_1.logDebug)(this.config, 'verbose', 'Table is loading... waiting');
|
|
205
|
-
await this.rootLocator.page().waitForTimeout(200);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
212
|
+
await this.waitForTableReady();
|
|
209
213
|
const allRows = this.resolve(this.config.rowSelector, this.rootLocator);
|
|
210
214
|
const { domFilters, overrideFilters, syntheticFilters } = this.splitFilters(filters);
|
|
211
215
|
const hasPostFilters = Object.keys(overrideFilters).length > 0 || Object.keys(syntheticFilters).length > 0;
|
|
@@ -242,7 +246,7 @@ class RowFinder {
|
|
|
242
246
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `Page ${this.tableState.currentPageIndex}: Not found. Attempting pagination...`);
|
|
243
247
|
// Default to single-step goNext; bulk is opt-in via useBulkPagination: true (#349).
|
|
244
248
|
// Bulk-by-default made findRow jump past the page holding the target row.
|
|
245
|
-
const useBulk = options.useBulkPagination === true && !!((
|
|
249
|
+
const useBulk = options.useBulkPagination === true && !!((_b = this.config.strategies.pagination) === null || _b === void 0 ? void 0 : _b.goNextBulk);
|
|
246
250
|
const prevPage = this.tableState.currentPageIndex;
|
|
247
251
|
const didLoadMore = await this.advancePage(useBulk);
|
|
248
252
|
if (didLoadMore) {
|
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.20.1-next.
|
|
6
|
+
export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.20.1-next.e170fdd";
|
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.20.1-next.
|
|
9
|
+
exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.20.1-next.e170fdd";
|
package/dist/useTable.js
CHANGED
|
@@ -301,7 +301,7 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
301
301
|
return resolve(config.headerSelector, rootLocator).nth(idx);
|
|
302
302
|
},
|
|
303
303
|
countRows: async (filters, options) => {
|
|
304
|
-
var _a, _b, _c, _d;
|
|
304
|
+
var _a, _b, _c, _d, _e;
|
|
305
305
|
if (tableState.empty)
|
|
306
306
|
return 0;
|
|
307
307
|
await _autoInit();
|
|
@@ -359,6 +359,15 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
359
359
|
}
|
|
360
360
|
return count;
|
|
361
361
|
};
|
|
362
|
+
// Wait for table to finish loading before counting
|
|
363
|
+
const isTableLoading = (_e = config.strategies.loading) === null || _e === void 0 ? void 0 : _e.isTableLoading;
|
|
364
|
+
if (isTableLoading) {
|
|
365
|
+
const ctx = createStrategyContext();
|
|
366
|
+
while (await isTableLoading(ctx)) {
|
|
367
|
+
log('countRows: table is loading... waiting');
|
|
368
|
+
await rootLocator.page().waitForTimeout(200);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
362
371
|
if (!hasPagination) {
|
|
363
372
|
log(`countRows: counting rows in current viewport (no pagination)${hasFilters ? ` filters=${safeStringify(filtersRecord)}` : ''}`);
|
|
364
373
|
if (!hasPostFilters)
|
package/package.json
CHANGED