Skip to content

Commit ab65a44

Browse files
asambstackfrancisf
authored andcommitted
chore: replace promise.all with async await
1 parent 236fc71 commit ab65a44

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

duckduckgo_search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const expect = require('chai').expect;
2525
await page.goto('https://www.duckduckgo.com');
2626
const element = await page.$('[name="q"]');
2727
await element.click();
28-
await element.type('BrowserStack');
29-
await Promise.all([element.press('Enter'), page.waitForNavigation()]);
28+
await element.type('BrowserStack\n');
29+
await page.waitForNavigation();
3030
const title = await page.title('');
3131
console.log(title);
3232
try {

duckduckgo_search_with_proxy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ bootstrap();
3232
await page.goto('https://www.duckduckgo.com');
3333
const element = await page.$('[name="q"]');
3434
await element.click();
35-
await element.type('BrowserStack');
36-
await Promise.all([element.press('Enter'), page.waitForNavigation()]);
35+
await element.type('BrowserStack\n');
36+
await page.waitForNavigation();
3737
const title = await page.title('');
3838
console.log(title);
3939
try {

parallel_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const main = async (cap) => {
1414
await page.goto('https://www.duckduckgo.com');
1515
const element = await page.$('[name="q"]');
1616
await element.click();
17-
await element.type('BrowserStack');
18-
await Promise.all([element.press('Enter'), page.waitForNavigation()]);
17+
await element.type('BrowserStack\n');
18+
await page.waitForNavigation();
1919
const title = await page.title('');
2020
console.log(title);
2121
try {

puppeteer-jest/duckduckgo.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ describe("DuckDuckGo", () => {
99
it('title should match BrowserStack at DuckDuckGo', async () => {
1010
const element = await page.$('[name="q"]');
1111
await element.click();
12-
await element.type('BrowserStack');
13-
await Promise.all([element.press('Enter'), page.waitForNavigation()]);
12+
await element.type('BrowserStack\n');
13+
await page.waitForNavigation();
1414
try {
1515
expect(await page.title()).toBe('BrowserStack at DuckDuckGo');
1616
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Test assertion passed'}})}`);

sample_session_details_API.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const expect = require('chai').expect;
2525
await page.goto('https://www.duckduckgo.com');
2626
const element = await page.$('[name="q"]');
2727
await element.click();
28-
await element.type('BrowserStack');
29-
await Promise.all([element.press('Enter'), page.waitForNavigation()]);
28+
await element.type('BrowserStack\n');
29+
await page.waitForNavigation();
3030
const title = await page.title('');
3131
console.log(title);
3232
try {

0 commit comments

Comments
 (0)