Mechanism to not inject hammerhead code into JS resources at runtime
What is your Scenario?
Currently, Test Cafe uses a reverse proxy which acts like a man in the middle and injects Test Cafe/Hammerhead specific code into the main HTML document and also all linked JavaScript resources. The problem with this injection is that for a lot of cases it's very intrusive and breaks all sourcemaps that are associated with the code. The specific problem it creates for me is that as the tests run, and the application throws runtime exceptions, our error reporting tool (Sentry), cannot link to the sourcemaps it has since the stack frames no longer match.
What are you suggesting?
There should be a package that we import, or a webpack loader, that basically enables the hammerhead code without having to inject it adhoc at runtime.
What alternatives have you considered?
There are none other than going with a different tool that does not do adhoc injecting at runtime.
Additional context
No response
Hi @leojh
TestCafe is based on code injection into the tested page. It's necessary for the Smart assertion mechanisms and Built-in wait mechanisms. So, it's hard to work without code injection and we will not implement such capability. We will consider possible issues separately.
The case with support for sourcemaps is described.
You can prepare a simple example illustrating the issue you found and attach it here.
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.
This is a real shame since there shouldn't be a need to inject the code. The developer should have the option to just simply include hammerhead as a dependency and have the application be under test using the exact code that is deployed without injection. Breaking the source maps is unfortunately a pretty serious side effect currently.
I agree with you that there are several negative side effects related to using proxy.
We have plans to implement the capability to run tests without using the testcafe-hammerhead proxy.
We will announce it once it is implemented.
@miherlosev any recent convos or updates on your end about this? btw we're also happy to help out on the implementation side if you need that.
Hi @leojh,
Thank you for your offer to help. At present, we are working on the prototype. Later, we will create a list of tasks to make the prototype more stable and functional. If there are tasks that can be done by non-team contributors, we will notify you.
Hi @leojh,
The new test run mode became the default mode in [email protected]. Please run tests with the latest TestCafe version and let us know your results.
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.