Did anybody used the unit-tests from the addon-sdk(cfx test)?
I made a test that looks like this:
exports.test_open_tab = function(test) {
const tabs = require("tabs");
tabs.open({
url: "http://valid url with lots of params",
onReady: function(tab) {
test.done();
}
});
test.waitUntilDone(600*1000);
};
basically this should open a tab, wait 600seconds, and them mark it as passed.
It actually displays a lot of errors and warning in the console from the loaded page(jquery and google analytics stuff, used by the loaded page) and then it marks the test as failed.
Any idea why?
One obvious issue is that you don’t actually have any test results. If the fact that
onReady()is called is a positive result you should write:Btw, the only case where it would wait 600 seconds is if
onReadyisn’t called for some reason. Otherwise yourtest.done()call will complete the test execution.You can somewhat reduce the number of warnings logged by disabling
javascript.options.strictpreference. However, these warnings might indicate real issues and in current Firefox versions it probably makes more sense to switch off display of JavaScript and CSS warnings in the console.