Advanced Topics

jfry edited this page Sep 13, 2010 · 6 revisions

I moved my firefox install to a different location

In your Preferences File you need to specify the place where we can find your binary, and the place where we can find the profile you would like to base your new profiles off of.

MOZILLA_BINARY='path/to/firefox.exe'
MOZILLA_DEFAULT_PROFILE='path/to/firefox/profiles'

Launching firefox with your own profile

First you need to copy the profile windmill creates, this has all the options set that windmill needs to run reliably.

From the windmill shell, launch firefox, then run the following;

windmill.settings['MOZILLA_PROFILE']

While windmill and firefox are still up, copy this profile to a new location.

Quit windmill.

Now you need to edit your local windmill prefs.py, on Mac this should be in ~/Library/Application Support/windmill/prefs.py

On PC this should be in C:\Documents and Settings\USERNAME\Application Data\windmill\prefs.py

MOZILLA_CREATE_NEW_PROFILE = False
MOZILLA_DEFAULT_PROFILE = '~/place/you/put/your/profile'

From now on, windmill will always launch that profile, and any plugins you install will be available the next time around.

Extensions

Every application has unique pieces, and we found that we wanted to add lots of functionality to windmill specifically for our application. As a result of this we are assuming that some of you would probably like to do the same.

Creating any new extension will be similar to the one I walk you through below, this one happens to be a mach assertion you might be wanting for you application.

The quick and dirty way to do this is by adding your functionality to the (extensions/extensions.js) file.

The second way is to create your own extensions folder somewhere on the file system and organize your extensions into .js files in this directory. You can then load them into the IDE using the shell command, load_extensions_dir(‘path/to/extensions/dir’) and every extension in the directory will be loaded into the Windmill IDE. This makes it easy to check your extensions specific to your app into a source repository and be automatically loaded before you run your tests in the setup method for the __init__.py in the root of your test directory.

You can also pass the path to your extensions to windmill when you start the server, and as soon as the IDE is available the extensions will be loaded, ex:
windmill shell firefox extensions=/path/to/ext tests=/path/to/tests http://www.example.com

An example of an assertion called assertSomething:

//Please give a brief description of the assertion
 //The paramObject is passed to every controller function
    windmill.controller.extensions.assertSomething = function (paramObject) { 

    //You usually need to look up a UI element, this will use any provided locator
    //And return you an element 
     var element = lookupNode(paramObject);

     //--Your application Logic should probably go here--
     alert(paramObject.option);
   };

  windmill.registry.methods['extensions.assertSomething']  = {'locator': true, 'option':'option' };

If you would like to use another option other than validator to pass data to your assertion you can add it with:

windmill.registry.option.push("my_new_option");

Now give it a try by either building your assertion in the IDE.

wxWindmill

This tool is a contrib application allowing you to control the Windmill Service with a graphical user interface. Currently the only way to get your hands on wxWindmill is by Installing from source. In the near future we plan to have this be the launched application for the Windmill binaries.

Install

  • Installing from source
  • Install wxPython (Windows doesn’t require sudo)
    sudo easy_install wxPython
  • Install wxWindmill
    cd windmill/trunk/contrib/wxwindmill python setup.py develop

Run wxWindmill

wxwindmill

  • Note: If you have problems with easy_install wxPython you can get the binary at wxpython.org