Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Acceptance testing/Browsers: Difference between revisions

From MoodleDocs
(Created page with "== Drivers == There are Selenium drivers (http://docs.seleniumhq.org/projects/webdriver/) to run acceptance tests in different browsers: * Firefox - https://code.google.com/...")
 
No edit summary
Line 1: Line 1:
This page complements [[Acceptance testing]] providing info about how to run the acceptance tests suite in different browsers.
== Drivers ==
== Drivers ==


Line 8: Line 10:
* Internet Explorer - https://code.google.com/p/selenium/wiki/InternetExplorerDriver
* Internet Explorer - https://code.google.com/p/selenium/wiki/InternetExplorerDriver
* PhantomJS (Webkit) - http://phantomjs.org/release-1.8.html
* PhantomJS (Webkit) - http://phantomjs.org/release-1.8.html
* Android - https://code.google.com/p/selenium/wiki/AndroidDriver
* IPhone - https://code.google.com/p/selenium/wiki/IPhoneDriver
* IPhone - https://code.google.com/p/selenium/wiki/IPhoneDriver


Each driver should be downloaded and Selenium .jar should be started specifying the path to the driver; depending on the driver there could be other requirements.  
Each driver should be downloaded and Selenium .jar should be started specifying the path to the driver; depending on the driver there could be other requirements.  
=== PhantomJS ===
PhantomJS is different as it is a headless browser as it is quite faster than other drivers, it doesn't need a GUI to run and can execute JS, it doesn't even need to be used through Selenium (you can do it though) and you can do it
* Download PhantomJS: http://phantomjs.org/download.html
* /path/to/your/phantomjs/bin/phantomjs --webdriver=4444
Note that 4444 is the default port used by Selenium so you must specify another one if you want to run them together and specify the port in $CFG->behat_config.


=== Examples ===
=== Examples ===


   # Linux (firefox by default + chrome)
   # Selenium in Linux (firefox by default + chrome)
   java -jar /opt/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/opt/chromedriver
   java -jar /opt/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/opt/chromedriver


   # OSx (firefox & safari by default + chrome)
   # Selenium in OSx (firefox & safari by default + chrome)
   java -jar /Users/moodle/Downloads/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/Users/moodle/Downloads/chromedriver
   java -jar /Users/moodle/Downloads/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/Users/moodle/Downloads/chromedriver


   # Windows (started using git bash) (firefox by default + chrome + internet explorer)
   # Selenium in Windows (started using git bash) (firefox by default + chrome + internet explorer)
   java -jar /c/seleniumdrivers/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/c/seleniumdrivers/chromedriver.exe -Dwebdriver.ie.driver=/c/seleniumdrivers/IEDriverServer.exe
   java -jar /c/seleniumdrivers/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/c/seleniumdrivers/chromedriver.exe -Dwebdriver.ie.driver=/c/seleniumdrivers/IEDriverServer.exe


== Compatibility ==
  # PhantomJS
  /path/to/your/phantomjs/bin/phantomjs --webdriver=4444


Not all the drivers can execute all of Moodle's step definitions; we tagged the step definitions that are using feature not supported by all browsers or that should be considered:
Not all the drivers can execute all of Moodle's step definitions; we tagged the step definitions that are using feature not supported by all browsers or that should be considered:
Line 31: Line 42:
|
|
|File uploads (@_upload)
|File uploads (@_upload)
|Browser dialogs (@_alerts)
|Switch window (@_switch_window)
|Switch window (@_switch_window)
|Switch frame (@_switch_iframe)
|Switch frame (@_switch_iframe)
|-
|-
|Firefox
|Firefox
|Yes
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:#0f0">Yes</span>
|<span style="color:#0f0">Yes</span>
|-
|-
|Chrome
|Chrome
|Yes
|<span style="color:#0f0">Yes</span>
|No
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:red">No</span>
|<span style="color:#0f0">Yes</span>
|-
|-
|Internet Explorer
|Internet Explorer
|Yes
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:red">No</span>
|<span style="color:#0f0">Yes</span>
|-
|-
|Safari
|Safari
|Yes
|<span style="color:#0f0">Yes</span>
|No
|<span style="color:red">No</span>
|Yes
|<span style="color:red">No</span>
|<span style="color:#0f0">Yes</span>
|-
|-
|PhantomJS
|PhantomJS
|No
|<span style="color:red">No</span>
|No
|<span style="color:#0f0">Yes</span>
|Yes
|<span style="color:red">No</span>
|<span style="color:#0f0">Yes</span>
|}
|}

Revision as of 10:38, 9 January 2014

This page complements Acceptance testing providing info about how to run the acceptance tests suite in different browsers.

Drivers

There are Selenium drivers (http://docs.seleniumhq.org/projects/webdriver/) to run acceptance tests in different browsers:

Each driver should be downloaded and Selenium .jar should be started specifying the path to the driver; depending on the driver there could be other requirements.

PhantomJS

PhantomJS is different as it is a headless browser as it is quite faster than other drivers, it doesn't need a GUI to run and can execute JS, it doesn't even need to be used through Selenium (you can do it though) and you can do it

Note that 4444 is the default port used by Selenium so you must specify another one if you want to run them together and specify the port in $CFG->behat_config.

Examples

 # Selenium in Linux (firefox by default + chrome)
 java -jar /opt/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/opt/chromedriver
 # Selenium in OSx (firefox & safari by default + chrome)
 java -jar /Users/moodle/Downloads/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/Users/moodle/Downloads/chromedriver
 # Selenium in Windows (started using git bash) (firefox by default + chrome + internet explorer)
 java -jar /c/seleniumdrivers/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/c/seleniumdrivers/chromedriver.exe -Dwebdriver.ie.driver=/c/seleniumdrivers/IEDriverServer.exe
 # PhantomJS
 /path/to/your/phantomjs/bin/phantomjs --webdriver=4444

Not all the drivers can execute all of Moodle's step definitions; we tagged the step definitions that are using feature not supported by all browsers or that should be considered:

File uploads (@_upload) Browser dialogs (@_alerts) Switch window (@_switch_window) Switch frame (@_switch_iframe)
Firefox Yes Yes Yes Yes
Chrome Yes Yes No Yes
Internet Explorer Yes Yes No Yes
Safari Yes No No Yes
PhantomJS No Yes No Yes