diff --git a/utilities/testrunner/selenium/how-to-create-firefox-profile.txt b/utilities/testrunner/selenium/how-to-create-firefox-profile.txt new file mode 100644 index 000000000..0c5af1d1d --- /dev/null +++ b/utilities/testrunner/selenium/how-to-create-firefox-profile.txt @@ -0,0 +1,3 @@ +Here is an excellent description of how to create a Firefox profile for use when running Selenium tests. + +http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/ \ No newline at end of file diff --git a/utilities/testrunner/selenium/ide-extensions.js b/utilities/testrunner/selenium/ide-extensions.js new file mode 100644 index 000000000..1625e46e7 --- /dev/null +++ b/utilities/testrunner/selenium/ide-extensions.js @@ -0,0 +1,139 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +/* + ****************************************************************************** + * + * ide-extensions.js + * + * Vivo-specific modifications to ßSelenium IDE (1.0.4). + * + * As delivered, the HTML formatter writes comments as actual HTML comments, + * so they are invisible when the test file is viewed in a browser. + * + * These modifications will change the options in the HTML formatter, so: + * 1) When writing an HTML test file, comments are written as "comment" + * commands, where the text of the comment is the target of the command. + * 2) When reading an HTML test file, "comment" commands are parsed as + * comments, so they can be recognized by the IDE editor. Old-style + * comments will also be recognized, for compatibility. + * 3) When writing an HTML test file, a CSS stylesheet is embedded in the + * heading with styles for the test name and the comments. Class attributes + * are inserted in the test name cell and the comment text cell to apply + * these styles. + * + * Tests written using these mods must have access to "user-extensions.js" + * when running, either in the IDE or in Selenium RC. That file will define + * "comment" as a command that does nothing. + * + * To install these mods in Selenium IDE: + * 1) Start the IDE. + * 2) Go the "Options" menu and select "Options..." + * 3) Put the path to "user-extensions.js into the + * "Selenium core extensions" field. + * 4) Put the path to this file "ide-extensions.js" into the + * "Selenium IDE extensions" field. + * 5) Close the IDE and re-start it. + * + ****************************************************************************** + */ + +/* + * Locate the HTML format object. + */ +var formatCollection = window.editor.app.formats; +var htmlFormat = formatCollection.formats["0"]; + +/* + * Ask the HTML format object to load its formatter. The formatter is + * cached on the first load, so changes to the options will remain + * in effect. + */ +htmlFormat.getFormatter(); +var formatterOptions = htmlFormat.formatterCache.options; + +/* + * Modify the regular expression that loads commands: + * 1) The second column of the table must have a simple "" tag with no + * spaces or attributes (to distinguish from comments). + * 2) Correct some silly syntax in the expression. + */ +formatterOptions["commandLoadPattern"] = + "" + + "\\s*()?" + + "\\s*\\s*([\\w]*?)\\s*" + + "\\s*(.*?)" + + "\\s*(|(.*?))" + + "\\s*\\s*"; + +/* + * Modify the regular expression that loads comments: + * 1) It will load a "comment" command as a comment, not as a command. + * The target of the command is taken as the text of the comment. + * 2) It will still load old-style comments, for compatibility with + * older tests. + * This requires a change to the script that loads comments, to accept + * both kinds of comments. + */ +formatterOptions["commentLoadPattern"] = + "\\s*" + // tag + "comment\\s*" + // "comment" in column 1. + "]*>(.*?)\\s*" + // text of comment in column 2. + "\\s*.*?\\s*\\s*" + // ignore column 3. + "\\s*" + // tag + "|" + // -- OR -- + "\\s*"; // An HTML comment between table rows. +formatterOptions["commentLoadScript"] = + "comment.comment = result[1] || result[2];\n", + +/* + * Modify the template for writing an HTML test file: + * 1) A stylesheet is embedded, for "testName" and "comment" classes. + * 2) The name of the test (first row) uses the "testName" class. + */ +formatterOptions["testTemplate"] = + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + "${name}\n" + + '\n" + + "\n" + + "\n" + + '\n'+ + '\n' + + '\n' + + "\n" + + "${commands}\n" + + "
${name}
\n" + + "\n" + + "\n"; + +/* + * Modify the template for writing a comment to the HTML test file: + * 1) The comment is rendered as a "comment" command. + */ +formatterOptions["commentTemplate"] = + "\n" + + "\tcomment\n" + + '\t${comment.comment}\n' + + "\t\n" + + "\n"; diff --git a/utilities/testrunner/selenium/selenium-ide-1.0.5.xpi b/utilities/testrunner/selenium/selenium-ide-1.0.5.xpi new file mode 100644 index 000000000..490702278 Binary files /dev/null and b/utilities/testrunner/selenium/selenium-ide-1.0.5.xpi differ diff --git a/utilities/testrunner/selenium/selenium-server.jar b/utilities/testrunner/selenium/selenium-server.jar new file mode 100644 index 000000000..004d7daca Binary files /dev/null and b/utilities/testrunner/selenium/selenium-server.jar differ diff --git a/utilities/testrunner/selenium/user-extensions.js b/utilities/testrunner/selenium/user-extensions.js new file mode 100644 index 000000000..71806c529 --- /dev/null +++ b/utilities/testrunner/selenium/user-extensions.js @@ -0,0 +1,48 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +/* + ****************************************************************************** + * + * user-extensions.js + * + * Vivo-specific modifications to Selenium IDE (1.0.4) and Selenium RC (1.0.2) + * + * The file "ide-extensions.js" will modify Selenium IDE so comments are + * written as "comment" commands. This makes them visible when the HTML test + * file is viewed in a browser. + * + * This file creates a "comment" command (that does nothing) so the Selenium + * engine will not throw an error when running those HTML test files. + * + * To install these mods in Selenium IDE: + * 1) Start the IDE. + * 2) Go the "Options" menu and select "Options..." + * 3) Put the path to "user-extensions.js into the + * "Selenium core extensions" field. + * 4) Put the path to this file "ide-extensions.js" into the + * "Selenium IDE extensions" field. + * 5) Close the IDE and re-start it. + * + * To run Selenium RC with these mods: + * 1) Add the "-userExtensions [file]" option to the command line, with [file] + * containing the path to "user-extension.js". + * + * For example: (this should be a single line) + * java -jar "C:\Vitro_stuff\Selenium\sauceRC-selenium-server.jar" + * -singleWindow + * -htmlSuite + * "*firefox" + * [URL of Vivo site] + * [path to test suite] + * [path to output file] + * -firefoxProfileTemplate [path to filefox profile] + * -timeout 600 + * -userExtensions [path to user-extensions.js] + * + ****************************************************************************** + */ + +/* + * Create "comment" as a command that does nothing. + */ +Selenium.prototype.doComment = function(){};