TestCafe broken with Firefox 144.0 (works fine on 143.0)
What is your Scenario?
Running TestCafe as usual with my integration tests. Stopped working this morning following Firefox upgrade to 144.0 (64-bit, Windows).
What is the Current behavior?
Blank screen. In console, error is:
Uncaught TypeError: can't access property "configurable", testDivDescriptor is undefined detectBrowserFeatures http://192.168.1.179:1205/hammerhead.js:42721
Appears to be coming from the line:
var testDivDescriptor = this.nativeMethods.objectGetOwnPropertyDescriptor
Which is returning 'undefined'
What is the Expected behavior?
TestCafe functions as it did with Firefox 143.0.4
What is the public URL of the test page? (attach your complete example)
n/a
What is your TestCafe test code?
n/a
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
No response
Command-line arguments
testcafe
Browser name(s) and version(s)
Firefox 144.0
Platform(s) and version(s)
No response
Other
No response
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.
The problem seems to be some type of refactoring @ Firefox. There, the CSS2Properties class was renamed to CSSStyleProperties, so that the Hammerhead-workarounds no longer work: https://github.com/DevExpress/testcafe-hammerhead/blob/v31.7.5/src/client/sandbox/style.ts#L55
Releasenotes: https://www.firefox.com/en-US/firefox/144.0/releasenotes/
When will we get a solution to this?
Hello @Suchiraz,
We are currently working on a release with the fix, but I cannot provide an exact ETA. We will post and update here when we get it ready.
I had this issue recently and I fixed it temporarily by editing hammerhead.js
StyleSandbox.prototype.detectBrowserFeatures = function () {
var features = {};
// NOTE: The CSS2Properties class is supported only in the Firefox
// and its prototype contains all property descriptors
// @ts-ignore
features.css2PropertiesProtoContainsAllProps = !!window.CSS2Properties;
features.cssStyleDeclarationProtoContainsUrlProps = this.nativeMethods.objectHasOwnProperty
.call(window.CSSStyleDeclaration.prototype, 'background');
features.cssStyleDeclarationProtoContainsDashedProps = this.nativeMethods.objectHasOwnProperty
.call(window.CSSStyleDeclaration.prototype, 'background-image');
features.cssStyleDeclarationContainsAllProps = features.cssStyleDeclarationProtoContainsUrlProps &&
features.cssStyleDeclarationProtoContainsDashedProps;
if (!features.css2PropertiesProtoContainsAllProps && !features.cssStyleDeclarationProtoContainsUrlProps) {
var testDiv = this.nativeMethods.createElement.call(document, 'div');
var propertySetterIsCalled_1 = false;
var testDivDescriptor = this.nativeMethods.objectGetOwnPropertyDescriptor
// @ts-ignore
.call(window.Object, testDiv.style, 'background');
if (testDivDescriptor !== undefined && testDivDescriptor.configurable) {
// eslint-disable-next-line no-restricted-properties
delete testDivDescriptor.value;
delete testDivDescriptor.writable;
testDivDescriptor.set = function () {
propertySetterIsCalled_1 = true;
};
this.nativeMethods.objectDefineProperty(testDiv.style, 'background', testDivDescriptor);
testDiv.style.background = 'url';
}
// NOTE: A style instance contains all url properties.
// They are non-configurable in Safari less than 11.1.
// Their setter cannot be called in Safari 11.1.
features.propsCannotBeOverridden = testDivDescriptor !== undefined && !testDivDescriptor.configurable || !propertySetterIsCalled_1;
}
return features;
};
Specifically adding testDivDescriptor !== undefined && to if (testDivDescriptor !== undefined && testDivDescriptor.configurable) { and features.propsCannotBeOverridden = testDivDescriptor !== undefined && !testDivDescriptor.configurable || !propertySetterIsCalled_1;
This fix obviously reverts itself when npm install runs again but it was a good temporary solution that didn't involve downgrading my firefox version for the time being
Hello,
As a temporary workaround for this issue, try using the TestCafe Hammerhead build.
It contains the fix for the Firefox issue.
Please let us know your results.
To apply it, simply install it as follows: npm i https://github.com/Bayheck/Builds/raw/main/testcafe-hammerhead-31.7.5.tgz