-
Notifications
You must be signed in to change notification settings - Fork 61
Use the browser-perf node module, and define custom actions.
You can use something like the following for scrolling a custom element. Define this in the actions key.
actions : [browserperf.actions.scroll({
scrollElement: 'document.getElementsByClassName("myclass")[0]'
})]
A full example can be found as a gist.
You can use the preScript
option to log in and ensure that a cookie is set. When running the test, the cookie will still be used and you will be able to test the page as a logged in user. For example, with the node API, pass the following to the preScript
option.
... // other config options for browser-perf
preScript: browserPerf.actions.login({
username: {
field: 'CSS_for_Username_textbox_in_form',
value: 'Username_to_be_typed'
},
password: {
field: 'CSS_for_Password_textbox_in_form',
value: 'password_to_be_typed'
},
submit:{
field: 'Submit_Button_CSS_Selector_In_Form'
}
})
Perfjankie is a module built on top of browser-perf that saves the results and HTML to display graphs in a CouchDB database. We use it for generating graphs like this.
The steps to debug the issue would be
- Is selenium running?
- Can you open a browser using selenium? You can use the wd module directly to see if selenium works.
- Run browser-perf with a
debug
flag andverbose
flags. This will leave the browser windows open after the tests and give you extensive logging. - Contact us if you still encounter issues.
Browser-perf uses the debug module for debug logging. To get a stack trace, set the environment variable DEBUG
to *
using export DEBUG=*
(Mac/Linux) or set DEBUG=*
(Windows). If you then run browser-perf, you would get logs that would be helpful in debugging the actual issue.
Here are some tips to ensure that the tests you run result in consistent results
- Ensure that only one user scenario is run. For example, a simple page scroll will result in more consistent results than a test that runs scrolls on multiple pages, loading one page after another.
- Ensure that you disable all metrics that you may not be interested in. For example, when using the Node API to record only rendering metrics and ignore network metrics, use
metrics: ['ChromeTracingMetrics', 'TimelineMetrics']
in the options object ofbrowser-perf
. This basically prevents any network related scripts from running and skewing the results. - Note that browsers also have a lot of optimizations in the background and this could also result in a slight skew in the metrics. It is recommended to run the test multiple times and compare the results with previous runs.