-
Notifications
You must be signed in to change notification settings - Fork 61
Setup Instructions
This page describes the various steps to get started with browser-perf. You can use browser-perf to test the following categories of browsers
- Desktop browsers (Chrome, Safari, Firefox, IE) on your local machine ➤
- Mobile browsers on device or emulator ➤
- Cordova/Hybrid/WebView apps on emulator and real devices ➤
- Desktop browsers (Chrome, Safari, Firefox, IE) hosted on the cloud ➤
Though tests are run using the command line, the Node API can also be used to run the tests.
.
The examples below record metrics when the page is scrolled. Other actions can also used when recording metrics and can be specified like this.
For testing any local browser, a selenium server is needed. Look at this section for more information about installing and running Selenium.
ChromeDriver needs to be downloaded from here. You can either start Chromedriver with selenium using java -jar selenium-server-standalone-2.40.0.jar -Dwebdriver.chrome.driver=chromedriver.exe
or directly by opening the executable . Note that when started directly, the port and path of selenium would be different and the configuration file needs to reflect this.
To run browser-perf on a website using the command line. Note that the --selenium and --browsers options are not required since they are the default values.
$ browser-perf --selenium=http://localhost:4444/wd/hub --browsers=chrome http://yourwebsite.com
When only chromedriver is started,
$ browser-perf --selenium=http://localhost:9515 --browsers=chrome http://yourwebsite.com
Like Chrome, it also needs Chromedriver and can be run in a similar way. The only difference is that it requires an additional configuration specifying where the canary executable resides. The best way to run this would be to specify the configuration in a file like this and then running
$ browser-perf --config-file=chrome_canary.config.json http://yourwebsite.com
Safari and Firefox do not need any additional installs, the drivers are a part of the standard selenium server. The browser have to be specified to run the tests.
$ browser-perf --selenium=http://localhost:4444/wd/hub --browsers=safari http://yourwebsite.com
$ browser-perf --selenium=http://localhost:4444/wd/hub --browsers=firefox http://yourwebsite.com
Internet Explorer requires the IE driver to be downloaded(look for IEDriver zip files) and installed.
- Chrome on Android can tested using ChromeDriver directly.
- Ensure that adb executable is in the path. Then run
$ browser-perf --selenium=http://localhost:9515 --browsers=android http://yourwebsite.com
Older versions of the Android browsers are not supported. Chrome on emulator not tested, only tested with real device.
- Selenium is not required for this. Instead, install Appium using
npm install -g appium
and follow its setup instructions. - Since additional configuration options are required, a config file may be used.
- Run
appium
and then browser-perf with the config file.
- ChromeDriver needs to be installed and started.
- Since additional configuration is required, a config file like this can be used.
- The app must already be installed on the device.
- The emulator must be started, or the device must be connected.
- Note that the
androidActivity
andandroidPackage
need to be changed according to your app. No browser is specified. - Run browser-perf with the config file.
- Install Appium using
npm install -g appium
and follow its setup instructions. - Note that the
bundleId
andapp
must be change.app
must point to an ipa or a zip file's absolute location. - Run
appium
and start browser-perf with a config file like this.
- Saucelabs and Browserstack provides hosted selenium. You would just need to connect to their servers. Note that if the site under test is not accessible over the internet, the tunnel module may need to be used.
- Set the
selenium
option for the command line or your node module toondemand.saucelabs.com
orhub.browserstack.com
. - Set the
username
andaccesskey
parameters to the corresponding user name and access key. This tool will automatically take care of adding the credentials either to the capabilities in case of browserstack or to the selenium url in case of saucelabs.
- Ensure that you have java installed
- Download Selenium Selenium Server (formerly the Selenium RC Server)
- Start the selenium server locally using
java -jar selenium-server-standalone-2.40.0.jar -Dwebdriver.chrome.driver=chromedriver.exe
. Don't forget to correct the filename of the jar and Chrome driver file - Wait till you see the logs that say Selenium has started. You can then start browser-perf tests.
Alternatively if you have brew, run brew install selenium-server-standalone
. You can run it with selenium-server
.