Improve page util
This commit is contained in:
parent
12e417ce71
commit
959ace94e5
|
@ -19,7 +19,6 @@ const runSingleProductPageTest = require( './shopper/front-end-single-product.te
|
|||
const runVariableProductUpdateTest = require( './shopper/front-end-variable-product-updates.test' );
|
||||
|
||||
// Merchant tests
|
||||
const runOrderSearchingTest = require( './merchant/wp-admin-order-searching.test' );
|
||||
const runCreateCouponTest = require( './merchant/wp-admin-coupon-new.test' );
|
||||
const runCreateOrderTest = require( './merchant/wp-admin-order-new.test' );
|
||||
const runEditOrderTest = require( './merchant/wp-admin-order-edit.test' );
|
||||
|
@ -34,6 +33,7 @@ const runProductEditDetailsTest = require( './merchant/wp-admin-product-edit-det
|
|||
const runProductSearchTest = require( './merchant/wp-admin-product-search.test' );
|
||||
const runMerchantOrdersCustomerPaymentPage = require( './merchant/wp-admin-order-customer-payment-page.test' );
|
||||
const runMerchantOrderEmailsTest = require( './merchant/wp-admin-order-emails.test' );
|
||||
const runOrderSearchingTest = require( './merchant/wp-admin-order-searching.test' );
|
||||
|
||||
// REST API tests
|
||||
const runExternalProductAPITest = require( './api/external-product.test' );
|
||||
|
|
|
@ -25,10 +25,7 @@ const runOrderSearchingTest = () => {
|
|||
await merchant.openNewOrder(),
|
||||
await page.waitForSelector('#order_status'),
|
||||
await page.click('#customer_user'),
|
||||
await page.click('span.select2-search > input.select2-search__field'),
|
||||
await page.type('span.select2-search > input.select2-search__field', 'Customer'),
|
||||
await page.waitFor(2000), // to avoid flakyness
|
||||
await page.keyboard.press('Enter'),
|
||||
await selectOptionInSelect2('Customer'),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
|
@ -44,7 +41,7 @@ const runOrderSearchingTest = () => {
|
|||
await page.keyboard.press('Tab'),
|
||||
await page.keyboard.press('Tab'),
|
||||
await page.keyboard.press('Enter'),
|
||||
await selectOptionInSelect2('New York'),
|
||||
await page.select('select[name="_shipping_state"]', 'NY'),
|
||||
]);
|
||||
|
||||
// Get the post id
|
||||
|
|
|
@ -198,13 +198,14 @@ const evalAndClick = async ( selector ) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* Select a value from select2 input field.
|
||||
* Select a value from select2 search input field.
|
||||
*
|
||||
* @param {string} value Value of what to be selected
|
||||
* @param {string} selector Selector of the select2
|
||||
* @param {string} selector Selector of the select2 search field
|
||||
*/
|
||||
const selectOptionInSelect2 = async ( value, selector = 'input.select2-search__field' ) => {
|
||||
const selectOptionInSelect2 = async ( value, selector = 'span.select2-search > input.select2-search__field' ) => {
|
||||
await page.waitForSelector(selector);
|
||||
await page.click(selector);
|
||||
await page.type(selector, value);
|
||||
await page.waitFor(2000); // to avoid flakyness, must wait before pressing Enter
|
||||
await page.keyboard.press('Enter');
|
||||
|
|
Loading…
Reference in New Issue