-
Notifications
You must be signed in to change notification settings - Fork 169
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
Hammerhead transformations break ng19 build output #3035
Comments
Thank you for submitting a bug report. We would love to help you investigate the issue. Please share a simple code example that reliably reproduces the bug. For more information, read the following article: How To Create a Minimal Working Example When You Submit an Issue. We look forward to your response. |
I've created a vanilla ng19 project with TestCafe set up for doing a very simple test here: https://github.com/soletan/testcafe-ng19-example
|
Hello, I managed to run your example with the Native Automation mode enabled. Could you please clarify why you use TestCafe with the "--disable-native-automation" flag? |
Hello, Having the same issue after migrating to Angular 19. Hammerhead simply cannot handle JS bundles produced by Angular 19 when not using native automation (CDP). And it seems that native automation cannot be enabled when any custom testcafe-browser-provider plugin is used. It might be possible to workaround this problem for some projects though. For example, following const { chromium } = require("playwright");
module.exports = {
disableNativeAutomation: false,
browsers: [`chromium:${chromium.executablePath()}:headless`],
}; While package.json could omit desired browser:
TestCafe is not fully compatible with Angular 19+ projects at this moment because of this issue in Hammerhead. |
In our use cases, there have been a reason for disabling native automation though I can barely remember what it was. Thus, I tried enabling native automation and this gets us passed that issue at least when running a test locally (not sure about CI runs). However, another issue came up a few times after that and it has been logging this to stdout after 10-20 seconds:
When trying to do some investigation on this issue, it happens to work at some point and keeps working after that. So, just like in DevExpress/testcafe#7881, the issue seems to happen rather occasionally. It may be worth mentioning that the tested app is authenticating against some IDP and in the tested setup we use lots of request mocking to prevent the app from ever reaching out to any actual backend as well as the IDP by simply mocking those requests, too.
Based on that, it all feels related to either re-using authentication data found in local/session storage or having to get in touch with the IDP which results in that issue logged above. FYI: On invoking testcafe, the browser is To conclude for the moment, I currently doubt enabling native automation is working for us. Enabling native automation is disabling use of hammerhead, isn't it? If so, is your intention to drop hammerhead rather than fixing its support for ng19 or any other application that happens to use "location" as an instance property in a ES class? |
We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news. |
What is your Scenario?
We are testing a web application's build with TestCafe in a local browser like Edge. The application has been based on Angular 17 recently. Everything was working well there. Currently we are trying to upgrade to Angular 19.
What is the Current behavior?
After upgrading to Angular 19, all TestCafe-based tests fail for the application fails to load in any test scenario.
Analysis has found that Hammerhead is transforming occurrences of
location
into__get$Loc(location)
and it is failing to recognize certain cases in which that replacement is breaking the code.This is part of code built by ng19:
The highlighted part gets replaced by hammerhead:
The causing code is here:
The transformation fails to recognize
location
being declared as instance property of that class. The code in question is part of Angular, thus there is no way that we could work around this issue on our end:What is the Expected behavior?
What is your public website URL? (or attach your complete example)
closed source ... must not share
What is your TestCafe test code?
does not apply here
Your complete configuration file
No response
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
TestCafe version
3.7.1
Node.js version
22.11.0
Command-line arguments
testcafe is run through gherkin-testcafe
Browser name(s) and version(s)
No response
Platform(s) and version(s)
Windows 11
Other
typescript 5.4.5
The text was updated successfully, but these errors were encountered: