Fix E2E tests with WP 6.2 (https://github.com/woocommerce/woocommerce-blocks/pull/8928)
* Update @wordpress/e2e-test-utils * Remove WP 6.1 specific code * Don't call switchBlockInspectorTab in blocks that don't have inspector tabs * Typos and code styling fixes * Make .toRenderBlock() more resilient * Make sure we only open the Settings tab when the block has been selected * Fix goToSiteEditor in WP 6.2 * Create insertAllProductsBlock util * Create openSettingsSidebar util as an alternative to openDocumentSettingsSidebar so it works in WP 6.2 * Update WOOCOMMERCE_PARSED_ID * Create enableApplyFiltersButton() util
This commit is contained in:
parent
965491de4e
commit
b143048c81
|
@ -104,7 +104,7 @@
|
|||
"@wordpress/data-controls": "2.2.7",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
|
||||
"@wordpress/dom": "3.27.0",
|
||||
"@wordpress/e2e-test-utils": "9.2.0",
|
||||
"@wordpress/e2e-test-utils": "10.1.0",
|
||||
"@wordpress/e2e-tests": "4.6.0",
|
||||
"@wordpress/element": "4.20.0",
|
||||
"@wordpress/env": "^4.9.0",
|
||||
|
@ -14052,15 +14052,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@wordpress/e2e-test-utils": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-9.2.0.tgz",
|
||||
"integrity": "sha512-kfnIwgoo4fd1+h85btWFyoMcPBqYA4szwWI3GmrBny8ybyFljRed1XVleZ/oD6MaFgid4uB6V4+OKTlsw5mg/Q==",
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-10.1.0.tgz",
|
||||
"integrity": "sha512-FybFtoN7qq+3ne+Sy8OThUBvBtm3Qd5Rh8BQ0hXdE3izIclwqPVePlDOhyz9AHvOajmgLn4v/YXs3D1uOOhVKA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/api-fetch": "^6.22.0",
|
||||
"@wordpress/keycodes": "^3.25.0",
|
||||
"@wordpress/url": "^3.26.0",
|
||||
"@wordpress/api-fetch": "^6.27.0",
|
||||
"@wordpress/keycodes": "^3.30.0",
|
||||
"@wordpress/url": "^3.31.0",
|
||||
"change-case": "^4.1.2",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.0"
|
||||
|
@ -14069,32 +14069,32 @@
|
|||
"node": ">=14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"jest": ">=27",
|
||||
"jest": ">=29",
|
||||
"puppeteer-core": ">=11"
|
||||
}
|
||||
},
|
||||
"node_modules/@wordpress/e2e-test-utils/node_modules/@wordpress/api-fetch": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.22.0.tgz",
|
||||
"integrity": "sha512-IO7Shv1Qz93bo/Rq20beAV+p1qSOCs4uUi98rzhhih7U0SF88Jo69mlNmQbpALWcG040a2DRQR8E18Mj7JwViQ==",
|
||||
"version": "6.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.27.0.tgz",
|
||||
"integrity": "sha512-5DAOOhvA4rmAGIoQX8gbut73Ls0nD5vKo4ImhaeMt+5o7JO7Mn+FU1t7GFy2MwzdBEu/toh/XuCHqF6F3HaooQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/i18n": "^4.25.0",
|
||||
"@wordpress/url": "^3.26.0"
|
||||
"@wordpress/i18n": "^4.30.0",
|
||||
"@wordpress/url": "^3.31.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@wordpress/e2e-test-utils/node_modules/@wordpress/i18n": {
|
||||
"version": "4.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.25.0.tgz",
|
||||
"integrity": "sha512-cKU5Ox1DKa3WShRu+QrCU+QzNvyoQhrNtS6kcvw17DfMBjPe7AsYjd7ZBb7Io327jP97Oqh5BtaYdUq/4S1cIw==",
|
||||
"version": "4.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.30.0.tgz",
|
||||
"integrity": "sha512-vIntwrTBSU2MXOBlpyFntPgimHP+RW+k7/Y00BMPL+xoxPr7J7sXX/GNoYlH1BNsAo7XOi5AY5FrUnQ7ZIYdtQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/hooks": "^3.25.0",
|
||||
"@wordpress/hooks": "^3.30.0",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"memize": "^1.1.0",
|
||||
"sprintf-js": "^1.1.1",
|
||||
|
@ -14108,9 +14108,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@wordpress/e2e-test-utils/node_modules/@wordpress/url": {
|
||||
"version": "3.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.26.0.tgz",
|
||||
"integrity": "sha512-oqIYWqUo1sr1qU4jxbRhzusSqMClSHn4bNtlR835VcqZoBnTM7/RwfrmTo6aCWDcSAd7LQVV1vykTjJsAYdxsA==",
|
||||
"version": "3.31.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.31.0.tgz",
|
||||
"integrity": "sha512-3sxbDKU8OQTeGat3Roef9dN/NR0Rb6ld9KN0618Ec+FHU05dI+7nolA0jfOAJka+Vvf7gfP0WQ7cJAZdlwfNuw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
|
@ -16254,9 +16254,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@wordpress/hooks": {
|
||||
"version": "3.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.27.0.tgz",
|
||||
"integrity": "sha512-izhRvOJzc/VFsu59KC+et1/35GL0Op7I60RZj2lkTnEz1vGvtClY3okCbOtGN0Adc8ewbTf4kB6qgKMsLtW0Dg==",
|
||||
"version": "3.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.30.0.tgz",
|
||||
"integrity": "sha512-cvM5OWMQx0D2+wxvsTCI68LXy4cHz1Db97LliiQ+KprSBmYRG5Uy2PqtPv1sMlK8IOypKOlzmG5H5V1CwBN44A==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0"
|
||||
},
|
||||
|
@ -16412,26 +16412,25 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@wordpress/keycodes": {
|
||||
"version": "3.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.25.0.tgz",
|
||||
"integrity": "sha512-y55wL9bj/XrW7Uyvg6kyQeVjPQOezG7HTI+L3nzI12waL50eGhqM1DSOv6PhMrcoHG4CN5Lg8bXNUF6TrAntfA==",
|
||||
"version": "3.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.30.0.tgz",
|
||||
"integrity": "sha512-rDZYk/t3a/WtOi8SrfVrHP63mT5NXw13kNf3+VL/jk+hcacb6TXImFEwH0F5nLHVYpvv0fPSoFUDo5bYqwbHZQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/i18n": "^4.25.0",
|
||||
"change-case": "^4.1.2",
|
||||
"lodash": "^4.17.21"
|
||||
"@wordpress/i18n": "^4.30.0",
|
||||
"change-case": "^4.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@wordpress/keycodes/node_modules/@wordpress/i18n": {
|
||||
"version": "4.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.25.0.tgz",
|
||||
"integrity": "sha512-cKU5Ox1DKa3WShRu+QrCU+QzNvyoQhrNtS6kcvw17DfMBjPe7AsYjd7ZBb7Io327jP97Oqh5BtaYdUq/4S1cIw==",
|
||||
"version": "4.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.30.0.tgz",
|
||||
"integrity": "sha512-vIntwrTBSU2MXOBlpyFntPgimHP+RW+k7/Y00BMPL+xoxPr7J7sXX/GNoYlH1BNsAo7XOi5AY5FrUnQ7ZIYdtQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/hooks": "^3.25.0",
|
||||
"@wordpress/hooks": "^3.30.0",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"memize": "^1.1.0",
|
||||
"sprintf-js": "^1.1.1",
|
||||
|
@ -20406,15 +20405,6 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"dev": true,
|
||||
|
@ -27150,12 +27140,6 @@
|
|||
"ramda": "^0.28.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/filename-reserved-regex": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
|
@ -28024,17 +28008,6 @@
|
|||
"devOptional": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"license": "MIT"
|
||||
|
@ -38336,11 +38309,6 @@
|
|||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/nan": {
|
||||
"version": "2.16.0",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.4",
|
||||
"dev": true,
|
||||
|
@ -38611,16 +38579,6 @@
|
|||
"inherits": "2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/node-pty": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz",
|
||||
"integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"nan": "^2.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.4",
|
||||
"license": "MIT"
|
||||
|
@ -48871,23 +48829,6 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack-chokidar2/node_modules/fsevents": {
|
||||
"version": "1.2.13",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack-chokidar2/node_modules/glob-parent": {
|
||||
"version": "3.1.0",
|
||||
"dev": true,
|
||||
|
@ -60752,39 +60693,39 @@
|
|||
}
|
||||
},
|
||||
"@wordpress/e2e-test-utils": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-9.2.0.tgz",
|
||||
"integrity": "sha512-kfnIwgoo4fd1+h85btWFyoMcPBqYA4szwWI3GmrBny8ybyFljRed1XVleZ/oD6MaFgid4uB6V4+OKTlsw5mg/Q==",
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-10.1.0.tgz",
|
||||
"integrity": "sha512-FybFtoN7qq+3ne+Sy8OThUBvBtm3Qd5Rh8BQ0hXdE3izIclwqPVePlDOhyz9AHvOajmgLn4v/YXs3D1uOOhVKA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/api-fetch": "^6.22.0",
|
||||
"@wordpress/keycodes": "^3.25.0",
|
||||
"@wordpress/url": "^3.26.0",
|
||||
"@wordpress/api-fetch": "^6.27.0",
|
||||
"@wordpress/keycodes": "^3.30.0",
|
||||
"@wordpress/url": "^3.31.0",
|
||||
"change-case": "^4.1.2",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/api-fetch": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.22.0.tgz",
|
||||
"integrity": "sha512-IO7Shv1Qz93bo/Rq20beAV+p1qSOCs4uUi98rzhhih7U0SF88Jo69mlNmQbpALWcG040a2DRQR8E18Mj7JwViQ==",
|
||||
"version": "6.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.27.0.tgz",
|
||||
"integrity": "sha512-5DAOOhvA4rmAGIoQX8gbut73Ls0nD5vKo4ImhaeMt+5o7JO7Mn+FU1t7GFy2MwzdBEu/toh/XuCHqF6F3HaooQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/i18n": "^4.25.0",
|
||||
"@wordpress/url": "^3.26.0"
|
||||
"@wordpress/i18n": "^4.30.0",
|
||||
"@wordpress/url": "^3.31.0"
|
||||
}
|
||||
},
|
||||
"@wordpress/i18n": {
|
||||
"version": "4.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.25.0.tgz",
|
||||
"integrity": "sha512-cKU5Ox1DKa3WShRu+QrCU+QzNvyoQhrNtS6kcvw17DfMBjPe7AsYjd7ZBb7Io327jP97Oqh5BtaYdUq/4S1cIw==",
|
||||
"version": "4.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.30.0.tgz",
|
||||
"integrity": "sha512-vIntwrTBSU2MXOBlpyFntPgimHP+RW+k7/Y00BMPL+xoxPr7J7sXX/GNoYlH1BNsAo7XOi5AY5FrUnQ7ZIYdtQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/hooks": "^3.25.0",
|
||||
"@wordpress/hooks": "^3.30.0",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"memize": "^1.1.0",
|
||||
"sprintf-js": "^1.1.1",
|
||||
|
@ -60792,9 +60733,9 @@
|
|||
}
|
||||
},
|
||||
"@wordpress/url": {
|
||||
"version": "3.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.26.0.tgz",
|
||||
"integrity": "sha512-oqIYWqUo1sr1qU4jxbRhzusSqMClSHn4bNtlR835VcqZoBnTM7/RwfrmTo6aCWDcSAd7LQVV1vykTjJsAYdxsA==",
|
||||
"version": "3.31.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.31.0.tgz",
|
||||
"integrity": "sha512-3sxbDKU8OQTeGat3Roef9dN/NR0Rb6ld9KN0618Ec+FHU05dI+7nolA0jfOAJka+Vvf7gfP0WQ7cJAZdlwfNuw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
|
@ -62265,9 +62206,9 @@
|
|||
}
|
||||
},
|
||||
"@wordpress/hooks": {
|
||||
"version": "3.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.27.0.tgz",
|
||||
"integrity": "sha512-izhRvOJzc/VFsu59KC+et1/35GL0Op7I60RZj2lkTnEz1vGvtClY3okCbOtGN0Adc8ewbTf4kB6qgKMsLtW0Dg==",
|
||||
"version": "3.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.30.0.tgz",
|
||||
"integrity": "sha512-cvM5OWMQx0D2+wxvsTCI68LXy4cHz1Db97LliiQ+KprSBmYRG5Uy2PqtPv1sMlK8IOypKOlzmG5H5V1CwBN44A==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0"
|
||||
}
|
||||
|
@ -62363,23 +62304,22 @@
|
|||
}
|
||||
},
|
||||
"@wordpress/keycodes": {
|
||||
"version": "3.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.25.0.tgz",
|
||||
"integrity": "sha512-y55wL9bj/XrW7Uyvg6kyQeVjPQOezG7HTI+L3nzI12waL50eGhqM1DSOv6PhMrcoHG4CN5Lg8bXNUF6TrAntfA==",
|
||||
"version": "3.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.30.0.tgz",
|
||||
"integrity": "sha512-rDZYk/t3a/WtOi8SrfVrHP63mT5NXw13kNf3+VL/jk+hcacb6TXImFEwH0F5nLHVYpvv0fPSoFUDo5bYqwbHZQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/i18n": "^4.25.0",
|
||||
"change-case": "^4.1.2",
|
||||
"lodash": "^4.17.21"
|
||||
"@wordpress/i18n": "^4.30.0",
|
||||
"change-case": "^4.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/i18n": {
|
||||
"version": "4.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.25.0.tgz",
|
||||
"integrity": "sha512-cKU5Ox1DKa3WShRu+QrCU+QzNvyoQhrNtS6kcvw17DfMBjPe7AsYjd7ZBb7Io327jP97Oqh5BtaYdUq/4S1cIw==",
|
||||
"version": "4.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.30.0.tgz",
|
||||
"integrity": "sha512-vIntwrTBSU2MXOBlpyFntPgimHP+RW+k7/Y00BMPL+xoxPr7J7sXX/GNoYlH1BNsAo7XOi5AY5FrUnQ7ZIYdtQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@wordpress/hooks": "^3.25.0",
|
||||
"@wordpress/hooks": "^3.30.0",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"memize": "^1.1.0",
|
||||
"sprintf-js": "^1.1.1",
|
||||
|
@ -65086,14 +65026,6 @@
|
|||
"version": "2.2.0",
|
||||
"devOptional": true
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.1.0",
|
||||
"dev": true,
|
||||
|
@ -69697,11 +69629,6 @@
|
|||
"ramda": "^0.28.0"
|
||||
}
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"filename-reserved-regex": {
|
||||
"version": "2.0.0",
|
||||
"dev": true
|
||||
|
@ -70274,10 +70201,6 @@
|
|||
"version": "1.0.0",
|
||||
"devOptional": true
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "2.3.2",
|
||||
"optional": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1"
|
||||
},
|
||||
|
@ -77407,10 +77330,6 @@
|
|||
"version": "0.0.8",
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.16.0",
|
||||
"optional": true
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.3.4",
|
||||
"dev": true
|
||||
|
@ -77613,15 +77532,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node-pty": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz",
|
||||
"integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "^2.14.0"
|
||||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "2.0.4"
|
||||
},
|
||||
|
@ -84541,15 +84451,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "1.2.13",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
}
|
||||
},
|
||||
"glob-parent": {
|
||||
"version": "3.1.0",
|
||||
"dev": true,
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
"@wordpress/data-controls": "2.2.7",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
|
||||
"@wordpress/dom": "3.27.0",
|
||||
"@wordpress/e2e-test-utils": "9.2.0",
|
||||
"@wordpress/e2e-test-utils": "10.1.0",
|
||||
"@wordpress/e2e-tests": "4.6.0",
|
||||
"@wordpress/element": "4.20.0",
|
||||
"@wordpress/env": "^4.9.0",
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { getBlocksBySlug } from '../../utils.js';
|
||||
|
||||
expect.extend( {
|
||||
async toRenderBlock( page, block = {} ) {
|
||||
const gutenbergNotFoundError = ( await page.content() ).match(
|
||||
|
@ -39,11 +44,11 @@ expect.extend( {
|
|||
};
|
||||
}
|
||||
|
||||
const blockElement = await page.$( block.class );
|
||||
if ( blockElement === null ) {
|
||||
const blocks = await getBlocksBySlug( block.slug );
|
||||
if ( blocks >= 1 ) {
|
||||
return {
|
||||
message: () =>
|
||||
`the ${ block.name || 'block' } with classname \`${
|
||||
`${ block.name || 'block' } with classname \`${
|
||||
block.class
|
||||
}\` did not render.`,
|
||||
pass: false,
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
} from '@wordpress/e2e-test-utils';
|
||||
import { setDefaultOptions } from 'expect-puppeteer';
|
||||
import { get } from 'lodash';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
|
|
@ -2,16 +2,19 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
openDocumentSettingsSidebar,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
|
||||
import {
|
||||
visitBlockPage,
|
||||
selectBlockByName,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils.js';
|
||||
|
||||
const block = {
|
||||
name: 'Active Filters',
|
||||
slug: 'woocommerce/active-filters',
|
||||
|
@ -31,9 +34,9 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
} );
|
||||
|
||||
it( "allows changing the block's title", async () => {
|
||||
|
|
|
@ -2,17 +2,21 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
openDocumentSettingsSidebar,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
|
||||
import {
|
||||
visitBlockPage,
|
||||
saveOrPublish,
|
||||
selectBlockByName,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils.js';
|
||||
|
||||
const block = {
|
||||
name: 'Filter by Attribute',
|
||||
slug: 'woocommerce/attribute-filter',
|
||||
|
@ -63,9 +67,9 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'Attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
} );
|
||||
|
||||
it( "allows changing the block's title", async () => {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
import {
|
||||
clickBlockToolbarButton,
|
||||
openDocumentSettingsSidebar,
|
||||
switchUserToAdmin,
|
||||
searchForBlock,
|
||||
openGlobalBlockInserter,
|
||||
|
@ -13,14 +12,17 @@ import {
|
|||
findLabelWithText,
|
||||
visitBlockPage,
|
||||
selectBlockByName,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { merchant } from '@woocommerce/e2e-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openWidgetEditor, closeModalIfExists } from '../../utils.js';
|
||||
import {
|
||||
openSettingsSidebar,
|
||||
openWidgetEditor,
|
||||
closeModalIfExists,
|
||||
} from '../../utils.js';
|
||||
|
||||
const block = {
|
||||
name: 'Cart',
|
||||
|
@ -179,10 +181,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled(
|
||||
'Settings'
|
||||
);
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/cart-order-summary-shipping-block'
|
||||
);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
openDocumentSettingsSidebar,
|
||||
switchUserToAdmin,
|
||||
openGlobalBlockInserter,
|
||||
insertBlock,
|
||||
|
@ -11,7 +10,6 @@ import {
|
|||
findLabelWithText,
|
||||
visitBlockPage,
|
||||
selectBlockByName,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { merchant } from '@woocommerce/e2e-utils';
|
||||
|
||||
|
@ -20,6 +18,7 @@ import { merchant } from '@woocommerce/e2e-utils';
|
|||
*/
|
||||
import {
|
||||
searchForBlock,
|
||||
openSettingsSidebar,
|
||||
openWidgetEditor,
|
||||
closeModalIfExists,
|
||||
} from '../../utils.js';
|
||||
|
@ -125,10 +124,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled(
|
||||
'Settings'
|
||||
);
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( block.slug );
|
||||
} );
|
||||
|
||||
|
@ -163,7 +159,7 @@ describe( `${ block.name } Block`, () => {
|
|||
'.wc-block-checkout__shipping-method button',
|
||||
{ text: 'Shipping' }
|
||||
);
|
||||
await openDocumentSettingsSidebar();
|
||||
await openSettingsSidebar();
|
||||
const toggleLabel = await findLabelWithText(
|
||||
'Hide shipping costs until an address is entered'
|
||||
);
|
||||
|
@ -225,10 +221,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'shipping address block attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled(
|
||||
'Settings'
|
||||
);
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-address-block'
|
||||
);
|
||||
|
@ -277,10 +270,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'action block attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled(
|
||||
'Settings'
|
||||
);
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( 'woocommerce/checkout-actions-block' );
|
||||
} );
|
||||
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
openDocumentSettingsSidebar,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils.js';
|
||||
|
||||
const block = {
|
||||
name: 'Customer account',
|
||||
|
@ -35,8 +37,8 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
await page.click( block.class );
|
||||
} );
|
||||
|
||||
|
|
|
@ -2,15 +2,19 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
openDocumentSettingsSidebar,
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
selectBlockByName,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils.js';
|
||||
|
||||
const block = {
|
||||
name: 'Filter by Price',
|
||||
slug: 'woocommerce/price-filter',
|
||||
|
@ -30,11 +34,9 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'Attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled(
|
||||
'Settings'
|
||||
);
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
} );
|
||||
|
||||
it( "allows changing the block's title", async () => {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { getAllBlocks, switchUserToAdmin } from '@wordpress/e2e-test-utils';
|
||||
|
||||
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,13 +5,9 @@ import {
|
|||
getAllBlocks,
|
||||
switchUserToAdmin,
|
||||
canvas,
|
||||
openDocumentSettingsSidebar,
|
||||
openListView,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -20,6 +16,7 @@ import {
|
|||
insertBlockDontWaitForInsertClose,
|
||||
GUTENBERG_EDITOR_CONTEXT,
|
||||
describeOrSkip,
|
||||
openSettingsSidebar,
|
||||
} from '../../utils';
|
||||
|
||||
const block = {
|
||||
|
@ -53,8 +50,7 @@ describeOrSkip( GUTENBERG_EDITOR_CONTEXT === 'gutenberg' )(
|
|||
it.skip( 'Editor preview shows only on sale products after enabling `Show only products on sale`', async () => {
|
||||
await visitBlockPage( `${ block.name } Block` );
|
||||
const canvasEl = canvas();
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await openListView();
|
||||
await page.click(
|
||||
'.block-editor-list-view-block__contents-container a.components-button'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ensureSidebarOpened, canvas } from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
saveOrPublish,
|
||||
selectBlockByName,
|
||||
|
@ -8,11 +9,9 @@ import {
|
|||
getFixtureProductsData,
|
||||
shopper,
|
||||
getToggleIdByLabel,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { ElementHandle } from 'puppeteer';
|
||||
import { setCheckbox } from '@woocommerce/e2e-utils';
|
||||
import { ensureSidebarOpened, canvas } from '@wordpress/e2e-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -48,7 +47,6 @@ describeOrSkip( GUTENBERG_EDITOR_CONTEXT === 'gutenberg' )(
|
|||
await resetProductQueryBlockPage();
|
||||
await ensureSidebarOpened();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
$productFiltersPanel = await findToolsPanelWithTitle(
|
||||
'Advanced Filters'
|
||||
);
|
||||
|
|
|
@ -11,7 +11,6 @@ import {
|
|||
selectBlockByName,
|
||||
visitBlockPage,
|
||||
saveOrPublish,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
|
@ -29,7 +28,6 @@ import {
|
|||
const getPopularFilterPanel = async () => {
|
||||
await ensureSidebarOpened();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
return await findSidebarPanelWithTitle( 'Popular Filters' );
|
||||
};
|
||||
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
openDocumentSettingsSidebar,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils';
|
||||
|
||||
const block = {
|
||||
name: 'Filter by Rating',
|
||||
|
@ -32,9 +30,9 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await page.click( block.class );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
} );
|
||||
|
||||
it( 'product count can be toggled', async () => {
|
||||
|
|
|
@ -128,7 +128,7 @@ const SELECTORS = {
|
|||
|
||||
const CUSTOMIZED_STRING = 'My awesome customization';
|
||||
const WOOCOMMERCE_ID = 'woocommerce/woocommerce';
|
||||
const WOOCOMMERCE_PARSED_ID = 'WooCommerce';
|
||||
const WOOCOMMERCE_PARSED_ID = 'woocommerce/woocommerceCustomized';
|
||||
|
||||
describe( 'Store Editing Templates', () => {
|
||||
useTheme( 'emptytheme' );
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
openDocumentSettingsSidebar,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils';
|
||||
import { findLabelWithText } from '../../../utils';
|
||||
|
||||
const block = {
|
||||
|
@ -33,9 +34,9 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
describe( 'attributes', () => {
|
||||
beforeEach( async () => {
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await page.click( block.class );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
} );
|
||||
|
||||
it( 'product count can be toggled', async () => {
|
||||
|
|
|
@ -1,22 +1,17 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
merchant,
|
||||
openDocumentSettingsSidebar,
|
||||
setCheckbox,
|
||||
unsetCheckbox,
|
||||
} from '@woocommerce/e2e-utils';
|
||||
import { merchant, setCheckbox, unsetCheckbox } from '@woocommerce/e2e-utils';
|
||||
import {
|
||||
visitBlockPage,
|
||||
selectBlockByName,
|
||||
saveOrPublish,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { openSettingsSidebar } from '../../utils';
|
||||
import {
|
||||
shopper,
|
||||
preventCompatibilityNotice,
|
||||
|
@ -66,8 +61,7 @@ describe( 'Merchant → Checkout → Can adjust T&S and Privacy Policy options',
|
|||
await preventCompatibilityNotice();
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( 'woocommerce/checkout-terms-block' );
|
||||
const [ termsCheckboxLabel ] = await page.$x(
|
||||
`//label[contains(text(), "Require checkbox") and contains(@class, "components-toggle-control__label")]`
|
||||
|
@ -106,8 +100,7 @@ describe( 'Merchant → Checkout → Can adjust T&S and Privacy Policy options',
|
|||
|
||||
// Deactivate checkboxes for T&S and Privacy Policy links.
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName( 'woocommerce/checkout-terms-block' );
|
||||
await unsetCheckbox( termsCheckboxId );
|
||||
await saveOrPublish();
|
||||
|
|
|
@ -11,13 +11,13 @@ import {
|
|||
} from '@wordpress/e2e-test-utils';
|
||||
import { SHOP_PAGE } from '@woocommerce/e2e-utils';
|
||||
import { Frame, Page } from 'puppeteer';
|
||||
import { insertBlockUsingSlash } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
goToTemplateEditor,
|
||||
insertAllProductsBlock,
|
||||
useTheme,
|
||||
saveTemplate,
|
||||
waitForAllProductsBlockLoaded,
|
||||
|
@ -96,7 +96,7 @@ describe( 'Shopper → Active Filters Block', () => {
|
|||
} );
|
||||
|
||||
await insertBlocks();
|
||||
await insertBlockUsingSlash( 'All Products' );
|
||||
await insertAllProductsBlock();
|
||||
await configureAttributeFilterBlock( page );
|
||||
await publishPost();
|
||||
|
||||
|
@ -182,7 +182,7 @@ describe( 'Shopper → Active Filters Block', () => {
|
|||
expect( isRefreshed ).not.toHaveBeenCalled();
|
||||
} );
|
||||
|
||||
it( 'Clicking "Clear All" button removes all active filter', async () => {
|
||||
it( 'Clicking "Clear All" button removes all active filters', async () => {
|
||||
const isRefreshed = jest.fn( () => void 0 );
|
||||
await page.waitForSelector( block.class );
|
||||
await page.waitForSelector(
|
||||
|
@ -317,7 +317,7 @@ describe( 'Shopper → Active Filters Block', () => {
|
|||
await expect( page ).toMatch( SIMPLE_PHYSICAL_PRODUCT_NAME );
|
||||
} );
|
||||
|
||||
it( 'Clicking "Clear All" button removes all active filter and the page redirects to the base URL', async () => {
|
||||
it( 'Clicking "Clear All" button removes all active filters and the page redirects to the base URL', async () => {
|
||||
const isRefreshed = jest.fn( () => void 0 );
|
||||
page.on( 'load', isRefreshed );
|
||||
await page.waitForSelector( selectors.frontend.stockFilterBlock );
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
import {
|
||||
merchant,
|
||||
openDocumentSettingsSidebar,
|
||||
setCheckbox,
|
||||
unsetCheckbox,
|
||||
withRestApi,
|
||||
|
@ -13,9 +12,9 @@ import {
|
|||
selectBlockByName,
|
||||
saveOrPublish,
|
||||
getToggleIdByLabel,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { visitAdminPage } from '@wordpress/e2e-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -30,7 +29,7 @@ import {
|
|||
BASE_URL,
|
||||
} from '../../../../utils';
|
||||
import { merchant as merchantUtils } from '../../../../utils/merchant';
|
||||
import { createCoupon } from '../../../utils';
|
||||
import { createCoupon, openSettingsSidebar } from '../../../utils';
|
||||
|
||||
let coupon;
|
||||
|
||||
|
@ -154,8 +153,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
await preventCompatibilityNotice();
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-address-block'
|
||||
);
|
||||
|
@ -168,8 +166,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
afterAll( async () => {
|
||||
await shopper.block.emptyCart();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-address-block'
|
||||
);
|
||||
|
@ -310,8 +307,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
afterAll( async () => {
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-methods-block'
|
||||
);
|
||||
|
@ -379,8 +375,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
await preventCompatibilityNotice();
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-methods-block'
|
||||
);
|
||||
|
@ -438,8 +433,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
await preventCompatibilityNotice();
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-methods-block'
|
||||
);
|
||||
|
@ -469,8 +463,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
await merchantUtils.enableLocalPickup();
|
||||
await merchantUtils.addLocalPickupLocation();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-methods-block'
|
||||
);
|
||||
|
@ -514,8 +507,7 @@ describe( 'Shopper → Checkout', () => {
|
|||
await preventCompatibilityNotice();
|
||||
await merchant.login();
|
||||
await visitBlockPage( 'Checkout Block' );
|
||||
await openDocumentSettingsSidebar();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await openSettingsSidebar();
|
||||
await selectBlockByName(
|
||||
'woocommerce/checkout-shipping-methods-block'
|
||||
);
|
||||
|
|
|
@ -8,23 +8,21 @@ import {
|
|||
insertBlock,
|
||||
switchUserToAdmin,
|
||||
publishPost,
|
||||
ensureSidebarOpened,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
selectBlockByName,
|
||||
insertBlockUsingSlash,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { selectBlockByName } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
BASE_URL,
|
||||
enableApplyFiltersButton,
|
||||
goToTemplateEditor,
|
||||
insertAllProductsBlock,
|
||||
saveTemplate,
|
||||
useTheme,
|
||||
waitForAllProductsBlockLoaded,
|
||||
waitForCanvas,
|
||||
} from '../../utils';
|
||||
import { saveOrPublish } from '../../../utils';
|
||||
|
||||
|
@ -36,8 +34,6 @@ const block = {
|
|||
editor: {
|
||||
firstAttributeInTheList:
|
||||
'.woocommerce-search-list__list > li > label > input.woocommerce-search-list__item-input',
|
||||
filterButtonToggle:
|
||||
'//label[text()="Show \'Apply filters\' button"]',
|
||||
doneButton: '.wc-block-attribute-filter__selection > button',
|
||||
},
|
||||
frontend: {
|
||||
|
@ -71,7 +67,7 @@ describe( `${ block.name } Block`, () => {
|
|||
title: block.name,
|
||||
} );
|
||||
|
||||
await insertBlockUsingSlash( 'All Products' );
|
||||
await insertAllProductsBlock();
|
||||
await insertBlock( block.name );
|
||||
const canvasEl = canvas();
|
||||
|
||||
|
@ -190,14 +186,9 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: productCatalogTemplateId,
|
||||
} );
|
||||
|
||||
await ensureSidebarOpened();
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
await enableApplyFiltersButton();
|
||||
await saveTemplate();
|
||||
await goToShopPage();
|
||||
|
||||
|
@ -309,14 +300,10 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
it( 'should refresh the page only if the user clicks on button', async () => {
|
||||
await page.goto( editorPageUrl );
|
||||
await ensureSidebarOpened();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await enableApplyFiltersButton();
|
||||
await saveOrPublish();
|
||||
await page.goto( frontedPageUrl );
|
||||
|
||||
|
|
|
@ -7,22 +7,20 @@ import {
|
|||
insertBlock,
|
||||
switchUserToAdmin,
|
||||
publishPost,
|
||||
ensureSidebarOpened,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
selectBlockByName,
|
||||
insertBlockUsingSlash,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { selectBlockByName } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
BASE_URL,
|
||||
enableApplyFiltersButton,
|
||||
goToTemplateEditor,
|
||||
insertAllProductsBlock,
|
||||
saveTemplate,
|
||||
useTheme,
|
||||
waitForCanvas,
|
||||
waitForAllProductsBlockLoaded,
|
||||
} from '../../utils';
|
||||
import { clickLink, saveOrPublish } from '../../../utils';
|
||||
|
@ -32,10 +30,6 @@ const block = {
|
|||
slug: 'woocommerce/price-filter',
|
||||
class: '.wc-block-price-filter',
|
||||
selectors: {
|
||||
editor: {
|
||||
filterButtonToggle:
|
||||
'//label[text()="Show \'Apply filters\' button"]',
|
||||
},
|
||||
frontend: {
|
||||
priceMaxAmount: '.wc-block-price-filter__amount--max',
|
||||
productsList: '.wc-block-grid__products > li',
|
||||
|
@ -75,7 +69,7 @@ describe( `${ block.name } Block`, () => {
|
|||
} );
|
||||
|
||||
await insertBlock( block.name );
|
||||
await insertBlockUsingSlash( 'All Products' );
|
||||
await insertAllProductsBlock();
|
||||
await insertBlock( 'Active Filters' );
|
||||
await publishPost();
|
||||
|
||||
|
@ -186,17 +180,9 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: productCatalogTemplateId,
|
||||
} );
|
||||
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await ensureSidebarOpened();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
|
||||
await page.waitForXPath(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
await enableApplyFiltersButton();
|
||||
await saveTemplate();
|
||||
await goToShopPage();
|
||||
|
||||
|
@ -298,17 +284,9 @@ describe( `${ block.name } Block`, () => {
|
|||
it( 'should refresh the page only if the user click on button', async () => {
|
||||
await page.goto( editorPageUrl );
|
||||
|
||||
await ensureSidebarOpened();
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await page.waitForXPath(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
|
||||
await enableApplyFiltersButton();
|
||||
await saveOrPublish();
|
||||
await page.goto( frontedPageUrl );
|
||||
|
||||
|
|
|
@ -5,16 +5,15 @@ import {
|
|||
createNewPost,
|
||||
deleteAllTemplates,
|
||||
insertBlock,
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
publishPost,
|
||||
ensureSidebarOpened,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
selectBlockByName,
|
||||
insertBlockUsingSlash,
|
||||
saveOrPublish,
|
||||
getToggleIdByLabel,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { setCheckbox } from '@woocommerce/e2e-utils';
|
||||
|
||||
|
@ -23,7 +22,9 @@ import { setCheckbox } from '@woocommerce/e2e-utils';
|
|||
*/
|
||||
import {
|
||||
BASE_URL,
|
||||
enableApplyFiltersButton,
|
||||
goToTemplateEditor,
|
||||
insertAllProductsBlock,
|
||||
saveTemplate,
|
||||
useTheme,
|
||||
waitForAllProductsBlockLoaded,
|
||||
|
@ -35,10 +36,6 @@ const block = {
|
|||
slug: 'woocommerce/rating-filter',
|
||||
class: '.wc-block-rating-filter',
|
||||
selectors: {
|
||||
editor: {
|
||||
filterButtonToggle:
|
||||
'//label[text()="Show \'Apply filters\' button"]',
|
||||
},
|
||||
frontend: {
|
||||
productsList: '.wc-block-grid__products > li',
|
||||
queryProductsList: '.wp-block-post-template > li',
|
||||
|
@ -70,7 +67,7 @@ describe( `${ block.name } Block`, () => {
|
|||
} );
|
||||
|
||||
await insertBlock( block.name );
|
||||
await insertBlockUsingSlash( 'All Products' );
|
||||
await insertAllProductsBlock();
|
||||
await publishPost();
|
||||
|
||||
link = await page.evaluate( () =>
|
||||
|
@ -162,17 +159,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await ensureSidebarOpened();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
|
||||
await page.waitForXPath(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
await enableApplyFiltersButton();
|
||||
await saveTemplate();
|
||||
await goToShopPage();
|
||||
|
||||
|
@ -271,7 +258,7 @@ describe( `${ block.name } Block`, () => {
|
|||
await waitForCanvas();
|
||||
await ensureSidebarOpened();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
await setCheckbox(
|
||||
await getToggleIdByLabel( "Show 'Apply filters' button", 1 )
|
||||
);
|
||||
|
|
|
@ -5,16 +5,15 @@ import {
|
|||
createNewPost,
|
||||
deleteAllTemplates,
|
||||
insertBlock,
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
publishPost,
|
||||
ensureSidebarOpened,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import {
|
||||
selectBlockByName,
|
||||
insertBlockUsingSlash,
|
||||
getToggleIdByLabel,
|
||||
saveOrPublish,
|
||||
switchBlockInspectorTabWhenGutenbergIsInstalled,
|
||||
} from '@woocommerce/blocks-test-utils';
|
||||
import { setCheckbox } from '@woocommerce/e2e-utils';
|
||||
|
||||
|
@ -23,7 +22,9 @@ import { setCheckbox } from '@woocommerce/e2e-utils';
|
|||
*/
|
||||
import {
|
||||
BASE_URL,
|
||||
enableApplyFiltersButton,
|
||||
goToTemplateEditor,
|
||||
insertAllProductsBlock,
|
||||
saveTemplate,
|
||||
useTheme,
|
||||
waitForAllProductsBlockLoaded,
|
||||
|
@ -35,10 +36,6 @@ const block = {
|
|||
slug: 'woocommerce/stock-filter',
|
||||
class: '.wc-block-stock-filter',
|
||||
selectors: {
|
||||
editor: {
|
||||
filterButtonToggle:
|
||||
'//label[text()="Show \'Apply filters\' button"]',
|
||||
},
|
||||
frontend: {
|
||||
productsList: '.wc-block-grid__products > li',
|
||||
classicProductsList: '.products.columns-3 > li',
|
||||
|
@ -69,7 +66,7 @@ describe( `${ block.name } Block`, () => {
|
|||
} );
|
||||
|
||||
await insertBlock( block.name );
|
||||
await insertBlockUsingSlash( 'All Products' );
|
||||
await insertAllProductsBlock();
|
||||
await publishPost();
|
||||
|
||||
link = await page.evaluate( () =>
|
||||
|
@ -168,16 +165,7 @@ describe( `${ block.name } Block`, () => {
|
|||
|
||||
await waitForCanvas();
|
||||
await selectBlockByName( block.slug );
|
||||
await ensureSidebarOpened();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await page.waitForXPath(
|
||||
block.selectors.editor.filterButtonToggle
|
||||
);
|
||||
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
selectors.editor.filterButtonToggle
|
||||
);
|
||||
await filterButtonToggle.click();
|
||||
await enableApplyFiltersButton();
|
||||
await saveTemplate();
|
||||
await goToShopPage();
|
||||
|
||||
|
@ -276,7 +264,7 @@ describe( `${ block.name } Block`, () => {
|
|||
await waitForCanvas();
|
||||
await ensureSidebarOpened();
|
||||
await selectBlockByName( block.slug );
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
await setCheckbox(
|
||||
await getToggleIdByLabel( "Show 'Apply filters' button" )
|
||||
);
|
||||
|
|
|
@ -6,8 +6,6 @@ import {
|
|||
ensureSidebarOpened,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
|
||||
import { switchBlockInspectorTabWhenGutenbergIsInstalled } from '@woocommerce/blocks-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -20,7 +18,6 @@ import {
|
|||
import {
|
||||
addProductQueryBlock,
|
||||
block,
|
||||
configureProductQueryBlock,
|
||||
getProductsNameFromClassicTemplate,
|
||||
getProductsNameFromProductQuery,
|
||||
toggleInheritQueryFromTemplateSetting,
|
||||
|
@ -39,7 +36,6 @@ describe( `${ block.name } Block`, () => {
|
|||
} );
|
||||
await ensureSidebarOpened();
|
||||
await addProductQueryBlock();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
} );
|
||||
|
||||
it( 'when Inherit Query from template is disabled all the settings that customize the query should be hidden', async () => {
|
||||
|
@ -55,7 +51,7 @@ describe( `${ block.name } Block`, () => {
|
|||
} );
|
||||
|
||||
it( 'when Inherit Query from template is enabled all the settings that customize the query should be hidden', async () => {
|
||||
await configureProductQueryBlock();
|
||||
await ensureSidebarOpened();
|
||||
|
||||
const popularFilterEl = await page.$(
|
||||
block.selectors.editor.popularFilter
|
||||
|
@ -78,7 +74,7 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: productCatalogTemplateId,
|
||||
} );
|
||||
await addProductQueryBlock();
|
||||
await configureProductQueryBlock();
|
||||
await ensureSidebarOpened();
|
||||
await page.waitForNetworkIdle();
|
||||
await saveTemplate();
|
||||
await page.waitForNetworkIdle();
|
||||
|
@ -107,7 +103,7 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: taxonomyProductCategory,
|
||||
} );
|
||||
await addProductQueryBlock();
|
||||
await configureProductQueryBlock();
|
||||
await ensureSidebarOpened();
|
||||
await page.waitForNetworkIdle();
|
||||
await saveTemplate();
|
||||
await page.waitForNetworkIdle();
|
||||
|
@ -139,7 +135,7 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: tagProductCategory,
|
||||
} );
|
||||
await addProductQueryBlock();
|
||||
await configureProductQueryBlock();
|
||||
await ensureSidebarOpened();
|
||||
await page.waitForNetworkIdle();
|
||||
await saveTemplate();
|
||||
await page.waitForNetworkIdle();
|
||||
|
@ -171,7 +167,7 @@ describe( `${ block.name } Block`, () => {
|
|||
postId: productSearchResults,
|
||||
} );
|
||||
await addProductQueryBlock();
|
||||
await configureProductQueryBlock();
|
||||
await ensureSidebarOpened();
|
||||
await page.waitForNetworkIdle();
|
||||
await saveTemplate();
|
||||
await page.waitForNetworkIdle();
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { insertBlock, ensureSidebarOpened } from '@wordpress/e2e-test-utils';
|
||||
import { switchBlockInspectorTabWhenGutenbergIsInstalled } from '@woocommerce/blocks-test-utils';
|
||||
import { insertBlock } from '@wordpress/e2e-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -39,11 +38,6 @@ export const toggleInheritQueryFromTemplateSetting = async () => {
|
|||
await button.click();
|
||||
};
|
||||
|
||||
export const configureProductQueryBlock = async () => {
|
||||
await ensureSidebarOpened();
|
||||
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
|
||||
};
|
||||
|
||||
export const getProductsNameFromClassicTemplate = async () => {
|
||||
const products = await page.$$(
|
||||
block.selectors.frontend.classicProductsListName
|
||||
|
|
|
@ -4,13 +4,17 @@
|
|||
import { Coupon, HTTPClientFactory } from '@woocommerce/api';
|
||||
import config from 'config';
|
||||
import {
|
||||
canvas,
|
||||
disableSiteEditorWelcomeGuide,
|
||||
ensureSidebarOpened,
|
||||
openGlobalBlockInserter,
|
||||
switchBlockInspectorTab,
|
||||
switchUserToAdmin,
|
||||
visitAdminPage,
|
||||
pressKeyWithModifier,
|
||||
searchForBlock as searchForFSEBlock,
|
||||
enterEditMode,
|
||||
getAllBlocks,
|
||||
} from '@wordpress/e2e-test-utils';
|
||||
import { addQueryArgs } from '@wordpress/url';
|
||||
import { WP_ADMIN_DASHBOARD } from '@woocommerce/e2e-utils';
|
||||
|
@ -69,6 +73,13 @@ const SELECTORS = {
|
|||
editButton:
|
||||
'.edit-site-site-hub__edit-button[aria-label="Open the editor"]',
|
||||
},
|
||||
editor: {
|
||||
filterButtonToggle: '//label[text()="Show \'Apply filters\' button"]',
|
||||
},
|
||||
frontend: {
|
||||
XPathSubmitButton:
|
||||
"//*[contains(@class,'wc-block-components-filter-submit-button')]",
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -149,20 +160,17 @@ export const isBlockInsertedInWidgetsArea = async ( blockName ) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* Visits site editor dependening on used WordPress version and how Gutenberg is installed.
|
||||
* Visits site editor depending on used WordPress version and how Gutenberg is installed.
|
||||
*
|
||||
* @param {Object} params Query parameters to add to the URL.
|
||||
* @param {string} [params.postId] ID of the template if we want to access template editor.
|
||||
* @param {'wp_template' | 'wp_template_part'} [params.postType='wp_template'] Type of template.
|
||||
* @param {string} [params.path] Navigation path.
|
||||
*/
|
||||
export async function goToSiteEditor( params = {} ) {
|
||||
await visitAdminPage( 'site-editor.php', addQueryArgs( '', params ) );
|
||||
|
||||
// @todo Remove the Gutenberg guard clause in goToSiteEditor when WP 6.2 is released.
|
||||
if (
|
||||
GUTENBERG_EDITOR_CONTEXT === 'gutenberg' &&
|
||||
( params?.postId || Object.keys( params ).length === 0 )
|
||||
) {
|
||||
if ( params?.postId || Object.keys( params ).length === 0 ) {
|
||||
await enterEditMode();
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +206,12 @@ export async function goToTemplatesList( {
|
|||
postType = 'wp_template',
|
||||
waitFor = 'list',
|
||||
} = {} ) {
|
||||
await goToSiteEditor( { postType } );
|
||||
await goToSiteEditor( {
|
||||
postType,
|
||||
// In WP 6.2, if postId is not defined, the route expects `path` instead
|
||||
// of `postType`.
|
||||
path: `/${ postType }/all`,
|
||||
} );
|
||||
|
||||
if ( waitFor === 'actions' ) {
|
||||
await page.waitForSelector(
|
||||
|
@ -441,3 +454,97 @@ export const waitForAllProductsBlockLoaded = async () => {
|
|||
*/
|
||||
export const describeOrSkip = ( condition ) =>
|
||||
condition ? describe : describe.skip;
|
||||
|
||||
/**
|
||||
* Get all blocks in the document that match a certain slug.
|
||||
*
|
||||
* @param {string} slug Slug of the blocks to get.
|
||||
*
|
||||
* @return {Promise<{}>} Promise resolving with an array containing all blocks in
|
||||
* the document that match a certain slug.
|
||||
*/
|
||||
export const getBlocksBySlug = async ( slug ) => {
|
||||
const blocks = await getAllBlocks();
|
||||
return blocks.filter( ( { name } ) => name === slug );
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert the All Products block using the global inserter. This util is needed
|
||||
* because inserting the All Products block using the `insertBlock()` util
|
||||
* causes time outs.
|
||||
*/
|
||||
export const insertAllProductsBlock = async () => {
|
||||
const searchTerm = 'All Products';
|
||||
|
||||
await searchForBlock( searchTerm );
|
||||
|
||||
// Wait for the default block list to disappear to prevent its items from
|
||||
// being considered as search results. This is needed since we're debouncing
|
||||
// search request.
|
||||
await page.waitForSelector( '.block-editor-inserter__block-list', {
|
||||
hidden: true,
|
||||
} );
|
||||
|
||||
const insertButton = await page.waitForXPath(
|
||||
`//*[@role='option' and contains(., '${ searchTerm }')]`
|
||||
);
|
||||
if ( ! insertButton ) {
|
||||
throw new Error( `Could not find the "${ searchTerm }" block` );
|
||||
}
|
||||
insertButton?.click();
|
||||
};
|
||||
|
||||
/**
|
||||
* Clicks on the button in the header which opens Document Settings sidebar when it is closed.
|
||||
* Based on https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils/src/open-document-settings-sidebar.js,
|
||||
* but updates the selector so it works in WP 6.2 without GB.
|
||||
*/
|
||||
export async function openSettingsSidebar() {
|
||||
const toggleButton = await page.waitForSelector(
|
||||
'.edit-post-header__settings button[aria-label="Settings"]'
|
||||
);
|
||||
|
||||
const isClosed = await page.evaluate(
|
||||
( element ) => element.getAttribute( 'aria-expanded' ) === 'false',
|
||||
toggleButton
|
||||
);
|
||||
|
||||
if ( isClosed ) {
|
||||
await toggleButton.click();
|
||||
await page.waitForSelector( '.edit-post-sidebar' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the `Show 'Apply filters' button` toggle.
|
||||
*/
|
||||
export const enableApplyFiltersButton = async () => {
|
||||
await ensureSidebarOpened();
|
||||
await switchBlockInspectorTab( 'Settings' );
|
||||
|
||||
await page.waitForXPath( SELECTORS.editor.filterButtonToggle );
|
||||
|
||||
const [ filterButtonToggle ] = await page.$x(
|
||||
SELECTORS.editor.filterButtonToggle
|
||||
);
|
||||
if ( ! filterButtonToggle ) {
|
||||
throw new Error( "'Apply filters' toggle not found via XPath." );
|
||||
}
|
||||
await filterButtonToggle.click();
|
||||
|
||||
// If for some reason click didn't work (it seems to happen intermittently),
|
||||
// click on the toggle via JS.
|
||||
await page.evaluate( () => {
|
||||
const toggle = document.querySelector(
|
||||
'.components-toggle-control:last-child .components-form-toggle__input'
|
||||
);
|
||||
if ( ! toggle ) {
|
||||
throw new Error( "'Apply filters' toggle not found via CSS." );
|
||||
}
|
||||
if ( ! toggle.checked ) {
|
||||
toggle.click();
|
||||
}
|
||||
} );
|
||||
|
||||
await canvas().waitForXPath( SELECTORS.frontend.XPathSubmitButton );
|
||||
};
|
||||
|
|
|
@ -22,6 +22,4 @@ export { findToolsPanelWithTitle } from './find-tools-panel-with-title';
|
|||
export { getFormElementIdByLabel } from './get-form-element-id-by-label';
|
||||
export { getToggleIdByLabel } from './get-toggle-id-by-label';
|
||||
export { insertBlockUsingQuickInserter } from './insert-block-using-quick-inserter';
|
||||
export { insertBlockUsingSlash } from './insert-block-using-slash';
|
||||
export { insertShortcodeBlock } from './insert-shortcode-block';
|
||||
export { switchBlockInspectorTabWhenGutenbergIsInstalled } from './switch-block-inspector-tab-when-gutenberg-is-installed';
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { canvas, insertBlock } from '@wordpress/e2e-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import SELECTORS from './selectors';
|
||||
|
||||
export const insertBlockUsingSlash = async ( blockTitle: string ) => {
|
||||
await insertBlock( 'Paragraph' );
|
||||
await canvas().keyboard.type( `/${ blockTitle }` );
|
||||
await canvas().waitForSelector( SELECTORS.popover );
|
||||
await canvas().keyboard.press( 'Enter' );
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { switchBlockInspectorTab } from '@wordpress/e2e-test-utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { GUTENBERG_EDITOR_CONTEXT } from '../e2e/utils';
|
||||
|
||||
// @todo Remove this function when WP 6.2 is released. We can use the "switchBlockInspectorTab" function directly.
|
||||
export const switchBlockInspectorTabWhenGutenbergIsInstalled = async (
|
||||
tabName: string
|
||||
) => {
|
||||
if ( GUTENBERG_EDITOR_CONTEXT === 'core' ) {
|
||||
return;
|
||||
}
|
||||
await switchBlockInspectorTab( tabName );
|
||||
};
|
Loading…
Reference in New Issue