Open pravin-dsilva opened 7 years ago
The issue occurs because the mocha and mocha-phantomjs versions are not compatible with Phantomjs 2.1.1
To resolve the issue, changed the versions of "mocha" from "1.9.0" to "1.21.5" and "mocha-phantomjs" from"~3.1.6" to "~4.1.0" in package.json
On running the tests, another error is seen:
Error loading resource file:///img/logo-white.png (203). Details: Error opening /img/logo-white.png: No such file or directory
Likely due to external resource loading and timing, your tests require calling `window.initMochaPhantomJS()` before calling any mocha setup functions. See https://github.com/nathanboktae/mocha-phantomjs-core/issues/12
To resolve this, added code to call 'window.initMochaPhantomJS()' before calling 'mocha.ui('bdd')' method in ambari-web/app/assets/test/test.html file.
diff --git a/ambari-web/app/assets/test/test.html b/ambari-web/app/assets/test/test.html
--- a/ambari-web/app/assets/test/test.html
+++ b/ambari-web/app/assets/test/test.html
@@ -41,6 +41,7 @@
<script>
$.mocho = true;
$.hostName = 'localhost:3333';
+ window.initMochaPhantomJS && window.initMochaPhantomJS();
mocha.ui('bdd');
mocha.reporter('html');
expect = chai.expect;
On making the above changes and running the tests, the tests completed without failures:
29088 passing (47s)
154 pending
This result appears on both Power and x86
In the Ambari-web project, On running the mocha-phantomjs tests using Phantomjs version 2.1.1 on ppc64le and x86, the tests do not run but get hanged and do not show any error message as well.
Console output: