@lowdefy/e2e-utils 7.0.0 → 7.2.0
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.
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { findInteractiveControls, journeyTargetSelectors, type } from '@lowdefy/helpers';
|
|
16
|
-
const { blockWrapperPrefix,
|
|
16
|
+
const { blockWrapperPrefix, gridSelector, layers } = journeyTargetSelectors;
|
|
17
17
|
function textOf(element) {
|
|
18
18
|
return element.textContent.replace(/\s+/g, ' ').trim();
|
|
19
19
|
}
|
|
@@ -23,9 +23,6 @@ function controlsIn(roots) {
|
|
|
23
23
|
function controlsWithText(roots, text) {
|
|
24
24
|
return controlsIn(roots).filter((control)=>textOf(control) === text);
|
|
25
25
|
}
|
|
26
|
-
function attributeSelector(value) {
|
|
27
|
-
return `"${String(value).replace(/["\\]/g, '\\$&')}"`;
|
|
28
|
-
}
|
|
29
26
|
// The roots the target's scope keys name: the block wrapper, narrowed to every grid row with the
|
|
30
27
|
// row index (ag-grid renders a row once per pinned and centre container) and to the cells with
|
|
31
28
|
// the column id inside them. Null for a page-wide target.
|
|
@@ -39,12 +36,18 @@ function resolveScope({ document, target }) {
|
|
|
39
36
|
] : [];
|
|
40
37
|
if (!type.isNone(target.row)) {
|
|
41
38
|
roots = roots.flatMap((root)=>[
|
|
42
|
-
...root.querySelectorAll(
|
|
39
|
+
...root.querySelectorAll(gridSelector({
|
|
40
|
+
kind: 'row',
|
|
41
|
+
value: target.row
|
|
42
|
+
}))
|
|
43
43
|
]);
|
|
44
44
|
}
|
|
45
45
|
if (!type.isNone(target.column)) {
|
|
46
46
|
roots = roots.flatMap((root)=>[
|
|
47
|
-
...root.querySelectorAll(
|
|
47
|
+
...root.querySelectorAll(gridSelector({
|
|
48
|
+
kind: 'cell',
|
|
49
|
+
value: target.column
|
|
50
|
+
}))
|
|
48
51
|
]);
|
|
49
52
|
}
|
|
50
53
|
return roots;
|
|
@@ -54,6 +54,36 @@ const grid = `
|
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</div>`;
|
|
57
|
+
const tableGrid = `
|
|
58
|
+
<div id="bl-people">
|
|
59
|
+
<div class="lf-table" role="grid">
|
|
60
|
+
<div class="lf-table-header">
|
|
61
|
+
<div class="lf-table-row lf-table-group-row" role="row">
|
|
62
|
+
<div class="lf-table-gridcell" data-group="person" role="columnheader"><button aria-label="Collapse"></button></div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="lf-table-row" data-row-index="-1" role="row">
|
|
65
|
+
<div class="lf-table-gridcell" data-col-key="select" data-lf-cell="" data-lf-header="" role="columnheader"><input type="checkbox" /></div>
|
|
66
|
+
<div class="lf-table-gridcell" data-col-key="name" data-lf-cell="" data-lf-header="" role="columnheader"><span>Name</span></div>
|
|
67
|
+
<div class="lf-table-gridcell" data-col-key="actions" data-lf-cell="" data-lf-header="" role="columnheader"><span>Actions</span></div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="lf-table-body">
|
|
71
|
+
<div class="lf-table-row" data-row-index="0" data-row-key="a1" role="row">
|
|
72
|
+
<div class="lf-table-gridcell" data-col-key="name" role="gridcell">Jane</div>
|
|
73
|
+
<div class="lf-table-gridcell" data-col-key="actions" role="gridcell"><button><span>Edit</span></button><button><span>Delete</span></button></div>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="lf-table-row" data-row-index="1" data-row-key="b2" role="row">
|
|
76
|
+
<div class="lf-table-gridcell" data-col-key="name" role="gridcell">Sam</div>
|
|
77
|
+
<div class="lf-table-gridcell" data-col-key="actions" role="gridcell"><button><span>Edit</span></button><button><span>Delete</span></button></div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="lf-table-footer" role="rowgroup">
|
|
81
|
+
<div class="lf-table-row lf-table-summary-row" data-summary="row" role="row">
|
|
82
|
+
<div class="lf-table-gridcell" data-col-key="actions" role="gridcell"><button><span>Export</span></button></div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>`;
|
|
57
87
|
function selectorOptions({ blockId, options }) {
|
|
58
88
|
return `
|
|
59
89
|
<div id="bl-${blockId}">
|
|
@@ -353,6 +383,94 @@ const targetFixtures = [
|
|
|
353
383
|
resolvable: true,
|
|
354
384
|
variants: []
|
|
355
385
|
},
|
|
386
|
+
{
|
|
387
|
+
name: 'Table cell button by row and text',
|
|
388
|
+
html: tableGrid,
|
|
389
|
+
element: '[data-row-index="1"] [data-col-key="actions"] button:nth-of-type(1)',
|
|
390
|
+
clicked: '[data-row-index="1"] [data-col-key="actions"] button:nth-of-type(1) span',
|
|
391
|
+
target: target({
|
|
392
|
+
block_id: 'people',
|
|
393
|
+
row: 1,
|
|
394
|
+
column: 'actions',
|
|
395
|
+
text: 'Edit'
|
|
396
|
+
}),
|
|
397
|
+
blockIds: [
|
|
398
|
+
'people'
|
|
399
|
+
],
|
|
400
|
+
resolvable: true,
|
|
401
|
+
variants: [
|
|
402
|
+
{
|
|
403
|
+
block_id: 'people',
|
|
404
|
+
row: 1,
|
|
405
|
+
text: 'Edit'
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'Table row button, by row and text only',
|
|
411
|
+
html: tableGrid,
|
|
412
|
+
element: '[data-row-index="0"] [data-col-key="actions"] button:nth-of-type(2)',
|
|
413
|
+
clicked: '[data-row-index="0"] [data-col-key="actions"] button:nth-of-type(2) span',
|
|
414
|
+
target: target({
|
|
415
|
+
block_id: 'people',
|
|
416
|
+
row: 0,
|
|
417
|
+
column: 'actions',
|
|
418
|
+
text: 'Delete'
|
|
419
|
+
}),
|
|
420
|
+
blockIds: [
|
|
421
|
+
'people'
|
|
422
|
+
],
|
|
423
|
+
resolvable: true,
|
|
424
|
+
variants: [
|
|
425
|
+
{
|
|
426
|
+
block_id: 'people',
|
|
427
|
+
row: 0,
|
|
428
|
+
text: 'Delete'
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: 'Table header cell is no row or cell',
|
|
434
|
+
html: tableGrid,
|
|
435
|
+
element: '[role="columnheader"][data-col-key="name"]',
|
|
436
|
+
target: target({
|
|
437
|
+
block_id: 'people'
|
|
438
|
+
}),
|
|
439
|
+
blockIds: [
|
|
440
|
+
'people'
|
|
441
|
+
],
|
|
442
|
+
resolvable: false,
|
|
443
|
+
variants: []
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
name: 'Table header control is counted across the block, not the header row',
|
|
447
|
+
html: tableGrid,
|
|
448
|
+
element: '[data-row-index="-1"] input[type="checkbox"]',
|
|
449
|
+
target: target({
|
|
450
|
+
block_id: 'people',
|
|
451
|
+
nth: 1
|
|
452
|
+
}),
|
|
453
|
+
blockIds: [
|
|
454
|
+
'people'
|
|
455
|
+
],
|
|
456
|
+
resolvable: true,
|
|
457
|
+
variants: []
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: 'Table summary row control is in no row or cell',
|
|
461
|
+
html: tableGrid,
|
|
462
|
+
element: '.lf-table-summary-row button',
|
|
463
|
+
clicked: '.lf-table-summary-row button span',
|
|
464
|
+
target: target({
|
|
465
|
+
block_id: 'people',
|
|
466
|
+
text: 'Export'
|
|
467
|
+
}),
|
|
468
|
+
blockIds: [
|
|
469
|
+
'people'
|
|
470
|
+
],
|
|
471
|
+
resolvable: true,
|
|
472
|
+
variants: []
|
|
473
|
+
},
|
|
356
474
|
{
|
|
357
475
|
name: 'pinned grid row',
|
|
358
476
|
html: `
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/e2e-utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy E2E Testing Utilities for Playwright",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dist/*"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lowdefy/helpers": "7.
|
|
43
|
-
"@lowdefy/node-utils": "7.
|
|
42
|
+
"@lowdefy/helpers": "7.2.0",
|
|
43
|
+
"@lowdefy/node-utils": "7.2.0",
|
|
44
44
|
"js-yaml": "4.3.2",
|
|
45
45
|
"prompts": "2.4.2"
|
|
46
46
|
},
|
|
@@ -53,11 +53,10 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@jest/globals": "28.1.3",
|
|
57
56
|
"@swc/cli": "0.8.1",
|
|
58
57
|
"@swc/core": "1.15.32",
|
|
59
58
|
"copyfiles": "2.4.1",
|
|
60
|
-
"
|
|
59
|
+
"vitest": "4.1.12"
|
|
61
60
|
},
|
|
62
61
|
"publishConfig": {
|
|
63
62
|
"access": "public"
|
|
@@ -66,6 +65,6 @@
|
|
|
66
65
|
"build": "swc src --out-dir dist --config-file ../../../.swcrc --cli-config-file ../../../.swc-cli.json && pnpm copyfiles",
|
|
67
66
|
"clean": "rm -rf dist",
|
|
68
67
|
"copyfiles": "copyfiles -u 1 \"./src/init/templates/*\" dist",
|
|
69
|
-
"test": "
|
|
68
|
+
"test": "vitest run"
|
|
70
69
|
}
|
|
71
70
|
}
|