Improve code

This commit is contained in:
Veljko 2021-03-13 11:55:44 +01:00
parent 88cdb83a55
commit 12e417ce71
2 changed files with 5 additions and 2 deletions

View File

@ -25,7 +25,10 @@ const runOrderSearchingTest = () => {
await merchant.openNewOrder(), await merchant.openNewOrder(),
await page.waitForSelector('#order_status'), await page.waitForSelector('#order_status'),
await page.click('#customer_user'), await page.click('#customer_user'),
await selectOptionInSelect2('Customer'), 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 Promise.all([ await Promise.all([

View File

@ -206,7 +206,7 @@ const evalAndClick = async ( selector ) => {
const selectOptionInSelect2 = async ( value, selector = 'input.select2-search__field' ) => { const selectOptionInSelect2 = async ( value, selector = 'input.select2-search__field' ) => {
await page.waitForSelector(selector); await page.waitForSelector(selector);
await page.type(selector, value); await page.type(selector, value);
await page.waitFor(3000); // to avoid flakyness, must wait before pressing Enter await page.waitFor(2000); // to avoid flakyness, must wait before pressing Enter
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
}; };