Real phones on BrowserStack
This page is for teams that want results from real phones on BrowserStack, iOS or Android. During the pilot, the KeepSnappy team sets up BrowserStack runs with you. Ask the person who invited you.
What you need
- A BrowserStack account.
- Maestro flows or an Appium suite. The BrowserStack package of e2e (e2e.com) doesn’t work with KeepSnappy yet (e2e).
- A measuring build with the SDK key and the API address in it. On BrowserStack the app sends its own measurements (The build switch).
- Two KeepSnappy keys: the CI key in your CI job, and the SDK key in the build (Keys).
How it runs
A BrowserStack session uses the farm command instead of keepsnappy run, because the keepsnappy command never touches the phone itself:
farm openstarts a KeepSnappy session and writes a token for each run into a file that your flows read.- Your test tool runs your journeys on BrowserStack’s phones. Before each run, the app is switched on with its token through the activation link, and then it sends its measurements to KeepSnappy itself.
farm closewaits until the measurements stop arriving, then closes the session. With--wait, it also waits for the result and prints it.
The run subcommand of farm does all three in one command. Every flag is in the CLI reference.
An example workflow ships in the @keepsnappy/agent package, at examples/farm/workflows/keepsnappy-measure.yml. Its KEEPSNAPPY_CLI is @keepsnappy/agent, the latest release. A copy from an older CLI names a version there: change it to @keepsnappy/agent before you run it.
Check a WebdriverIO suite before measuring
- Use the same orientation for the baseline and pull request. For a portrait journey, set
deviceOrientationtoportraitunderbstack:optionsand check that the first screen has the expected layout. - Run a short smoke test on each device and OS version you plan to measure. Inspect
browser.getPageSource()on the first screen and confirm that it contains the elements your selectors need. On Android, a view may be visible on screen while Appium’s accessibility tree omits its children. The smoke test should stop there if the first selector cannot work. - Exercise any app activation, deep links and gestures your suite uses. BrowserStack’s Appium server and drivers can differ from your local versions. If a command is unavailable, choose a supported server with
appiumVersionunderbstack:options, or use a command supported by the farm. Run the smoke test again with the same capabilities you will measure with. BrowserStack capabilities - If the BrowserStack service writes
log/orlogs/under your suite, ignore those directories in Git. For a.gitignorein the suite directory, add/log/and/logs/. The logs can contain session credentials.
Time and cost
A session on BrowserStack uses BrowserStack minutes as well as your CI minutes (Time and cost). BrowserStack keeps the phone reserved after a run fails, so a session with a failed run takes longer and uses more BrowserStack minutes.
If a session ends with no data, see Troubleshooting.