hello,
in a nutshell. I have an app (A) that I load in other "host apps" (B and C). These apps are all independent, and working fine normally, but unfortunately I can't get testing to work properly.
When A loads into B, it creates a DIV in the page with a specific ID (I can see this happening with Karma if I use the "Chrome" browser configuration, I can see that it creates that DIV on the page, however, the tests fail with :
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Here is my somewhat pseudo karma/jasmine code:
describe("App A should be loaded", () => {
const appDomId = "APP-A-TEST-ID";
const link = document.createElement( "link" );
link.href = host + "/apps/a/init.css";
link.type = "text/css";
link.rel = "stylesheet";
link.media = "screen,print";
document.getElementsByTagName( "head" )[0].appendChild( link );
const script = document.createElement('script');
script.src = host + "/apps/a/init.js"; // CONTAINS APP_A
document.head.appendChild(script);
beforeEach((done) => {
script.onload = () => {
$("body").append("<div id='" + appDomId + "'></div>");
APP_A.setOptions({
host: host,
user: "blahblah",
domId: appDomId,
onReady: function() {
console.log("WOW! I can't believe we made it!"); // THIS RUNS WHEN APP A IS COMPLETELY LOADED (IT WORKS, I CAN SEE THE LOG IN PHANTOM AND IN CHROME)
done();
}
});
};
// THIS FAILS WITH THE MESSAGE DESCRIBED ABOVE
it("should be 1", (done) => expect(1).toBe(1));
});
any help would be appreciated ....
thanks,
--im