You are here

SELENIUM.txt in BOTCHA Spam Prevention 7.3

SELENIUM TESTS HOWTO

ATTENTION! 
DO NOT RUN ANY OF SELENIUM (OR SimpleTest) TESTS ON PRODUCTION SITE.
There are scenarios when the whole production database can be wiped out if something fails in the code.
Take some time to setup a developer site. It is worth the peace of mind.

COMMON
- Download Selenium Server Standalone jar from http://seleniumhq.org/download/
- There are other pointers for below downloads on that page


SETUP DRUPAL
- Download http://drupal.org/project/selenium module to your Drupal installation and enable it
- Patch Drupal core "patch -p1 < "path to selenium module"/selenium/D7-core-selenium.patch"

SETUP SELENIUM SERVER SIDE (HUB)
- Install java on the server
- Copy Selenium Server Standalone jar to the server
- Run selenium server as a hub, e.g.
  java -jar selenium-server-standalone-2.28.0.jar -role hub -port 4444
- Open port 4444 tunnel on the router between server and the internet (if there is one)
- Visit the hub console at http://<server>:4444/grid/console
  Where <server> is name or IP of the server



SETUP SELENIUM CLIENT SIDE (NODE)
- Download WebDriver for Chrome (chromedriver), install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the chromedriver)
  chrome.exe (or chrome executable) should be also on the $PATH/%PATH%
  exit Chrome, cd "C:\Users\"%USERNAME%"\AppData\Local\Google\Chrome\" or to where the chrome.exe is,
  edit file "master_preferences", find and set "require_eula": false
- Download WebDriver for IE, install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the driver)
  iexplorer.exe (or IE executable) should be also on the $PATH/%PATH%
- Download WebDriver for Opera, install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the driver)
  opera.exe (or Opera executable) should be also on the $PATH/%PATH%
- Install java on the client
- Copy Selenium Server Standalone jar to the client
- Run selenium server as a node, e.g.
  java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://<server>:4444/grid/register > selenium.log 2>&1
  Where <server> is name or IP of the server
  For Opera (by default Opera is not connected, need adjust settings):
  java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://<server>:4444/grid/register \
    -browser browserName=firefox,maxInstances=5 \
    -browser browserName=chrome,maxInstances=5 \
    -browser "browserName=internet explorer,maxInstances=3" \
    -browser browserName=opera \
    > selenium.log 2>&1
e.g.
  java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://10.0.0.5:4444/grid/register -browser browserName=firefox -browser browserName=chrome -browser "browserName=internet explorer" -browser browserName=opera > selenium.log 2>&1
or
  java -jar selenium-server-standalone-2.28.0.jar -role node -nodeConfig SeleniumClientNode.json > selenium.log 2>&1
- Visit the hub console at http://<server>:4444/grid/console and inspect if node is talking to the hub


RUN TESTS:
- Open any browser of choice to run the tests. The tests initiate commands to the client browser via 
  the Selenium Server Standalone HUB to the Selenium Server Standalone NODE.
  Selenium Server Standalone NODE opens each test's target browser on the client using WebDriver and
  passes commands from the test to the target browser.
- Navigate to admin/config/development/testing
- Select needed tests and hit Run

File

tests/SELENIUM.txt
View source
  1. SELENIUM TESTS HOWTO
  2. ATTENTION!
  3. DO NOT RUN ANY OF SELENIUM (OR SimpleTest) TESTS ON PRODUCTION SITE.
  4. There are scenarios when the whole production database can be wiped out if something fails in the code.
  5. Take some time to setup a developer site. It is worth the peace of mind.
  6. COMMON
  7. - Download Selenium Server Standalone jar from http://seleniumhq.org/download/
  8. - There are other pointers for below downloads on that page
  9. SETUP DRUPAL
  10. - Download http://drupal.org/project/selenium module to your Drupal installation and enable it
  11. - Patch Drupal core "patch -p1 < "path to selenium module"/selenium/D7-core-selenium.patch"
  12. SETUP SELENIUM SERVER SIDE (HUB)
  13. - Install java on the server
  14. - Copy Selenium Server Standalone jar to the server
  15. - Run selenium server as a hub, e.g.
  16. java -jar selenium-server-standalone-2.28.0.jar -role hub -port 4444
  17. - Open port 4444 tunnel on the router between server and the internet (if there is one)
  18. - Visit the hub console at http://:4444/grid/console
  19. Where is name or IP of the server
  20. SETUP SELENIUM CLIENT SIDE (NODE)
  21. - Download WebDriver for Chrome (chromedriver), install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the chromedriver)
  22. chrome.exe (or chrome executable) should be also on the $PATH/%PATH%
  23. exit Chrome, cd "C:\Users\"%USERNAME%"\AppData\Local\Google\Chrome\" or to where the chrome.exe is,
  24. edit file "master_preferences", find and set "require_eula": false
  25. - Download WebDriver for IE, install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the driver)
  26. iexplorer.exe (or IE executable) should be also on the $PATH/%PATH%
  27. - Download WebDriver for Opera, install in $PATH/%PATH% (or add to $PATH/%PATH% ENV to point to the driver)
  28. opera.exe (or Opera executable) should be also on the $PATH/%PATH%
  29. - Install java on the client
  30. - Copy Selenium Server Standalone jar to the client
  31. - Run selenium server as a node, e.g.
  32. java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://:4444/grid/register > selenium.log 2>&1
  33. Where is name or IP of the server
  34. For Opera (by default Opera is not connected, need adjust settings):
  35. java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://:4444/grid/register \
  36. -browser browserName=firefox,maxInstances=5 \
  37. -browser browserName=chrome,maxInstances=5 \
  38. -browser "browserName=internet explorer,maxInstances=3" \
  39. -browser browserName=opera \
  40. > selenium.log 2>&1
  41. e.g.
  42. java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://10.0.0.5:4444/grid/register -browser browserName=firefox -browser browserName=chrome -browser "browserName=internet explorer" -browser browserName=opera > selenium.log 2>&1
  43. or
  44. java -jar selenium-server-standalone-2.28.0.jar -role node -nodeConfig SeleniumClientNode.json > selenium.log 2>&1
  45. - Visit the hub console at http://:4444/grid/console and inspect if node is talking to the hub
  46. RUN TESTS:
  47. - Open any browser of choice to run the tests. The tests initiate commands to the client browser via
  48. the Selenium Server Standalone HUB to the Selenium Server Standalone NODE.
  49. Selenium Server Standalone NODE opens each test's target browser on the client using WebDriver and
  50. passes commands from the test to the target browser.
  51. - Navigate to admin/config/development/testing
  52. - Select needed tests and hit Run