Automated testing tips and tricks

  • TODO:
    • check example code in to the tree somewhere
  • How to quit the browser on all platforms
  • How to create a new profile from the command line
    • First, use the -CreateProfile command line flag to add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file
      • firefox-bin -CreateProfile "testprofile ${PROFILE_DIR}/testprofile"
    • Next, start firefox to populate the new profile directory with the rest of the default settings
      • firefox-bin -P testprofile -chrome chrome://tests/content/quit.xul<code>
      • the above process may exit before the profile is completely created. In test scripts, <code>sleep 5 after the above command should ensure the profile is created before the next command in the test script is run
  • How to enable dump in a new profile
    • add user_pref("browser.dom.window.dump.enabled", true); to profiledir/user.js
  • How to execute test code with chrome privileges
  • How to detect content onload event from chrome
    • use the DOMContentLoaded event
      • chromeWindow.addEventListener('DOMContentLoaded',callbackFunction,false);