#14929 closed defect (fixed)
DOH Robot does not work with async loader
Reported by: | Colin Snover | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.7.6 |
Component: | TestFramework | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
- Attempting to use DOH Robot with async loader causes it to clobber the entire page because dojo/robotx and doh/runner use
document.write
.
- Attempting to write and use tests in a parent document that try to access widgets of the child document fail because things like
dijit/registry
are operating on the parent document and there is a mountain of code that relies heavily on the defined pattern of global object usage to try to fiddle with context to get these sorts of things to work “correctly”.
I am not sure this is actually fixable but I am logging a defect just in case since I spent a bunch of time tracking this stuff down.
Change History (27)
comment:1 Changed 9 years ago by
Status: | new → open |
---|
comment:2 Changed 9 years ago by
Blocking: | 14279 added |
---|
comment:3 Changed 9 years ago by
I tried using dojo.global.require() directly and that works nicely. The plugin idea looks even better.
comment:7 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|---|
Owner: | set to bill |
Status: | open → assigned |
comment:9 Changed 9 years ago by
Do we have updated docs on this? Is there anything special that needs to happen when a user tries to use DOH Robot with the async loader?
comment:10 Changed 9 years ago by
dohRobot.rst should definitely be updated to AMD format. The data in the iframe file (loaded by initRobot()) should be accessed via require(), ex:
var registry = kernel.global.require("dijit/registry");
(That's assuming that registry is already loaded in the iframe.)
The old way of calling dijit.byId() or dojo.global.dijit.byId() will probably still work, but the above syntax is future-proof.
I thought I made a new variable for accessing the iframe's global, like robot.iframe, but I guess I didn't check that change in. robot.iframe.require() seems clearer than kernel.global.require() to me.
Note also that I didn't implement the plugin you suggested in comment:1. Maybe that would be an improvement although it doesn't seem to get us much beyond the kernel.global.require() syntax. (In your plugin suggestion I'm not sure why we need toAbsMid()?)
comment:17 Changed 9 years ago by
Keywords: | needsdocs removed |
---|
comment:17 Changed 7 years ago by
Milestone: | 1.8 → 1.7.6 |
---|
For #2, it’s possible to create asynchronous tests and use an inner require along with a plugin like this to load the modules from the correct context (assuming the page being tested uses async mode):
and then in the test itself: