We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Use RequestMock to mock API errors (status code != 200).
RequestMock
TestCafe throws An unhandled error occurred in the "onResponse" method of the "RequestMock" class: null.
An unhandled error occurred in the "onResponse" method of the "RequestMock" class: null
The request should be mocked and no error thrown. This used to work in 1.19.0.
https://testcafe.io
import { RequestMock, t } from 'testcafe'; fixture`Demo`; test .page('https://testcafe.io') .requestHooks( RequestMock() .onRequestTo(/d/) .respond('', 500) ) ('should pass', async () => { await t.wait(1000); });
Demo ✖ should pass 1) An unhandled error occurred in the "onResponse" method of the "RequestMock" class: null Browser: Firefox 102.0 / Linux 0.0
testcafe firefox:headless test.ts
1.20.0
v16.14.0
Firefox 102
Fedora 36
Works in 1.19.0.
The text was updated successfully, but these errors were encountered:
Hi @sorin-davidoi,
I reproduced the issue. We will update this thread once we have news.
Sorry, something went wrong.
miherlosev
Successfully merging a pull request may close this issue.
What is your Scenario?
Use
RequestMock
to mock API errors (status code != 200).What is the Current behavior?
TestCafe throws
An unhandled error occurred in the "onResponse" method of the "RequestMock" class: null
.What is the Expected behavior?
The request should be mocked and no error thrown. This used to work in 1.19.0.
What is your public website URL? (or attach your complete example)
https://testcafe.io
What is your TestCafe test code?
Your complete test report
Steps to Reproduce
testcafe firefox:headless test.ts
, observe failureTestCafe version
1.20.0
Node.js version
v16.14.0
Command-line arguments
testcafe firefox:headless test.ts
Browser name(s) and version(s)
Firefox 102
Platform(s) and version(s)
Fedora 36
Other
Works in 1.19.0.
The text was updated successfully, but these errors were encountered: