question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] `context.waitForEvent('page')` not working on Github Actions

See original GitHub issue

I have Playwright tests that perform an action that opens a new tab, and then assert on the properties of the new tab.

The test waits for context.waitForEvent('page'), and is getting a timeout on Github Actions.

The code is the head of this repo: https://github.com/canopy-js/canopy-js

The tests that are failing are eg https://github.com/canopy-js/canopy-js/blob/main/playwright/navigation.spec.js#L62

Here is an example of a failing build: https://github.com/canopy-js/canopy-js/actions/runs/2835914632

However, when I run these same tests locally (npx playwright test), there are no errors.

Any ideas what might be happening?

Thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nico-olivarescommented, Sep 9, 2022

Hey guys. I stumbled upon this thread trying to solve the same issue. The thread didn’t solve it for me, but it pointed me in the right direction. Here is my solution to the problem. Now my tests run fine in mac and CI (linux).

let macOS = process.platform === 'darwin' //darwin is macOS
let [newTab] = await Promise.all([
	context.waitForEvent('page'),
	macOS
		? link.click({ modifiers: ['Meta'] })
		: link.click({ modifiers: ['Control'] }),
])
0reactions
canopy-js-usercommented, Sep 9, 2022

@nico-olivares Good point, will edit for future readers

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] waitForEvent 'page' seems to be unstable #5948 - GitHub
Context : I'm trying to get the new window tab when run automation by ... ('page') run normally in local, it just has...
Read more >
[Handling new pages] getting Context closed error when trying ...
await context.waitForEvent("page"), // this is where I get the context closed error await page.locator('#submit').click(); ]);
Read more >
[Question] waitForEvent why not working headless mode
From a frame opening a new page working always with headed mode, but never with headless mode. const frame = page.
Read more >
Got timeout in context.waitForEvent("page"), in POM Playwright.
Hi, I got timeout in context.waitForEvent("page"), in POM Playwright. The new page was loaded but test stop, like waiting for something, ...
Read more >
[BUG] page.waitForEvent('dialog') is not working #4737 - GitHub
Context : Playwright Version: 1.6 Operating System: windows Node.js version: 15.x Browser: chromium Code Snippet const [dialog] = await ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found