onResponse not called for AJAX requests when hook constructor receives responseEventConfigureOpts #2190
Labels
AREA: server
FREQUENCY: level 2
STATE: Auto-locked
Issues that were automatically locked by the Lock bot
SYSTEM: request hooks
TYPE: bug
Milestone
What is your Test Scenario?
I implemented a custom hook extending
RequestHook
. In the hook's constructor I callsuper(null, { includeHeaders: true })
to listen to all requests and use the response headers.What is the Current behavior?
The
onResponse
method is only invoked for non-ajax requests.What is the Expected behavior?
The
onResponse
method is invoked for all requests.What is your web application and your TestCafe test code?
I created a repo with the sample test: https://github.com/fedebertolini/testcafe-hooks-issue
My hook receives the
responseEventConfigureOpts
config as parameter, and will callsuper
passing this object. I created three simple tests using the hook in 3 different ways:undefined
{ includeHeaders: true}
In
onResponse
I log the url of the ajax requests only. Only in the first case I can see the requests being loaded:Your complete test code (or attach your test files):
Your complete configuration file (if any):
Your complete test report:
Steps to Reproduce:
npm i
npm start
(assuming you have chrome installed)Your Environment details:
1.7.0
v12.13.0
testcafe chrome index.js
chrome 78.0.3904.108
macOS 10.14.6
The text was updated successfully, but these errors were encountered: