From d56971780838ac85337193212959bd116711fadc Mon Sep 17 00:00:00 2001 From: Veljko V Date: Thu, 14 Jan 2021 17:19:06 +0100 Subject: [PATCH] Update scenario of shopper paying his order --- package-lock.json | 72 +++++++++++++++---- .../front-end-my-account-pay-order.test.js | 22 +++--- 2 files changed, 70 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0983a0cbb1..5becf90d96c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "woocommerce", - "version": "4.9.0", + "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -20615,6 +20615,7 @@ "version": "file:tests/e2e/utils", "dev": true, "requires": { + "@wordpress/deprecated": "^2.10.0", "@wordpress/e2e-test-utils": "^4.6.0", "config": "3.3.3", "faker": "^5.1.0", @@ -20915,6 +20916,27 @@ "integrity": "sha512-pB45JlfmHuEigNFZ1X+CTgIsOT3/TTb9iZxw1DHXge/7ytY8FNhtcNwTfF9IgnS6/xaFRZBqzw4DyH4sP1Lyxg==", "dev": true }, + "@wordpress/deprecated": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-2.11.0.tgz", + "integrity": "sha512-2wfl5J8Y3hZeqkD9QAuXTRxPeXm6x5rxsz+CAFG+SS1E9FYZdB0FnRmm26iza7oDo0n917SuM+QDJ5R8P0UxlA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.12.5", + "@wordpress/hooks": "^2.11.0" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "@wordpress/e2e-test-utils": { "version": "4.15.0", "resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.15.0.tgz", @@ -20973,6 +20995,26 @@ } } }, + "@wordpress/hooks": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-2.11.0.tgz", + "integrity": "sha512-TbvCrHcMiSZoyiflegEqVS3DDytDTpkms+yLUaGN4sMvNdR/Mv5s0WnNKyM0T49lbmZYPWlbWhwJ1F6hr/FQDg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.12.5" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "@wordpress/i18n": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.16.0.tgz", @@ -21083,7 +21125,7 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg=", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, "acorn": { @@ -21280,7 +21322,7 @@ "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha1-aALmJk79GMeQobDVF/DyYnvyyUo=", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true }, "are-we-there-yet": { @@ -21329,7 +21371,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, "arr-union": { @@ -22053,7 +22095,7 @@ "babylon": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, "bail": { @@ -24022,7 +24064,7 @@ "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { "ms": "2.0.0" @@ -24823,7 +24865,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -25964,7 +26006,7 @@ "fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha1-4y/AMKLM7kSmtTcTCNpUvgs5fSc=", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", "dev": true }, "fs-write-stream-atomic": { @@ -27375,7 +27417,7 @@ "grunt-postcss": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/grunt-postcss/-/grunt-postcss-0.9.0.tgz", - "integrity": "sha1-++WTSmvp6siTr20FfiMYyX+unaM=", + "integrity": "sha512-lglLcVaoOIqH0sFv7RqwUKkEFGQwnlqyAKbatxZderwZGV1nDyKHN7gZS9LUiTx1t5GOvRBx0BEalHMyVwFAIA==", "dev": true, "requires": { "chalk": "^2.1.0", @@ -28738,7 +28780,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, "is-callable": { @@ -28905,7 +28947,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -31966,7 +32008,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -33134,7 +33176,7 @@ "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -35071,7 +35113,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -36855,7 +36897,7 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { "os-tmpdir": "~1.0.2" diff --git a/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js b/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js index 1ff91716625..48852fe9f6d 100644 --- a/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js +++ b/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js @@ -10,6 +10,7 @@ const { } = require( '@woocommerce/e2e-utils' ); let simplePostIdValue; +let orderNum; const config = require( 'config' ); const simpleProductName = config.get( 'products.simple.name' ); @@ -21,26 +22,29 @@ const runMyAccountPayOrderTest = () => { await merchant.logout(); await shopper.login(); await shopper.goToProduct(simplePostIdValue); - await shopper.addToCartFromShopPage(simpleProductName); + await shopper.addToCart(simpleProductName); await shopper.goToCheckout(); await shopper.fillBillingDetails(config.get('addresses.customer.billing')); await uiUnblocked(); await shopper.placeOrder(); - const orderElement = await page.$(".order"); - const orderId = await page.evaluate(orderElement => orderElement.textContent, orderElement); - await shopper.logout(); + + // Get order ID from the order received html element on the page + orderNum = await page.$$eval(".woocommerce-order-overview__order strong", + elements => elements.map(item => item.textContent)); + await merchant.login(); - await merchant.updateOrderStatus(orderId, 'Pending payment'); + await merchant.updateOrderStatus(orderNum, 'Pending payment'); await merchant.logout(); }) it('allows customer to pay for his order in my account', async () => { await shopper.login(); await shopper.goToOrders(); - await expect(page).toClick('.wc_payment_method woocommerce-button button pay', {text: 'Pay'}); - await expect(page).toMatchElement('.entry-title', {text: 'Pay for order'}); - await shopper.placeOrder(); - await expect(page).toMatch('Order received'); + await expect(page).toClick('a.woocommerce-button.button.pay'); + await page.waitForNavigation({ waitUntil: 'networkidle0' }) + await expect(page).toMatchElement('.entry-title', { text: 'Pay for order' }); + await shopper.placeOrder(); + await expect(page).toMatch('Order received'); }); }); }