Update scenario of shopper paying his order

This commit is contained in:
Veljko V 2021-01-14 17:19:06 +01:00
parent 50d601355c
commit d569717808
2 changed files with 70 additions and 24 deletions

72
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "woocommerce", "name": "woocommerce",
"version": "4.9.0", "version": "5.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -20615,6 +20615,7 @@
"version": "file:tests/e2e/utils", "version": "file:tests/e2e/utils",
"dev": true, "dev": true,
"requires": { "requires": {
"@wordpress/deprecated": "^2.10.0",
"@wordpress/e2e-test-utils": "^4.6.0", "@wordpress/e2e-test-utils": "^4.6.0",
"config": "3.3.3", "config": "3.3.3",
"faker": "^5.1.0", "faker": "^5.1.0",
@ -20915,6 +20916,27 @@
"integrity": "sha512-pB45JlfmHuEigNFZ1X+CTgIsOT3/TTb9iZxw1DHXge/7ytY8FNhtcNwTfF9IgnS6/xaFRZBqzw4DyH4sP1Lyxg==", "integrity": "sha512-pB45JlfmHuEigNFZ1X+CTgIsOT3/TTb9iZxw1DHXge/7ytY8FNhtcNwTfF9IgnS6/xaFRZBqzw4DyH4sP1Lyxg==",
"dev": true "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": { "@wordpress/e2e-test-utils": {
"version": "4.15.0", "version": "4.15.0",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.15.0.tgz", "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": { "@wordpress/i18n": {
"version": "3.16.0", "version": "3.16.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.16.0.tgz", "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.16.0.tgz",
@ -21083,7 +21125,7 @@
"abbrev": { "abbrev": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "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 "dev": true
}, },
"acorn": { "acorn": {
@ -21280,7 +21322,7 @@
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"integrity": "sha1-aALmJk79GMeQobDVF/DyYnvyyUo=", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"dev": true "dev": true
}, },
"are-we-there-yet": { "are-we-there-yet": {
@ -21329,7 +21371,7 @@
"arr-flatten": { "arr-flatten": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "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 "dev": true
}, },
"arr-union": { "arr-union": {
@ -22053,7 +22095,7 @@
"babylon": { "babylon": {
"version": "6.18.0", "version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=", "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
"dev": true "dev": true
}, },
"bail": { "bail": {
@ -24022,7 +24064,7 @@
"debug": { "debug": {
"version": "2.6.9", "version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true, "dev": true,
"requires": { "requires": {
"ms": "2.0.0" "ms": "2.0.0"
@ -24823,7 +24865,7 @@
}, },
"es6-promisify": { "es6-promisify": {
"version": "5.0.0", "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=", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -25964,7 +26006,7 @@
"fs-readdir-recursive": { "fs-readdir-recursive": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", "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 "dev": true
}, },
"fs-write-stream-atomic": { "fs-write-stream-atomic": {
@ -27375,7 +27417,7 @@
"grunt-postcss": { "grunt-postcss": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/grunt-postcss/-/grunt-postcss-0.9.0.tgz", "resolved": "https://registry.npmjs.org/grunt-postcss/-/grunt-postcss-0.9.0.tgz",
"integrity": "sha1-++WTSmvp6siTr20FfiMYyX+unaM=", "integrity": "sha512-lglLcVaoOIqH0sFv7RqwUKkEFGQwnlqyAKbatxZderwZGV1nDyKHN7gZS9LUiTx1t5GOvRBx0BEalHMyVwFAIA==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.1.0", "chalk": "^2.1.0",
@ -28738,7 +28780,7 @@
"is-buffer": { "is-buffer": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true "dev": true
}, },
"is-callable": { "is-callable": {
@ -28905,7 +28947,7 @@
}, },
"is-obj": { "is-obj": {
"version": "1.0.1", "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=", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
"dev": true "dev": true
}, },
@ -31966,7 +32008,7 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true, "dev": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
@ -33134,7 +33176,7 @@
"npmlog": { "npmlog": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
"integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"dev": true, "dev": true,
"requires": { "requires": {
"are-we-there-yet": "~1.1.2", "are-we-there-yet": "~1.1.2",
@ -35071,7 +35113,7 @@
}, },
"safe-regex": { "safe-regex": {
"version": "1.1.0", "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=", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -36855,7 +36897,7 @@
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true, "dev": true,
"requires": { "requires": {
"os-tmpdir": "~1.0.2" "os-tmpdir": "~1.0.2"

View File

@ -10,6 +10,7 @@ const {
} = require( '@woocommerce/e2e-utils' ); } = require( '@woocommerce/e2e-utils' );
let simplePostIdValue; let simplePostIdValue;
let orderNum;
const config = require( 'config' ); const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' ); const simpleProductName = config.get( 'products.simple.name' );
@ -21,26 +22,29 @@ const runMyAccountPayOrderTest = () => {
await merchant.logout(); await merchant.logout();
await shopper.login(); await shopper.login();
await shopper.goToProduct(simplePostIdValue); await shopper.goToProduct(simplePostIdValue);
await shopper.addToCartFromShopPage(simpleProductName); await shopper.addToCart(simpleProductName);
await shopper.goToCheckout(); await shopper.goToCheckout();
await shopper.fillBillingDetails(config.get('addresses.customer.billing')); await shopper.fillBillingDetails(config.get('addresses.customer.billing'));
await uiUnblocked(); await uiUnblocked();
await shopper.placeOrder(); await shopper.placeOrder();
const orderElement = await page.$(".order");
const orderId = await page.evaluate(orderElement => orderElement.textContent, orderElement); // Get order ID from the order received html element on the page
await shopper.logout(); orderNum = await page.$$eval(".woocommerce-order-overview__order strong",
elements => elements.map(item => item.textContent));
await merchant.login(); await merchant.login();
await merchant.updateOrderStatus(orderId, 'Pending payment'); await merchant.updateOrderStatus(orderNum, 'Pending payment');
await merchant.logout(); await merchant.logout();
}) })
it('allows customer to pay for his order in my account', async () => { it('allows customer to pay for his order in my account', async () => {
await shopper.login(); await shopper.login();
await shopper.goToOrders(); await shopper.goToOrders();
await expect(page).toClick('.wc_payment_method woocommerce-button button pay', {text: 'Pay'}); await expect(page).toClick('a.woocommerce-button.button.pay');
await expect(page).toMatchElement('.entry-title', {text: 'Pay for order'}); await page.waitForNavigation({ waitUntil: 'networkidle0' })
await shopper.placeOrder(); await expect(page).toMatchElement('.entry-title', { text: 'Pay for order' });
await expect(page).toMatch('Order received'); await shopper.placeOrder();
await expect(page).toMatch('Order received');
}); });
}); });
} }