@rickcedwhat/playwright-smart-table 6.9.0 → 6.10.1
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/README.md +9 -6
- package/dist/engine/rowFinder.js +153 -168
- package/dist/engine/tableIteration.js +105 -120
- package/dist/engine/tableMapper.js +88 -103
- package/dist/minimalConfigContext.d.ts +1 -1
- package/dist/minimalConfigContext.js +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/presets/glide/columns.js +23 -32
- package/dist/presets/glide/headers.js +18 -27
- package/dist/presets/glide/index.d.ts +9 -9
- package/dist/presets/glide/index.js +24 -33
- package/dist/presets/mui.js +197 -124
- package/dist/presets/rdg.d.ts +1 -1
- package/dist/presets/rdg.js +32 -41
- package/dist/smartRow.js +209 -101
- package/dist/strategies/columns.js +2 -11
- package/dist/strategies/dedupe.js +3 -12
- package/dist/strategies/fill.js +20 -29
- package/dist/strategies/headers.js +22 -31
- package/dist/strategies/index.d.ts +7 -0
- package/dist/strategies/index.js +3 -0
- package/dist/strategies/loading.js +24 -33
- package/dist/strategies/pagination.d.ts +10 -0
- package/dist/strategies/pagination.js +49 -30
- package/dist/strategies/sorting.js +18 -31
- package/dist/strategies/stabilization.js +28 -37
- package/dist/strategies/viewport.d.ts +52 -0
- package/dist/strategies/viewport.js +123 -0
- package/dist/typeContext.d.ts +1 -1
- package/dist/typeContext.js +160 -5
- package/dist/types.d.ts +153 -5
- package/dist/useTable.js +142 -76
- package/dist/utils/debugUtils.js +5 -16
- package/dist/utils/elementTracker.js +27 -40
- package/dist/utils/mutex.js +5 -16
- package/dist/utils/navigationBarrier.js +25 -36
- package/dist/utils/paginationPath.d.ts +4 -1
- package/dist/utils/paginationPath.js +164 -141
- package/dist/utils/smartRowArray.js +2 -11
- package/dist/utils.js +4 -13
- package/package.json +13 -8
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.planNavigationPath = planNavigationPath;
|
|
13
4
|
exports.executeNavigationWithGoToPageRetry = executeNavigationWithGoToPageRetry;
|
|
14
5
|
exports.executeNavigationPath = executeNavigationPath;
|
|
6
|
+
function computeCost(path) {
|
|
7
|
+
return path.reduce((sum, step) => {
|
|
8
|
+
if ('count' in step)
|
|
9
|
+
return sum + step.count;
|
|
10
|
+
return sum + 1; // goToPage and goToLast count as 1
|
|
11
|
+
}, 0);
|
|
12
|
+
}
|
|
15
13
|
/**
|
|
16
14
|
* Plans an optimal path from currentPageIndex to targetPageIndex using available primitives.
|
|
17
15
|
* Prefers goToPage when present; otherwise uses bulk steps (goNextBulk / goPreviousBulk) then
|
|
18
16
|
* single steps (goNext / goPrevious). May choose to overshoot with bulk then step back when
|
|
19
17
|
* that reduces total primitive calls (e.g. page 3 → 12 with bulk 10: goNextBulk once, goPrevious once).
|
|
20
18
|
*/
|
|
21
|
-
function planNavigationPath(currentPageIndex, targetPageIndex, primitives) {
|
|
19
|
+
function planNavigationPath(currentPageIndex, targetPageIndex, primitives, totalPages) {
|
|
22
20
|
var _a, _b;
|
|
23
21
|
if (currentPageIndex === targetPageIndex)
|
|
24
22
|
return [];
|
|
@@ -32,37 +30,58 @@ function planNavigationPath(currentPageIndex, targetPageIndex, primitives) {
|
|
|
32
30
|
const stepsForward = targetPageIndex - currentPageIndex;
|
|
33
31
|
const hasBulk = !!(primitives.goNextBulk && nextBulkSize > 0);
|
|
34
32
|
const hasPrev = !!primitives.goPrevious;
|
|
33
|
+
let forwardPath = [];
|
|
35
34
|
if (!hasBulk || nextBulkSize <= 0) {
|
|
36
35
|
if (primitives.goNext) {
|
|
37
|
-
|
|
36
|
+
forwardPath = [{ type: 'goNext', count: stepsForward }];
|
|
38
37
|
}
|
|
39
|
-
return [];
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
bulkCountB =
|
|
49
|
-
overB =
|
|
50
|
-
|
|
39
|
+
else {
|
|
40
|
+
const bulkCountA = Math.floor(stepsForward / nextBulkSize);
|
|
41
|
+
const remA = stepsForward % nextBulkSize;
|
|
42
|
+
const totalA = (remA === 0 || primitives.goNext)
|
|
43
|
+
? bulkCountA + remA
|
|
44
|
+
: Infinity;
|
|
45
|
+
let totalB = Infinity;
|
|
46
|
+
let bulkCountB = 0;
|
|
47
|
+
let overB = 0;
|
|
48
|
+
if (hasPrev) {
|
|
49
|
+
bulkCountB = Math.ceil(stepsForward / nextBulkSize);
|
|
50
|
+
overB = bulkCountB * nextBulkSize - stepsForward;
|
|
51
|
+
totalB = bulkCountB + overB;
|
|
52
|
+
}
|
|
53
|
+
forwardPath = (totalB < totalA)
|
|
54
|
+
? (() => {
|
|
55
|
+
const path = [];
|
|
56
|
+
if (bulkCountB > 0)
|
|
57
|
+
path.push({ type: 'goNextBulk', count: bulkCountB });
|
|
58
|
+
if (overB > 0)
|
|
59
|
+
path.push({ type: 'goPrevious', count: overB });
|
|
60
|
+
return path;
|
|
61
|
+
})()
|
|
62
|
+
: Number.isFinite(totalA) ? (() => {
|
|
63
|
+
const path = [];
|
|
64
|
+
if (bulkCountA > 0)
|
|
65
|
+
path.push({ type: 'goNextBulk', count: bulkCountA });
|
|
66
|
+
if (remA > 0)
|
|
67
|
+
path.push({ type: 'goNext', count: remA });
|
|
68
|
+
return path;
|
|
69
|
+
})() : [];
|
|
51
70
|
}
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
if (totalPages !== undefined && primitives.goToLast) {
|
|
72
|
+
const lastPageIndex = totalPages - 1;
|
|
73
|
+
if (targetPageIndex <= lastPageIndex) {
|
|
74
|
+
// Evaluate wrap-around path
|
|
75
|
+
const backwardPath = planNavigationPath(lastPageIndex, targetPageIndex, primitives);
|
|
76
|
+
if (backwardPath.length > 0 || targetPageIndex === lastPageIndex) {
|
|
77
|
+
const wrapPath = [{ type: 'goToLast', targetIndex: lastPageIndex }, ...backwardPath];
|
|
78
|
+
if (forwardPath.length === 0 || computeCost(wrapPath) < computeCost(forwardPath)) {
|
|
79
|
+
return wrapPath;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
59
83
|
}
|
|
60
|
-
|
|
61
|
-
if (bulkCountA > 0)
|
|
62
|
-
path.push({ type: 'goNextBulk', count: bulkCountA });
|
|
63
|
-
if (remA > 0)
|
|
64
|
-
path.push({ type: 'goNext', count: remA });
|
|
65
|
-
return path;
|
|
84
|
+
return forwardPath;
|
|
66
85
|
}
|
|
67
86
|
// Backward: current → target
|
|
68
87
|
const stepsBack = currentPageIndex - targetPageIndex;
|
|
@@ -108,123 +127,127 @@ const MAX_GO_TO_PAGE_RETRIES = 200;
|
|
|
108
127
|
* steps once toward target (goNextBulk/goNext or goPreviousBulk/goPrevious), then retries.
|
|
109
128
|
* Example: from 3 to 38 with windowed goToPage → goToPage(38) false, goNextBulk(), goToPage(38) false, … goToPage(38) true.
|
|
110
129
|
*/
|
|
111
|
-
function executeNavigationWithGoToPageRetry(targetPageIndex, primitives, context, getCurrentPage, setCurrentPage) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
async function executeNavigationWithGoToPageRetry(targetPageIndex, primitives, context, getCurrentPage, setCurrentPage) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
if (!primitives.goToPage)
|
|
133
|
+
return;
|
|
134
|
+
for (let i = 0; i < MAX_GO_TO_PAGE_RETRIES; i++) {
|
|
135
|
+
const current = getCurrentPage();
|
|
136
|
+
if (current === targetPageIndex)
|
|
137
|
+
return;
|
|
138
|
+
const ok = await primitives.goToPage(targetPageIndex, context);
|
|
139
|
+
if (ok) {
|
|
140
|
+
setCurrentPage(targetPageIndex);
|
|
115
141
|
return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
142
|
+
}
|
|
143
|
+
// Step once toward target. Don't use bulk if it would overshoot and we can't step back (no goPrevious/goNext).
|
|
144
|
+
if (targetPageIndex > current) {
|
|
145
|
+
const nextBulkSize = (_a = primitives.nextBulkPages) !== null && _a !== void 0 ? _a : 1;
|
|
146
|
+
const wouldOvershoot = (current + nextBulkSize) > targetPageIndex;
|
|
147
|
+
const canStepBack = !!primitives.goPrevious;
|
|
148
|
+
const useBulk = primitives.goNextBulk && (!wouldOvershoot || canStepBack);
|
|
149
|
+
if (useBulk && primitives.goNextBulk) {
|
|
150
|
+
const result = await primitives.goNextBulk(context);
|
|
151
|
+
if (!result)
|
|
152
|
+
throw new Error('bringIntoView: goNextBulk failed during goToPage retry');
|
|
153
|
+
const jumped = typeof result === 'number' ? result : nextBulkSize;
|
|
154
|
+
setCurrentPage(getCurrentPage() + jumped);
|
|
155
|
+
}
|
|
156
|
+
else if (primitives.goNext) {
|
|
157
|
+
const stepped = await primitives.goNext(context);
|
|
158
|
+
if (!stepped)
|
|
159
|
+
throw new Error('bringIntoView: goNext failed during goToPage retry');
|
|
160
|
+
setCurrentPage(getCurrentPage() + 1);
|
|
124
161
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
162
|
+
else {
|
|
163
|
+
const available = Object.keys(primitives).filter(k => primitives[k]);
|
|
164
|
+
throw new Error(`bringIntoView: goToPage(${targetPageIndex}) returned false and no goNext/goNextBulk to advance. Available primitives: ${available.join(', ')}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const prevBulkSize = (_b = primitives.previousBulkPages) !== null && _b !== void 0 ? _b : 1;
|
|
169
|
+
const wouldOvershoot = (current - prevBulkSize) < targetPageIndex;
|
|
170
|
+
const canStepBack = !!primitives.goNext;
|
|
171
|
+
const useBulk = primitives.goPreviousBulk && (!wouldOvershoot || canStepBack);
|
|
172
|
+
if (useBulk && primitives.goPreviousBulk) {
|
|
173
|
+
const result = await primitives.goPreviousBulk(context);
|
|
174
|
+
if (!result)
|
|
175
|
+
throw new Error('bringIntoView: goPreviousBulk failed during goToPage retry');
|
|
176
|
+
const jumped = typeof result === 'number' ? result : prevBulkSize;
|
|
177
|
+
setCurrentPage(getCurrentPage() - jumped);
|
|
178
|
+
}
|
|
179
|
+
else if (primitives.goPrevious) {
|
|
180
|
+
const stepped = await primitives.goPrevious(context);
|
|
181
|
+
if (!stepped)
|
|
182
|
+
throw new Error('bringIntoView: goPrevious failed during goToPage retry');
|
|
183
|
+
setCurrentPage(getCurrentPage() - 1);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const available = Object.keys(primitives).filter(k => primitives[k]);
|
|
187
|
+
throw new Error(`bringIntoView: goToPage(${targetPageIndex}) returned false and no goPrevious/goPreviousBulk to step back. Available primitives: ${available.join(', ')}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const available = Object.keys(primitives).filter(k => primitives[k]);
|
|
192
|
+
throw new Error(`bringIntoView: failed to reach page ${targetPageIndex} after ${MAX_GO_TO_PAGE_RETRIES} goToPage retries. Available primitives: ${available.join(', ')}`);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Executes a navigation path by calling the corresponding primitives.
|
|
196
|
+
* Updates currentPageIndex via the provided setter as steps run.
|
|
197
|
+
*/
|
|
198
|
+
async function executeNavigationPath(path, primitives, context, getCurrentPage, setCurrentPage) {
|
|
199
|
+
for (const step of path) {
|
|
200
|
+
switch (step.type) {
|
|
201
|
+
case 'goToPage':
|
|
202
|
+
if (primitives.goToPage) {
|
|
203
|
+
const ok = await primitives.goToPage(step.pageIndex, context);
|
|
204
|
+
if (!ok)
|
|
205
|
+
throw new Error(`goToPage(${step.pageIndex}) failed`);
|
|
206
|
+
setCurrentPage(step.pageIndex);
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case 'goToLast':
|
|
210
|
+
if (primitives.goToLast) {
|
|
211
|
+
const ok = await primitives.goToLast(context);
|
|
212
|
+
if (!ok)
|
|
213
|
+
throw new Error(`goToLast failed`);
|
|
214
|
+
setCurrentPage(step.targetIndex);
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case 'goNextBulk':
|
|
218
|
+
for (let i = 0; i < step.count && primitives.goNextBulk; i++) {
|
|
219
|
+
const result = await primitives.goNextBulk(context);
|
|
133
220
|
if (!result)
|
|
134
|
-
throw new Error('
|
|
135
|
-
const jumped = typeof result === 'number' ? result :
|
|
221
|
+
throw new Error('goNextBulk failed');
|
|
222
|
+
const jumped = typeof result === 'number' ? result : 1;
|
|
136
223
|
setCurrentPage(getCurrentPage() + jumped);
|
|
137
224
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
225
|
+
break;
|
|
226
|
+
case 'goNext':
|
|
227
|
+
for (let i = 0; i < step.count && primitives.goNext; i++) {
|
|
228
|
+
const ok = await primitives.goNext(context);
|
|
229
|
+
if (!ok)
|
|
230
|
+
throw new Error('goNext failed');
|
|
142
231
|
setCurrentPage(getCurrentPage() + 1);
|
|
143
232
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
const prevBulkSize = (_b = primitives.previousBulkPages) !== null && _b !== void 0 ? _b : 1;
|
|
151
|
-
const wouldOvershoot = (current - prevBulkSize) < targetPageIndex;
|
|
152
|
-
const canStepBack = !!primitives.goNext;
|
|
153
|
-
const useBulk = primitives.goPreviousBulk && (!wouldOvershoot || canStepBack);
|
|
154
|
-
if (useBulk && primitives.goPreviousBulk) {
|
|
155
|
-
const result = yield primitives.goPreviousBulk(context);
|
|
233
|
+
break;
|
|
234
|
+
case 'goPreviousBulk':
|
|
235
|
+
for (let i = 0; i < step.count && primitives.goPreviousBulk; i++) {
|
|
236
|
+
const result = await primitives.goPreviousBulk(context);
|
|
156
237
|
if (!result)
|
|
157
|
-
throw new Error('
|
|
158
|
-
const jumped = typeof result === 'number' ? result :
|
|
238
|
+
throw new Error('goPreviousBulk failed');
|
|
239
|
+
const jumped = typeof result === 'number' ? result : 1;
|
|
159
240
|
setCurrentPage(getCurrentPage() - jumped);
|
|
160
241
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
242
|
+
break;
|
|
243
|
+
case 'goPrevious':
|
|
244
|
+
for (let i = 0; i < step.count && primitives.goPrevious; i++) {
|
|
245
|
+
const ok = await primitives.goPrevious(context);
|
|
246
|
+
if (!ok)
|
|
247
|
+
throw new Error('goPrevious failed');
|
|
165
248
|
setCurrentPage(getCurrentPage() - 1);
|
|
166
249
|
}
|
|
167
|
-
|
|
168
|
-
const available = Object.keys(primitives).filter(k => primitives[k]);
|
|
169
|
-
throw new Error(`bringIntoView: goToPage(${targetPageIndex}) returned false and no goPrevious/goPreviousBulk to step back. Available primitives: ${available.join(', ')}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const available = Object.keys(primitives).filter(k => primitives[k]);
|
|
174
|
-
throw new Error(`bringIntoView: failed to reach page ${targetPageIndex} after ${MAX_GO_TO_PAGE_RETRIES} goToPage retries. Available primitives: ${available.join(', ')}`);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Executes a navigation path by calling the corresponding primitives.
|
|
179
|
-
* Updates currentPageIndex via the provided setter as steps run.
|
|
180
|
-
*/
|
|
181
|
-
function executeNavigationPath(path, primitives, context, getCurrentPage, setCurrentPage) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
for (const step of path) {
|
|
184
|
-
switch (step.type) {
|
|
185
|
-
case 'goToPage':
|
|
186
|
-
if (primitives.goToPage) {
|
|
187
|
-
const ok = yield primitives.goToPage(step.pageIndex, context);
|
|
188
|
-
if (!ok)
|
|
189
|
-
throw new Error(`goToPage(${step.pageIndex}) failed`);
|
|
190
|
-
setCurrentPage(step.pageIndex);
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
case 'goNextBulk':
|
|
194
|
-
for (let i = 0; i < step.count && primitives.goNextBulk; i++) {
|
|
195
|
-
const result = yield primitives.goNextBulk(context);
|
|
196
|
-
if (!result)
|
|
197
|
-
throw new Error('goNextBulk failed');
|
|
198
|
-
const jumped = typeof result === 'number' ? result : 1;
|
|
199
|
-
setCurrentPage(getCurrentPage() + jumped);
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
202
|
-
case 'goNext':
|
|
203
|
-
for (let i = 0; i < step.count && primitives.goNext; i++) {
|
|
204
|
-
const ok = yield primitives.goNext(context);
|
|
205
|
-
if (!ok)
|
|
206
|
-
throw new Error('goNext failed');
|
|
207
|
-
setCurrentPage(getCurrentPage() + 1);
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
210
|
-
case 'goPreviousBulk':
|
|
211
|
-
for (let i = 0; i < step.count && primitives.goPreviousBulk; i++) {
|
|
212
|
-
const result = yield primitives.goPreviousBulk(context);
|
|
213
|
-
if (!result)
|
|
214
|
-
throw new Error('goPreviousBulk failed');
|
|
215
|
-
const jumped = typeof result === 'number' ? result : 1;
|
|
216
|
-
setCurrentPage(getCurrentPage() - jumped);
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
case 'goPrevious':
|
|
220
|
-
for (let i = 0; i < step.count && primitives.goPrevious; i++) {
|
|
221
|
-
const ok = yield primitives.goPrevious(context);
|
|
222
|
-
if (!ok)
|
|
223
|
-
throw new Error('goPrevious failed');
|
|
224
|
-
setCurrentPage(getCurrentPage() - 1);
|
|
225
|
-
}
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
250
|
+
break;
|
|
228
251
|
}
|
|
229
|
-
}
|
|
252
|
+
}
|
|
230
253
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.createSmartRowArray = createSmartRowArray;
|
|
13
4
|
/**
|
|
@@ -15,8 +6,8 @@ exports.createSmartRowArray = createSmartRowArray;
|
|
|
15
6
|
*/
|
|
16
7
|
function createSmartRowArray(rows) {
|
|
17
8
|
const arr = rows;
|
|
18
|
-
arr.toJSON = () =>
|
|
9
|
+
arr.toJSON = async () => {
|
|
19
10
|
return Promise.all(rows.map(r => r.toJSON()));
|
|
20
|
-
}
|
|
11
|
+
};
|
|
21
12
|
return arr;
|
|
22
13
|
}
|
package/dist/utils.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.waitForCondition = void 0;
|
|
13
4
|
/**
|
|
@@ -15,15 +6,15 @@ exports.waitForCondition = void 0;
|
|
|
15
6
|
* Replaces the dependency on 'expect(...).toPass()' to ensure compatibility
|
|
16
7
|
* with environments where 'expect' is not globally available.
|
|
17
8
|
*/
|
|
18
|
-
const waitForCondition = (predicate, timeout, page) =>
|
|
9
|
+
const waitForCondition = async (predicate, timeout, page) => {
|
|
19
10
|
const startTime = Date.now();
|
|
20
11
|
while (Date.now() - startTime < timeout) {
|
|
21
|
-
if (
|
|
12
|
+
if (await predicate()) {
|
|
22
13
|
return true;
|
|
23
14
|
}
|
|
24
15
|
// Wait 100ms before next check (Standard Polling)
|
|
25
|
-
|
|
16
|
+
await page.waitForTimeout(100).catch(() => new Promise(r => setTimeout(r, 100)));
|
|
26
17
|
}
|
|
27
18
|
return false;
|
|
28
|
-
}
|
|
19
|
+
};
|
|
29
20
|
exports.waitForCondition = waitForCondition;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rickcedwhat/playwright-smart-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.1",
|
|
4
4
|
"description": "Smart, column-aware table interactions for Playwright",
|
|
5
5
|
"author": "Cedrick Catalan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://rickcedwhat.github.io/playwright-smart-table/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/rickcedwhat/playwright-smart-table.git"
|
|
10
|
+
"url": "git+https://github.com/rickcedwhat/playwright-smart-table.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/rickcedwhat/playwright-smart-table/issues"
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
"generate-docs": "node scripts/generate-readme.mjs",
|
|
24
24
|
"generate-all-api-docs": "node scripts/generate-all-api-docs.mjs",
|
|
25
25
|
"update-all-api-signatures": "node scripts/update-all-api-signatures.mjs",
|
|
26
|
-
"docs:dev": "vitepress dev docs",
|
|
27
|
-
"docs:build": "
|
|
26
|
+
"docs:dev": "vitepress dev docs --host",
|
|
27
|
+
"docs:build": "node scripts/docs-build-prod.mjs",
|
|
28
|
+
"docs:build:all": "vitepress build docs",
|
|
28
29
|
"docs:verify-links": "node scripts/verify-vitepress-links.mjs",
|
|
29
30
|
"embed-version": "node scripts/embed-version.mjs",
|
|
30
31
|
"build": "npm run embed-version && npm run generate-types && npm run generate-config-types && npm run generate-docs && npm run generate-all-api-docs && npm run update-all-api-signatures && tsc",
|
|
@@ -39,9 +40,10 @@
|
|
|
39
40
|
"pretest:e2e": "npm run clean-port",
|
|
40
41
|
"posttest:e2e": "npm run clean-port",
|
|
41
42
|
"test:e2e": "npx playwright test",
|
|
43
|
+
"test:playground": "npx playwright test --config tests-external/playground/playwright.config.ts 2>&1 | tee \"tests-external/playground/logs/run-$(date +%Y%m%d-%H%M%S).log\"",
|
|
42
44
|
"dev:playground": "cd playground && npm run dev",
|
|
43
45
|
"dev:mui": "cd tests/apps/mui-datagrid && npm run dev",
|
|
44
|
-
"prepare": "husky
|
|
46
|
+
"prepare": "husky"
|
|
45
47
|
},
|
|
46
48
|
"exports": {
|
|
47
49
|
".": {
|
|
@@ -81,16 +83,19 @@
|
|
|
81
83
|
"@playwright/test": "^1.40.0"
|
|
82
84
|
},
|
|
83
85
|
"devDependencies": {
|
|
84
|
-
"@playwright/test": "^1.
|
|
86
|
+
"@playwright/test": "^1.59.1",
|
|
85
87
|
"@stryker-mutator/core": "^9.6.0",
|
|
86
88
|
"@stryker-mutator/vitest-runner": "^9.6.0",
|
|
87
|
-
"@types/node": "^25.
|
|
89
|
+
"@types/node": "^25.5.2",
|
|
88
90
|
"@vitest/coverage-v8": "^4.1.0",
|
|
89
91
|
"@vitest/ui": "^4.1.0",
|
|
90
92
|
"happy-dom": "^20.8.3",
|
|
91
93
|
"husky": "^9.1.7",
|
|
92
|
-
"typescript": "^
|
|
94
|
+
"typescript": "^6.0.2",
|
|
93
95
|
"vitepress": "^1.6.4",
|
|
94
96
|
"vitest": "^4.1.0"
|
|
97
|
+
},
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"@scarf/scarf": "^1.4.0"
|
|
95
100
|
}
|
|
96
101
|
}
|