jagdeepjain / sfapi

Automatically exported from code.google.com/p/sfapi
0 stars 0 forks source link

SeleniumFlexAPI cannot be initialized from a module, without additional custom work #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When the SeleniumFlexAPI is referenced from a module, instead of an 
application, the SeleniumFlexAPI is not initialized properly. 

Details:
The init method is passed an instance of IFlexModuleFactory, instead of an 
application, so the sysroot properly gets set incorrectly. Additionally, the 
creationComplete listener applied in the SeleniumFlexAPI will never be 
triggered, since the creationComplete event has always finished by the time 
modules are initialized. 

What is the expected output? What do you see instead?
This is a change request, not a bug. I think it would be valuable if 
SeleniumFlexAPI were able to be initialized from a module in addition to being 
initialized from an application. It would be simple to do: detect the type of 
the app object passed into the init method, and use 
FlexGlobals.topLevelApplication as the system root when the object is an 
instance of IFlexModuleFactory. Additionally, don't listen for the 
creationComplete event (that has been completed by the time modules are 
initialized) - simply perform all the initialization steps immediately.

What version of the product are you using? On what operating system?
I'm using version 0.2.6, or revision 5 in your repository. This issue applies 
to all operating systems.  

Please provide any additional information below.
I'm attaching source that I am using to initialize the SeleniumFlexAPI from a 
module.  It's a singleton modeled on the SeleniumFlexAPI class. This allows me 
to avoid compiling the selenium flex libraries into my main application. There 
are two benefits to this: I can use your API to test commercial software, and 
my main application swf is smaller. I recommend that in your documentation you 
make it a best practice to use this API from a module rather than compiling the 
classes into the main application swf.  

My change request: modify the SeleniumFlexAPI class to check whether an 
application or a module is being passed into the init method. Initialize the 
API correctly either way. 

Thanks for your work on this project - it's been great!
Christina

Original issue reported on code.google.com by Christin...@gmail.com on 1 Sep 2010 at 9:12

Attachments: