Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target creation events are sometimes triggered too late #6

Closed
berstend opened this issue Jun 6, 2018 · 1 comment
Closed

Target creation events are sometimes triggered too late #6

berstend opened this issue Jun 6, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@berstend
Copy link
Owner

berstend commented Jun 6, 2018

Unfortunately it's possible that the targetcreated events are not triggered early enough for listeners (e.g. plugins using onPageCreated) to be able to modify the page instance (e.g. user-agent) before the browser request occurs.

This only affects the first request of a newly created page target.

As a workaround I've noticed that navigating to about:blank (again), right after a page has been created reliably fixes this issue and adds no noticable delay or side-effects.

The above workaround only fixes explicitly created pages, implicitly created ones (e.g. through window.open) are still subject to this issue. I didn't find a reliable mitigation for implicitly created pages yet.

This problem is not specific to puppeteer-extra but default Puppeteer behaviour:
puppeteer/puppeteer#2669

@berstend berstend added the bug Something isn't working label Jun 6, 2018
@berstend
Copy link
Owner Author

berstend commented Jun 6, 2018

Closing this for now as popups are more of an edge case (targets created explicitly are fixed) and this is being fixed upstream:
ChromeDevTools/devtools-protocol#77

notnownikki added a commit to WordPress/gutenberg that referenced this issue Jul 31, 2018
gziolo pushed a commit to WordPress/gutenberg that referenced this issue Aug 8, 2018
gziolo added a commit to WordPress/gutenberg that referenced this issue Aug 8, 2018
* Try to rewrite e2e tests using jest-puppeter preset

* Testing: Unskip NUX tests

* Testing: Unskip 4 more e2e tests

* Testsing: Unskip all e2e tests

* Tests: Add one more check for undo e2e tests

* Testing: Improve preview e2e test

* Tests: Use explicit `setViewport` calls

* Build: Ensure `npm run build` is always executed before e2e tests

* Tests: Change the trigger wchich finishes after test cleanup

* Stop using `targetcreated`, see berstend/puppeteer-extra#6

* lint fix

* Use `waitFor` instead of custom sleep

* Fix conflicts with master

* Lint fixes

* Update comment on race condition workaround

* Tests: Improve lifecycle methods for e2e setup

* Send more mousemove events, wait for selector before clicking

* chore: Improve variable name

* chore: Add colon to "See" comment

* chore: Tweak comments in undo test

* chore: Move puppeteer config to e2e folder

* chore: Introduce new e2e helper for clicking block appender

* Tests: Improve stability of e2e tests

* tests: Make e2e tests work with the lastest master changes

* tests: Add puppeteer config back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant