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

E2E Tests: Add CPU/Network slowdown configuration options #18770

Merged
merged 3 commits into from Dec 7, 2019

Conversation

@aduth
Copy link
Member

aduth commented Nov 26, 2019

Closes #15677

This pull request seeks to add additional environment variable configuration options to the E2E test runner which can be used to simulate slow network or CPU conditions.

For more information, see included Testing Overview document description:

If you find that end-to-end tests pass when run locally, but fail in Travis, you may be able to isolate a CPU- or netowrk-bound race condition by simulating a slow CPU or network:

THROTTLE_CPU=4 npm run test-e2e

THROTTLE_CPU is a slowdown factor (in this example, a 4x slowdown multiplier)

Related: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setCPUThrottlingRate

DOWNLOAD_THROUGHPUT=125000 npm run test-e2e

DOWNLOAD_THROUGHPUT is a numeric value representing bytes-per-second network download (in this example, a 1Mbps download speed).

Related: https://chromedevtools.github.io/devtools-protocol/tot/Network#method-emulateNetworkConditions

Testing Instructions:

You can observe that by providing a THROTTLE_CPU value when running npm run test-e2e for a test suite, it will likely take longer to complete than if the value is not provided.

@gziolo
gziolo approved these changes Dec 6, 2019
Copy link
Member

gziolo left a comment

Thank you for working on it.

It's a bit simplified implementation in comparison to what I proposed in the original issue but it should be enough for us to simulate those specific configurations. One day, I will implement it as advertised in smooth-code/jest-puppeteer#241 directly in the jest-puppeteer unless someone else does it earlier :)

Based on the code from the issue and this implementation. I'm confident it's good to go. I can give it a spin once it's merged into master 💯

Co-Authored-By: Grzegorz (Greg) Ziółkowski <grzegorz@gziolo.pl>
@aduth

This comment has been minimized.

Copy link
Member Author

aduth commented Dec 6, 2019

It's a bit simplified implementation in comparison to what I proposed in the original issue but it should be enough for us to simulate those specific configurations.

Yeah, at least for how I expected it to work, this would be sufficient for one-off debugging. I see it as similar to running "headless" or "slowmo" in that way, so modeled it after those options.

@aduth aduth merged commit 8e3f1ee into master Dec 7, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@aduth aduth deleted the add/e2e-cpu-slowdown branch Dec 7, 2019
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.