@wordpress/e2e-test-utils-playwright 0.16.0 → 0.16.1-next.79a6196f.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.
- package/LICENSE.md +1 -1
- package/build/editor/get-blocks.js +6 -5
- package/build/editor/get-blocks.js.map +1 -1
- package/build/editor/insert-block.js +8 -4
- package/build/editor/insert-block.js.map +1 -1
- package/build/editor/set-is-fixed-toolbar.js +1 -1
- package/build/editor/set-is-fixed-toolbar.js.map +1 -1
- package/build-types/editor/get-blocks.d.ts +12 -4
- package/build-types/editor/get-blocks.d.ts.map +1 -1
- package/build-types/editor/insert-block.d.ts +5 -1
- package/build-types/editor/insert-block.d.ts.map +1 -1
- package/package.json +5 -5
package/LICENSE.md
CHANGED
|
@@ -6,13 +6,14 @@ exports.getBlocks = void 0;
|
|
|
6
6
|
*
|
|
7
7
|
* @param this
|
|
8
8
|
* @param options
|
|
9
|
-
* @param options.
|
|
9
|
+
* @param options.clientId Limit the results to be only under a partial tree of the specified clientId.
|
|
10
|
+
* @param options.full Whether to return the full block data or just the name and attributes.
|
|
10
11
|
*
|
|
11
12
|
* @return The blocks.
|
|
12
13
|
*/
|
|
13
|
-
async function getBlocks({ full = false } = {}) {
|
|
14
|
+
async function getBlocks({ clientId, full = false } = {}) {
|
|
14
15
|
await this.page.waitForFunction(() => window?.wp?.blocks && window?.wp?.data);
|
|
15
|
-
return await this.page.evaluate(([_full]) => {
|
|
16
|
+
return await this.page.evaluate(([_full, _clientId]) => {
|
|
16
17
|
// Remove other unpredictable properties like clientId from blocks for testing purposes.
|
|
17
18
|
function recursivelyTransformBlocks(blocks) {
|
|
18
19
|
return blocks.map((block) => ({
|
|
@@ -23,14 +24,14 @@ async function getBlocks({ full = false } = {}) {
|
|
|
23
24
|
}
|
|
24
25
|
const blocks = window.wp.data
|
|
25
26
|
.select('core/block-editor')
|
|
26
|
-
.getBlocks();
|
|
27
|
+
.getBlocks(_clientId);
|
|
27
28
|
// The editor might still contain an unmodified empty block even when it's technically "empty".
|
|
28
29
|
if (blocks.length === 1 &&
|
|
29
30
|
window.wp.blocks.isUnmodifiedDefaultBlock(blocks[0])) {
|
|
30
31
|
return [];
|
|
31
32
|
}
|
|
32
33
|
return _full ? blocks : recursivelyTransformBlocks(blocks);
|
|
33
|
-
}, [full]);
|
|
34
|
+
}, [full, clientId]);
|
|
34
35
|
}
|
|
35
36
|
exports.getBlocks = getBlocks;
|
|
36
37
|
//# sourceMappingURL=get-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-blocks.js","sourceRoot":"","sources":["../../src/editor/get-blocks.ts"],"names":[],"mappings":";;;AAWA
|
|
1
|
+
{"version":3,"file":"get-blocks.js","sourceRoot":"","sources":["../../src/editor/get-blocks.ts"],"names":[],"mappings":";;;AAWA;;;;;;;;;GASG;AACI,KAAK,UAAU,SAAS,CAE9B,EAAE,QAAQ,EAAE,IAAI,GAAG,KAAK,KAA4C,EAAE;IAEtE,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,MAAM,EAAE,EAAE,EAAE,IAAI,CAC5C,CAAC;IAEF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAC9B,CAAE,CAAE,KAAK,EAAE,SAAS,CAAE,EAAG,EAAE;QAC1B,wFAAwF;QACxF,SAAS,0BAA0B,CAAE,MAAe;YACnD,OAAO,MAAM,CAAC,GAAG,CAAE,CAAE,KAAK,EAAG,EAAE,CAAC,CAAE;gBACjC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,WAAW,EAAE,0BAA0B,CACtC,KAAK,CAAC,WAAW,CACjB;aACD,CAAE,CAAE,CAAC;QACP,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI;aAC3B,MAAM,CAAE,mBAAmB,CAAE;aAC7B,SAAS,CAAE,SAAS,CAAa,CAAC;QAEpC,+FAA+F;QAC/F,IACC,MAAM,CAAC,MAAM,KAAK,CAAC;YACnB,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAE,MAAM,CAAE,CAAC,CAAE,CAAE,EACvD;YACD,OAAO,EAAE,CAAC;SACV;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,0BAA0B,CAAE,MAAM,CAAE,CAAC;IAC9D,CAAC,EACD,CAAE,IAAI,EAAE,QAAQ,CAAE,CAClB,CAAC;AACH,CAAC;AArCD,8BAqCC"}
|
|
@@ -6,16 +6,20 @@ exports.insertBlock = void 0;
|
|
|
6
6
|
*
|
|
7
7
|
* @param this
|
|
8
8
|
* @param blockRepresentation Inserted block representation.
|
|
9
|
+
* @param options
|
|
10
|
+
* @param options.clientId Client ID of the parent block to insert into.
|
|
9
11
|
*/
|
|
10
|
-
async function insertBlock(blockRepresentation) {
|
|
12
|
+
async function insertBlock(blockRepresentation, { clientId } = {}) {
|
|
11
13
|
await this.page.waitForFunction(() => window?.wp?.blocks && window?.wp?.data);
|
|
12
|
-
await this.page.evaluate((_blockRepresentation) => {
|
|
14
|
+
await this.page.evaluate(([_blockRepresentation, _clientId]) => {
|
|
13
15
|
function recursiveCreateBlock({ name, attributes = {}, innerBlocks = [], }) {
|
|
14
16
|
return window.wp.blocks.createBlock(name, attributes, innerBlocks.map((innerBlock) => recursiveCreateBlock(innerBlock)));
|
|
15
17
|
}
|
|
16
18
|
const block = recursiveCreateBlock(_blockRepresentation);
|
|
17
|
-
window.wp.data
|
|
18
|
-
|
|
19
|
+
window.wp.data
|
|
20
|
+
.dispatch('core/block-editor')
|
|
21
|
+
.insertBlock(block, undefined, _clientId);
|
|
22
|
+
}, [blockRepresentation, clientId]);
|
|
19
23
|
}
|
|
20
24
|
exports.insertBlock = insertBlock;
|
|
21
25
|
//# sourceMappingURL=insert-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-block.js","sourceRoot":"","sources":["../../src/editor/insert-block.ts"],"names":[],"mappings":";;;AAWA
|
|
1
|
+
{"version":3,"file":"insert-block.js","sourceRoot":"","sources":["../../src/editor/insert-block.ts"],"names":[],"mappings":";;;AAWA;;;;;;;GAOG;AACH,KAAK,UAAU,WAAW,CAEzB,mBAAwC,EACxC,EAAE,QAAQ,KAA4B,EAAE;IAExC,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,MAAM,EAAE,EAAE,EAAE,IAAI,CAC5C,CAAC;IAEF,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CACvB,CAAE,CAAE,oBAAoB,EAAE,SAAS,CAAE,EAAG,EAAE;QACzC,SAAS,oBAAoB,CAAE,EAC9B,IAAI,EACJ,UAAU,GAAG,EAAE,EACf,WAAW,GAAG,EAAE,GACK;YACrB,OAAO,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAClC,IAAI,EACJ,UAAU,EACV,WAAW,CAAC,GAAG,CAAE,CAAE,UAAU,EAAG,EAAE,CACjC,oBAAoB,CAAE,UAAU,CAAE,CAClC,CACD,CAAC;QACH,CAAC;QACD,MAAM,KAAK,GAAG,oBAAoB,CAAE,oBAAoB,CAAE,CAAC;QAE3D,MAAM,CAAC,EAAE,CAAC,IAAI;aACZ,QAAQ,CAAE,mBAAmB,CAAE;aAC/B,WAAW,CAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAE,CAAC;IAC9C,CAAC,EACD,CAAE,mBAAmB,EAAE,QAAQ,CAAW,CAC1C,CAAC;AACH,CAAC;AAGQ,kCAAW"}
|
|
@@ -12,7 +12,7 @@ async function setIsFixedToolbar(isFixed) {
|
|
|
12
12
|
await this.page.evaluate((_isFixed) => {
|
|
13
13
|
window.wp.data
|
|
14
14
|
.dispatch('core/preferences')
|
|
15
|
-
.set('core
|
|
15
|
+
.set('core', 'fixedToolbar', _isFixed);
|
|
16
16
|
}, isFixed);
|
|
17
17
|
}
|
|
18
18
|
exports.setIsFixedToolbar = setIsFixedToolbar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-is-fixed-toolbar.js","sourceRoot":"","sources":["../../src/editor/set-is-fixed-toolbar.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAgB,OAAgB;IACtE,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAE,CAAC;IAE1D,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAE,QAAQ,EAAG,EAAE;QACxC,MAAM,CAAC,EAAE,CAAC,IAAI;aACZ,QAAQ,CAAE,kBAAkB,CAAE;aAC9B,GAAG,CAAE,
|
|
1
|
+
{"version":3,"file":"set-is-fixed-toolbar.js","sourceRoot":"","sources":["../../src/editor/set-is-fixed-toolbar.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAgB,OAAgB;IACtE,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAE,CAAC;IAE1D,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAE,QAAQ,EAAG,EAAE;QACxC,MAAM,CAAC,EAAE,CAAC,IAAI;aACZ,QAAQ,CAAE,kBAAkB,CAAE;aAC9B,GAAG,CAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAE,CAAC;IAC3C,CAAC,EAAE,OAAO,CAAE,CAAC;AACd,CAAC;AARD,8CAQC"}
|
|
@@ -2,16 +2,24 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { Editor } from './index';
|
|
5
|
+
type Block = {
|
|
6
|
+
name: string;
|
|
7
|
+
attributes: Record<string, unknown>;
|
|
8
|
+
innerBlocks: Block[];
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* Returns the edited blocks.
|
|
7
12
|
*
|
|
8
13
|
* @param this
|
|
9
14
|
* @param options
|
|
10
|
-
* @param options.
|
|
15
|
+
* @param options.clientId Limit the results to be only under a partial tree of the specified clientId.
|
|
16
|
+
* @param options.full Whether to return the full block data or just the name and attributes.
|
|
11
17
|
*
|
|
12
18
|
* @return The blocks.
|
|
13
19
|
*/
|
|
14
|
-
export declare function getBlocks(this: Editor, { full }?: {
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
export declare function getBlocks(this: Editor, { clientId, full }?: {
|
|
21
|
+
clientId?: string;
|
|
22
|
+
full?: boolean;
|
|
23
|
+
}): Promise<Block[]>;
|
|
24
|
+
export {};
|
|
17
25
|
//# sourceMappingURL=get-blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-blocks.d.ts","sourceRoot":"","sources":["../../src/editor/get-blocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"get-blocks.d.ts","sourceRoot":"","sources":["../../src/editor/get-blocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAE,MAAM,EAAE,OAAO,CAAE,CAAC;IACtC,WAAW,EAAE,KAAK,EAAE,CAAC;CACrB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC9B,IAAI,EAAE,MAAM,EACZ,EAAE,QAAQ,EAAE,IAAY,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,oBAmCtE"}
|
|
@@ -12,8 +12,12 @@ interface BlockRepresentation {
|
|
|
12
12
|
*
|
|
13
13
|
* @param this
|
|
14
14
|
* @param blockRepresentation Inserted block representation.
|
|
15
|
+
* @param options
|
|
16
|
+
* @param options.clientId Client ID of the parent block to insert into.
|
|
15
17
|
*/
|
|
16
|
-
declare function insertBlock(this: Editor, blockRepresentation: BlockRepresentation
|
|
18
|
+
declare function insertBlock(this: Editor, blockRepresentation: BlockRepresentation, { clientId }?: {
|
|
19
|
+
clientId?: string;
|
|
20
|
+
}): Promise<void>;
|
|
17
21
|
export type { BlockRepresentation };
|
|
18
22
|
export { insertBlock };
|
|
19
23
|
//# sourceMappingURL=insert-block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-block.d.ts","sourceRoot":"","sources":["../../src/editor/insert-block.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,UAAU,mBAAmB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED
|
|
1
|
+
{"version":3,"file":"insert-block.d.ts","sourceRoot":"","sources":["../../src/editor/insert-block.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,UAAU,mBAAmB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,iBAAe,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,mBAAmB,EACxC,EAAE,QAAQ,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,iBA6BxC;AAED,YAAY,EAAE,mBAAmB,EAAE,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/e2e-test-utils-playwright",
|
|
3
|
-
"version": "0.16.0",
|
|
3
|
+
"version": "0.16.1-next.79a6196f.0",
|
|
4
4
|
"description": "End-To-End (E2E) test utils for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"main": "./build/index.js",
|
|
31
31
|
"types": "./build-types",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@wordpress/api-fetch": "^6.45.0",
|
|
34
|
-
"@wordpress/keycodes": "^3.48.0",
|
|
35
|
-
"@wordpress/url": "^3.49.0",
|
|
33
|
+
"@wordpress/api-fetch": "^6.45.1-next.79a6196f.0",
|
|
34
|
+
"@wordpress/keycodes": "^3.48.1-next.79a6196f.0",
|
|
35
|
+
"@wordpress/url": "^3.49.1-next.79a6196f.0",
|
|
36
36
|
"change-case": "^4.1.2",
|
|
37
37
|
"form-data": "^4.0.0",
|
|
38
38
|
"get-port": "^5.1.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1e74b942ac0119a22ceaaf5c9594263f3ec516ab"
|
|
50
50
|
}
|