Skip to content

Instantly share code, notes, and snippets.

@jankcat
Last active January 18, 2017 21:04
Show Gist options
  • Save jankcat/2e5fa29fdf92443857097076191c5c66 to your computer and use it in GitHub Desktop.
Save jankcat/2e5fa29fdf92443857097076191c5c66 to your computer and use it in GitHub Desktop.
Example Mocha/BrowserStack-Local combo, that works now!
import assert from 'assert';
import test from 'selenium-webdriver/testing';
var browserstack = require('browserstack-local');
var local = new browserstack.Local();
let localOptions = {
'key': '...accessKeyHere...'
};
test.before(function(done) {
this.timeout(30000);
console.log('Starting BrowserStack-Local...');
local.start(localOptions, ()=>{
console.log("Started BrowserStack-Local.");
// ...Code here to start WebDriver...
done();
});
});
test.after(function() {
this.timeout(30000);
// ...Code here to stop WebDriver...
console.log('Stopping BrowserStack-Local...');
local.stop(()=>{
console.log("Stopped BrowserStack-Local");
});
});
test.describe('Example Test Suite 1', function() {
this.timeout(30000);
test.it('Example Test Case 1', function() {
// ...Test Case Code...
assert.equal(1,1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment