diff --git a/.wp-env.json b/.wp-env.json index bb608f9cdb..0358a0d725 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -18,6 +18,7 @@ "10up/elasticpress-proxy#develop" ], "mappings": { + "wp-content/mu-plugins/skip-wp-lookup.php": "./tests/cypress/wordpress-files/test-mu-plugins/skip-wp-lookup.php", "wp-content/mu-plugins/unique-index-name.php": "./tests/cypress/wordpress-files/test-mu-plugins/unique-index-name.php", "wp-content/mu-plugins/disable-welcome-guide.php": "./tests/cypress/wordpress-files/test-mu-plugins/disable-welcome-guide.php", "wp-content/plugins/cpt-and-custom-tax.php": "./tests/cypress/wordpress-files/test-plugins/cpt-and-custom-tax.php", diff --git a/includes/classes/Command.php b/includes/classes/Command.php index 192be7b6a6..92cc4a9e69 100644 --- a/includes/classes/Command.php +++ b/includes/classes/Command.php @@ -936,6 +936,7 @@ public function stats() { $index_names_imploded = implode( ',', $index_names ); + Elasticsearch::factory()->refresh_indices(); $request = wp_remote_get( trailingslashit( Utils\get_host( true ) ) . $index_names_imploded . '/_stats/', $request_args ); if ( is_wp_error( $request ) ) { diff --git a/package-lock.json b/package-lock.json index 12dd8f7af2..aa7958de5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@wordpress/env": "^5.0.0", "10up-toolkit": "^4.3.1", "classnames": "^2.3.1", - "cypress": "^12.9.0", + "cypress": "^13.3.0", "cypress-file-upload": "^5.0.8", "eslint-plugin-cypress": "^2.12.1", "husky": "^8.0.3", @@ -116,12 +116,12 @@ } }, "node_modules/@4tw/cypress-drag-drop": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@4tw/cypress-drag-drop/-/cypress-drag-drop-2.2.3.tgz", - "integrity": "sha512-ADMNoELeQdcGLPjfTJ5jWupBKU3rmQAnTqaRhuEa3hQGZ6suR49Ya5SReUrwvJnfAR4pgMcnSkqLqi1F4EPuwA==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/@4tw/cypress-drag-drop/-/cypress-drag-drop-2.2.5.tgz", + "integrity": "sha512-3ghTmzhOmUqeN6U3QmUnKRUxI7OMLbJA4hHUY/eS/FhWJgxbiGgcaELbolWnBAOpajPXcsNQGYEj9brd59WH6A==", "dev": true, "peerDependencies": { - "cypress": "^2.1.0 || ^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0" + "cypress": "2 - 13" } }, "node_modules/@ampproject/remapping": { @@ -2313,9 +2313,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", + "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -2331,7 +2331,7 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.10.4", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -3900,9 +3900,10 @@ "peer": true }, "node_modules/@types/node": { - "version": "17.0.21", - "dev": true, - "license": "MIT" + "version": "18.18.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.3.tgz", + "integrity": "sha512-0OVfGupTl3NBFr8+iXpfZ8NR7jfFO+P1Q+IO/q0wbo02wYkP5gy36phojeYWpLQ6WAMjl+VfmqUk2YbUfp0irA==", + "dev": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -5404,16 +5405,18 @@ }, "node_modules/asn1": { "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, - "license": "MIT", "dependencies": { "safer-buffer": "~2.1.0" } }, "node_modules/assert-plus": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8" } @@ -5485,16 +5488,18 @@ }, "node_modules/aws-sign2": { "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true, - "license": "Apache-2.0", "engines": { "node": "*" } }, "node_modules/aws4": { - "version": "1.11.0", - "dev": true, - "license": "MIT" + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", + "dev": true }, "node_modules/axe-core": { "version": "4.6.1", @@ -5782,8 +5787,9 @@ }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "tweetnacl": "^0.14.3" } @@ -6189,8 +6195,9 @@ }, "node_modules/caseless": { "version": "0.12.0", - "dev": true, - "license": "Apache-2.0" + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", + "dev": true }, "node_modules/catharsis": { "version": "0.9.0", @@ -6576,9 +6583,10 @@ } }, "node_modules/commander": { - "version": "5.1.0", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 6" } @@ -7318,15 +7326,15 @@ "license": "MIT" }, "node_modules/cypress": { - "version": "12.9.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.9.0.tgz", - "integrity": "sha512-Ofe09LbHKgSqX89Iy1xen2WvpgbvNxDzsWx3mgU1mfILouELeXYGwIib3ItCwoRrRifoQwcBFmY54Vs0zw7QCg==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.0.tgz", + "integrity": "sha512-mpI8qcTwLGiA4zEQvTC/U1xGUezVV4V8HQCOYjlEOrVmU1etVvxOjkCXHGwrlYdZU/EPmUiWfsO3yt1o+Q2bgw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^2.88.10", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^14.14.31", + "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -7338,7 +7346,7 @@ "check-more-types": "^2.24.0", "cli-cursor": "^3.1.0", "cli-table3": "~0.6.1", - "commander": "^5.1.0", + "commander": "^6.2.1", "common-tags": "^1.8.0", "dayjs": "^1.10.4", "debug": "^4.3.4", @@ -7356,12 +7364,13 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.6", + "minimist": "^1.2.8", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", + "process": "^0.11.10", "proxy-from-env": "1.0.0", "request-progress": "^3.0.0", - "semver": "^7.3.2", + "semver": "^7.5.3", "supports-color": "^8.1.1", "tmp": "~0.2.1", "untildify": "^4.0.0", @@ -7371,7 +7380,7 @@ "cypress": "bin/cypress" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, "node_modules/cypress-file-upload": { @@ -7385,11 +7394,6 @@ "cypress": ">3.0.0" } }, - "node_modules/cypress/node_modules/@types/node": { - "version": "14.18.12", - "dev": true, - "license": "MIT" - }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", "dev": true, @@ -7469,9 +7473,10 @@ } }, "node_modules/cypress/node_modules/semver": { - "version": "7.3.5", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, - "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -7504,8 +7509,9 @@ }, "node_modules/dashdash": { "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" }, @@ -7973,8 +7979,9 @@ }, "node_modules/ecc-jsbn": { "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, - "license": "MIT", "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -9247,8 +9254,9 @@ }, "node_modules/extend": { "version": "3.0.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "node_modules/external-editor": { "version": "3.1.0", @@ -9303,11 +9311,12 @@ }, "node_modules/extsprintf": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "dev": true, "engines": [ "node >=0.6.0" - ], - "license": "MIT" + ] }, "node_modules/fast-deep-equal": { "version": "3.1.3", @@ -9611,16 +9620,18 @@ }, "node_modules/forever-agent": { "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true, - "license": "Apache-2.0", "engines": { "node": "*" } }, "node_modules/form-data": { "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, - "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -9825,8 +9836,9 @@ }, "node_modules/getpass": { "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" } @@ -10377,8 +10389,9 @@ }, "node_modules/http-signature": { "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^2.0.2", @@ -11154,8 +11167,9 @@ }, "node_modules/isstream": { "version": "0.1.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", + "dev": true }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", @@ -12967,8 +12981,9 @@ }, "node_modules/jsbn": { "version": "0.1.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", + "dev": true }, "node_modules/jsdoc": { "version": "3.6.10", @@ -13118,8 +13133,9 @@ }, "node_modules/json-schema": { "version": "0.4.0", - "dev": true, - "license": "(AFL-2.1 OR BSD-3-Clause)" + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -13134,8 +13150,9 @@ }, "node_modules/json-stringify-safe": { "version": "5.0.1", - "dev": true, - "license": "ISC" + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true }, "node_modules/json2php": { "version": "0.0.4", @@ -13168,11 +13185,12 @@ }, "node_modules/jsprim": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "engines": [ "node >=0.6.0" ], - "license": "MIT", "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -14441,10 +14459,13 @@ } }, "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/minimist-options": { "version": "4.1.0", @@ -15263,8 +15284,9 @@ }, "node_modules/performance-now": { "version": "2.1.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "dev": true }, "node_modules/picocolors": { "version": "1.0.0", @@ -16737,6 +16759,15 @@ "node": ">=4" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "dev": true, @@ -18218,8 +18249,9 @@ }, "node_modules/sshpk": { "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, - "license": "MIT", "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -19332,8 +19364,9 @@ }, "node_modules/tweetnacl": { "version": "0.14.5", - "dev": true, - "license": "Unlicense" + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", + "dev": true }, "node_modules/type-check": { "version": "0.4.0", @@ -19663,11 +19696,12 @@ }, "node_modules/verror": { "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", "dev": true, "engines": [ "node >=0.6.0" ], - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -19676,8 +19710,9 @@ }, "node_modules/verror/node_modules/core-util-is": { "version": "1.0.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "dev": true }, "node_modules/w3c-hr-time": { "version": "1.0.2", @@ -20517,9 +20552,9 @@ } }, "@4tw/cypress-drag-drop": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@4tw/cypress-drag-drop/-/cypress-drag-drop-2.2.3.tgz", - "integrity": "sha512-ADMNoELeQdcGLPjfTJ5jWupBKU3rmQAnTqaRhuEa3hQGZ6suR49Ya5SReUrwvJnfAR4pgMcnSkqLqi1F4EPuwA==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/@4tw/cypress-drag-drop/-/cypress-drag-drop-2.2.5.tgz", + "integrity": "sha512-3ghTmzhOmUqeN6U3QmUnKRUxI7OMLbJA4hHUY/eS/FhWJgxbiGgcaELbolWnBAOpajPXcsNQGYEj9brd59WH6A==", "dev": true, "requires": {} }, @@ -21982,9 +22017,9 @@ } }, "@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", + "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -22000,7 +22035,7 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.10.4", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -23160,7 +23195,9 @@ "peer": true }, "@types/node": { - "version": "17.0.21", + "version": "18.18.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.3.tgz", + "integrity": "sha512-0OVfGupTl3NBFr8+iXpfZ8NR7jfFO+P1Q+IO/q0wbo02wYkP5gy36phojeYWpLQ6WAMjl+VfmqUk2YbUfp0irA==", "dev": true }, "@types/normalize-package-data": { @@ -24219,6 +24256,8 @@ }, "asn1": { "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { "safer-buffer": "~2.1.0" @@ -24226,6 +24265,8 @@ }, "assert-plus": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true }, "ast-types-flow": { @@ -24266,10 +24307,14 @@ }, "aws-sign2": { "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true }, "aws4": { - "version": "1.11.0", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, "axe-core": { @@ -24478,6 +24523,8 @@ }, "bcrypt-pbkdf": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, "requires": { "tweetnacl": "^0.14.3" @@ -24774,6 +24821,8 @@ }, "caseless": { "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "dev": true }, "catharsis": { @@ -25063,7 +25112,9 @@ } }, "commander": { - "version": "5.1.0", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true }, "comment-parser": { @@ -25591,14 +25642,14 @@ "version": "3.0.11" }, "cypress": { - "version": "12.9.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.9.0.tgz", - "integrity": "sha512-Ofe09LbHKgSqX89Iy1xen2WvpgbvNxDzsWx3mgU1mfILouELeXYGwIib3ItCwoRrRifoQwcBFmY54Vs0zw7QCg==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.0.tgz", + "integrity": "sha512-mpI8qcTwLGiA4zEQvTC/U1xGUezVV4V8HQCOYjlEOrVmU1etVvxOjkCXHGwrlYdZU/EPmUiWfsO3yt1o+Q2bgw==", "dev": true, "requires": { - "@cypress/request": "^2.88.10", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^14.14.31", + "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -25610,7 +25661,7 @@ "check-more-types": "^2.24.0", "cli-cursor": "^3.1.0", "cli-table3": "~0.6.1", - "commander": "^5.1.0", + "commander": "^6.2.1", "common-tags": "^1.8.0", "dayjs": "^1.10.4", "debug": "^4.3.4", @@ -25628,22 +25679,19 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.6", + "minimist": "^1.2.8", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", + "process": "^0.11.10", "proxy-from-env": "1.0.0", "request-progress": "^3.0.0", - "semver": "^7.3.2", + "semver": "^7.5.3", "supports-color": "^8.1.1", "tmp": "~0.2.1", "untildify": "^4.0.0", "yauzl": "^2.10.0" }, "dependencies": { - "@types/node": { - "version": "14.18.12", - "dev": true - }, "ansi-styles": { "version": "4.3.0", "dev": true, @@ -25690,7 +25738,9 @@ "dev": true }, "semver": { - "version": "7.3.5", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -25718,6 +25768,8 @@ }, "dashdash": { "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, "requires": { "assert-plus": "^1.0.0" @@ -26058,6 +26110,8 @@ }, "ecc-jsbn": { "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, "requires": { "jsbn": "~0.1.0", @@ -26956,6 +27010,8 @@ }, "extend": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "external-editor": { @@ -27001,6 +27057,8 @@ }, "extsprintf": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "dev": true }, "fast-deep-equal": { @@ -27230,10 +27288,14 @@ }, "forever-agent": { "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true }, "form-data": { "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { "asynckit": "^0.4.0", @@ -27374,6 +27436,8 @@ }, "getpass": { "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, "requires": { "assert-plus": "^1.0.0" @@ -27786,6 +27850,8 @@ }, "http-signature": { "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, "requires": { "assert-plus": "^1.0.0", @@ -28270,6 +28336,8 @@ }, "isstream": { "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, "istanbul-lib-coverage": { @@ -29598,6 +29666,8 @@ }, "jsbn": { "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", "dev": true }, "jsdoc": { @@ -29711,6 +29781,8 @@ }, "json-schema": { "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-schema-traverse": { @@ -29724,6 +29796,8 @@ }, "json-stringify-safe": { "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, "json2php": { @@ -29748,6 +29822,8 @@ }, "jsprim": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "requires": { "assert-plus": "1.0.0", @@ -30615,9 +30691,9 @@ } }, "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true }, "minimist-options": { @@ -31203,6 +31279,8 @@ }, "performance-now": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", "dev": true }, "picocolors": { @@ -32077,6 +32155,12 @@ "integrity": "sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==", "dev": true }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "dev": true @@ -33185,6 +33269,8 @@ }, "sshpk": { "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, "requires": { "asn1": "~0.2.3", @@ -34015,6 +34101,8 @@ }, "tweetnacl": { "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", "dev": true }, "type-check": { @@ -34243,6 +34331,8 @@ }, "verror": { "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", "dev": true, "requires": { "assert-plus": "^1.0.0", @@ -34252,6 +34342,8 @@ "dependencies": { "core-util-is": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", "dev": true } } diff --git a/package.json b/package.json index 6494e9588a..04f5ac5f6a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@wordpress/env": "^5.0.0", "10up-toolkit": "^4.3.1", "classnames": "^2.3.1", - "cypress": "^12.9.0", + "cypress": "^13.3.0", "cypress-file-upload": "^5.0.8", "eslint-plugin-cypress": "^2.12.1", "husky": "^8.0.3", diff --git a/tests/cypress/integration/features/comments.cy.js b/tests/cypress/integration/features/comments.cy.js index b68452e7e8..7d103a72b5 100644 --- a/tests/cypress/integration/features/comments.cy.js +++ b/tests/cypress/integration/features/comments.cy.js @@ -12,8 +12,8 @@ describe('Comments Feature', { tags: '@slow' }, () => { cy.get('#comment_moderation').check(); cy.get('#comment_previously_approved').check(); cy.get('#submit').click(); - cy.maybeEnableFeature('comments'); cy.activatePlugin('show-comments-and-terms', 'wpCli'); + cy.maybeEnableFeature('comments'); }); /** @@ -262,10 +262,16 @@ describe('Comments Feature', { tags: '@slow' }, () => { cy.get('.ep-sync-messages', { timeout: Cypress.config('elasticPressIndexTimeout') }).as( 'syncMessages', ); - cy.get('@syncMessages').should('contain.text', 'Mapping sent'); - cy.get('@syncMessages').should('contain.text', 'Sync complete'); + cy.get('@syncMessages', { timeout: Cypress.config('elasticPressIndexTimeout') }).should( + 'contain.text', + 'Mapping sent', + ); + cy.get('@syncMessages', { timeout: Cypress.config('elasticPressIndexTimeout') }).should( + 'contain.text', + 'Sync complete', + ); // check that the number of approved comments is the same as the default. - cy.get('@syncMessages').should( + cy.get('@syncMessages', { timeout: Cypress.config('elasticPressIndexTimeout') }).should( 'contain.text', `Number of comments indexed: ${defaultApprovedComments}`, ); @@ -292,29 +298,39 @@ describe('Comments Feature', { tags: '@slow' }, () => { cy.visit('/'); cy.contains('#main .entry-title a', 'Test Comment').first().click(); cy.get('#comment').type('This is a anonymous comment'); - cy.get('#submit').click(); - - // start sync and test results. - cy.wpCli('wp elasticpress index') - .its('stdout') - .should('contain', `Number of comments indexed: ${defaultApprovedComments}`); + cy.get('#submit') + .click() + .then(() => { + cy.wpCli('wp elasticpress sync') + .its('stdout') + .should('contain', `Number of comments indexed: ${defaultApprovedComments}`); + }); // approve the comment cy.visitAdminPage('edit-comments.php?comment_status=moderated'); - cy.get('.approve a').first().click({ force: true }); - - // Check the number of comments. - cy.wpCli('wp elasticpress stats') - .its('stdout') - .should('contain', `Documents: ${defaultApprovedComments + 1}`); + cy.intercept('POST', '/wp-admin/admin-ajax.php*').as('ajaxRequest'); + cy.get('.approve a') + .first() + .click({ force: true }) + .then(() => { + cy.wait('@ajaxRequest').its('response.statusCode').should('eq', 200); + cy.wpCli('wp elasticpress stats') + .its('stdout') + .should('contain', `Documents: ${defaultApprovedComments + 1}`); + }); // trash the comment cy.visitAdminPage('edit-comments.php?comment_status=approved'); - cy.get('.column-comment .trash a').first().click({ force: true }); - - cy.wpCli('wp elasticpress stats') - .its('stdout') - .should('contain', `Documents: ${defaultApprovedComments}`); + cy.intercept('POST', '/wp-admin/admin-ajax.php*').as('ajaxRequest'); + cy.get('.column-comment .trash a') + .first() + .click({ force: true }) + .then(() => { + cy.wait('@ajaxRequest').its('response.statusCode').should('eq', 200); + cy.wpCli('wp elasticpress stats') + .its('stdout') + .should('contain', `Documents: ${defaultApprovedComments}`); + }); }); it('Can sync woocommerce reviews', () => { @@ -380,15 +396,9 @@ describe('Comments Feature', { tags: '@slow' }, () => { cy.get('#comment').type('This is a anonymous comment'); cy.get('#submit').click(); - cy.wpCliEval( - ` - $comments_index = \\ElasticPress\\Indexables::factory()->get( "comment" )->get_index_name(); - WP_CLI::runcommand("elasticpress request {$comments_index}/_refresh --method=POST");`, - ).then(() => { - cy.wpCli('wp elasticpress stats') - .its('stdout') - .should('contain', `Documents: ${defaultApprovedComments + 1}`); - }); + cy.wpCli('wp elasticpress stats') + .its('stdout') + .should('contain', `Documents: ${defaultApprovedComments + 1}`); // trash the comment cy.visitAdminPage('edit-comments.php?comment_status=approved'); diff --git a/tests/cypress/integration/features/facets.cy.js b/tests/cypress/integration/features/facets.cy.js index 33fe56a490..2162fe735e 100644 --- a/tests/cypress/integration/features/facets.cy.js +++ b/tests/cypress/integration/features/facets.cy.js @@ -5,15 +5,20 @@ describe('Facets Feature', { tags: '@slow' }, () => { * before running tests. */ before(() => { - cy.maybeEnableFeature('facets'); - cy.wpCli('elasticpress sync --setup --yes'); - cy.wpCli('post list --s="A new" --ep_integrate=false --format=ids').then( - (wpCliResponse) => { - if (wpCliResponse.stdout) { - cy.wpCli(`post delete ${wpCliResponse.stdout} --force`); - } - }, - ); + cy.wpCliEval(` + \\ElasticPress\\Features::factory()->activate_feature('facets' ); + WP_CLI::runcommand( 'elasticpress sync --setup --yes' ); + $posts = new \\WP_Query( + [ + 's' => 'A new', + 'ep_integrate' => false, + 'fields' => 'ids', + ] + ); + foreach ( $posts->posts as $post ) { + wp_delete_post( $post, true ); + } + `); }); /** @@ -277,12 +282,22 @@ describe('Facets Feature', { tags: '@slow' }, () => { it('Does not change post types being displayed', () => { cy.wpCliEval( ` - WP_CLI::runcommand( 'plugin activate cpt-and-custom-tax' ); - WP_CLI::runcommand( 'post create --post_title="A new page" --post_type="page" --post_status="publish"' ); - WP_CLI::runcommand( 'post create --post_title="A new post" --post_type="post" --post_status="publish"' ); - WP_CLI::runcommand( 'post create --post_title="A new post" --post_type="post" --post_status="publish"' ); + activate_plugin( 'cpt-and-custom-tax.php' ); + wp_insert_post( + [ + 'post_title' => 'A new page', + 'post_type' => 'page', + 'post_status' => 'publish', + ] + ); + wp_insert_post( + [ + 'post_title' => 'A new post', + 'post_type' => 'post', + 'post_status' => 'publish', + ] + ); - // tax_input does not seem to work properly in WP-CLI. $movie_id = wp_insert_post( [ 'post_title' => 'A new movie', @@ -290,38 +305,34 @@ describe('Facets Feature', { tags: '@slow' }, () => { 'post_status' => 'publish', ] ); - if ( $movie_id ) { - wp_set_object_terms( $movie_id, 'action', 'genre' ); - WP_CLI::runcommand( 'elasticpress sync --include=' . $movie_id ); - WP_CLI::runcommand( 'rewrite flush' ); - } + wp_set_object_terms( $movie_id, 'action', 'genre' ); `, - ); - - /** - * Give Elasticsearch some time to process the post. - * - */ - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(2000); + ).then(() => { + /** + * Give Elasticsearch some time to process the post. + * + */ + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(2000); - // Blog page - cy.visit('/'); - cy.contains('.site-content article h2', 'A new page').should('not.exist'); - cy.contains('.site-content article h2', 'A new post').should('exist'); - cy.contains('.site-content article h2', 'A new movie').should('not.exist'); - - // Specific taxonomy archive - cy.visit('/blog/genre/action/'); - cy.contains('.site-content article h2', 'A new page').should('not.exist'); - cy.contains('.site-content article h2', 'A new post').should('not.exist'); - cy.contains('.site-content article h2', 'A new movie').should('exist'); - - // Search - cy.visit('/?s=new'); - cy.contains('.site-content article h2', 'A new page').should('exist'); - cy.contains('.site-content article h2', 'A new post').should('exist'); - cy.contains('.site-content article h2', 'A new movie').should('exist'); + // Blog page + cy.visit('/'); + cy.contains('.site-content article h2', 'A new page').should('not.exist'); + cy.contains('.site-content article h2', 'A new post').should('exist'); + cy.contains('.site-content article h2', 'A new movie').should('not.exist'); + + // Specific taxonomy archive + cy.visit('/blog/genre/action/'); + cy.contains('.site-content article h2', 'A new page').should('not.exist'); + cy.contains('.site-content article h2', 'A new post').should('not.exist'); + cy.contains('.site-content article h2', 'A new movie').should('exist'); + + // Search + cy.visit('/?s=new'); + cy.contains('.site-content article h2', 'A new page').should('exist'); + cy.contains('.site-content article h2', 'A new post').should('exist'); + cy.contains('.site-content article h2', 'A new movie').should('exist'); + }); }); describe('Filter by Metadata block', () => { diff --git a/tests/cypress/integration/features/woocommerce.cy.js b/tests/cypress/integration/features/woocommerce.cy.js index 043a6a8c46..cd9e2c1f01 100644 --- a/tests/cypress/integration/features/woocommerce.cy.js +++ b/tests/cypress/integration/features/woocommerce.cy.js @@ -166,6 +166,7 @@ describe('WooCommerce Feature', { tags: '@slow' }, () => { cy.get('#billing_city').type(userData.city); cy.get('#billing_postcode').type(userData.postCode); cy.get('#billing_phone').type(userData.phoneNumber); + cy.get('#billing_email').clearThenType(userData.email); cy.get('#place_order').click(); // ensure order is placed. @@ -289,9 +290,11 @@ describe('WooCommerce Feature', { tags: '@slow' }, () => { thirdProductId = id; }); + cy.intercept('POST', '/wp-admin/admin-ajax.php*').as('ajaxRequest'); cy.get('@thirdProduct') - .drag('#the-list tr:eq(0)', { force: true }) + .drag('#the-list tr:eq(0)', { target: { position: 'top' }, force: true }) .then(() => { + cy.wait('@ajaxRequest').its('response.statusCode').should('eq', 200); cy.get('#the-list tr:eq(0)').should('have.id', thirdProductId); cy.refreshIndex('post').then(() => { diff --git a/tests/cypress/support/global-hooks.js b/tests/cypress/support/global-hooks.js index bdb8017c30..a3ebeb1ddb 100644 --- a/tests/cypress/support/global-hooks.js +++ b/tests/cypress/support/global-hooks.js @@ -24,11 +24,10 @@ before(() => { update_option( 'ep_feature_settings', $features ); - $index_names = WP_CLI::runcommand('elasticpress get-indices', [ 'return' => true ] ); - + $index_names = \\ElasticPress\\Elasticsearch::factory()->get_index_names( 'active' ); echo wp_json_encode( [ - 'indexNames' => json_decode( $index_names ), + 'indexNames' => $index_names, 'isEpIo' => $is_epio, 'wpVersion' => get_bloginfo( 'version' ), ] diff --git a/tests/cypress/wordpress-files/test-mu-plugins/skip-wp-lookup.php b/tests/cypress/wordpress-files/test-mu-plugins/skip-wp-lookup.php new file mode 100644 index 0000000000..c8a9a8375b --- /dev/null +++ b/tests/cypress/wordpress-files/test-mu-plugins/skip-wp-lookup.php @@ -0,0 +1,25 @@ + [], + ]; +} + +add_filter( 'translations_api', __NAMESPACE__ . '\skip_translations_api' ); diff --git a/tests/cypress/wordpress-files/test-plugins/cpt-and-custom-tax.php b/tests/cypress/wordpress-files/test-plugins/cpt-and-custom-tax.php index 1efcbac578..9b029f42e4 100644 --- a/tests/cypress/wordpress-files/test-plugins/cpt-and-custom-tax.php +++ b/tests/cypress/wordpress-files/test-plugins/cpt-and-custom-tax.php @@ -75,3 +75,13 @@ function create_taxonomy() { register_taxonomy( 'genre', [ 'movie' ], $args ); } add_action( 'init', __NAMESPACE__ . '\\create_taxonomy' ); + +/** + * Flush rewrite rules after registering the CPT and taxonomy + */ +function rewrite_flush() { + create_post_type(); + create_taxonomy(); + flush_rewrite_rules(); +} +register_activation_hook( __FILE__, __NAMESPACE__ . '\\rewrite_flush' );