简体   繁体   中英

Pending operations in playwright on nodejs

I'm trying to get a new page at the moment of clicking on the link:

await test.step(`Step name`, async () => {
    const [newPage] = await Promise.all([ 
        context.waitForEvent('page'), 
        page.click('//span[normalize-space(@title)=\'Bup\']')
    ]);
}

And I get this page. Further operations with this instance are successful. But after 30 seconds the test ends with the following error:

Timeout of 30000ms exceeded.
Pending operations: 
    - browserContext.waitForEvent at "path to the file":48:21
    - at <unknown>

I will assume that it is related to a promise, but I do not understand what exactly the problem is. Help is needed. Playwright v14.0, nodejs v16.7.0 . I run the tests with the following command: npx playwright test tests/diag.spec.mjs --headed

A strange observation. When I run it in debug mode, there is no such error :

PWDEBUG=1 npx playwright test tests/diag.spec.mjs

Ok, I found the answer, but it's a little weird. You need to increase the timeout in the playwright config:

https://github.com/microsoft/playwright/issues/8268

Also you can add test.slow() https://playwright.dev/docs/api/class-test#test-slow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM