Browser Stack

Browser Stack is a cloud provider. It requires a monthly or yearly subscription, but offers free plans for open source projects.

Start by signing up for an account at browserstack.com, then set the following environment variables:

BROWSER_STACK_USERNAME
Your browser stack username.
BROWSER_STACK_ACCESS_KEY
Your browser statck access key.

To do this locally, you can create a .env file in your project's root directory:

BROWSER_STACK_USERNAME={your browser stack username}
BROWSER_STACK_ACCESS_KEY={your browser stack access key}

Then you can test using code like:

import assert from 'assert';
import cabbie from 'cabbie-async';

async function runTest() {
  // connect to browserstack, adding {debug: true} makes cabbie log each method call.
  const driver = cabbie('browserstack', {debug: true});

  try {
    await driver.activeWindow.navigateTo('http://example.com');

    const heading = await driver.activeWindow.getElement('h1');
    assert.equal(
      await heading.getText(),
      'Example Domain',
    );
  } finally {
    await driver.dispose();
  }
}

runTest().catch(ex => {
  console.error(ex.stack);
  process.exit(1);
});