-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add block-network-request command #600
Add block-network-request command #600
Conversation
This provides a reasonable way to simulate a flakey network, busted deploy, or ad blocker. It lets us actively block a network request that the page makes. // to simulate JS that is enabled, but fails to load block-network-request: "*.js" This is the simplest case, but is not the only useful one. It can also block specific files, and it can stack: block-network-request: "*/search-index.js" block-network-request: "*/search.js" Once a block list is added, there's no way to remove it. Flakey network tests will probably be in separate test files, so that shouldn't be a serious weakness.
@@ -0,0 +1,13 @@ | |||
// This test is meant to ensure that we can block an external script request. | |||
// Since we are intentionally causing request errors, don't block them. | |||
fail-on-request-error: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you mention this in the documentation as well please? Could be surprising that a test fails if you block a request in another command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've addressed both nits.
Awesome, thanks! |
I'll make a new release soon and update rust-lang/rust#123407. |
This provides a reasonable way to simulate a flakey network, busted deploy, or ad blocker. It lets us actively block a network request that the page makes.
This is the simplest case, but is not the only useful one. It can also block specific files, and it can stack:
Once a block list is added, there's no way to remove it. Flakey network tests will probably be in separate test files, so that shouldn't be a serious weakness.
CC rust-lang/rust#123407