0

In Intern framework, when I specify multiple tests using functionalSuites config field and run tests using BrowserStack tunnel, only one session is created in BrowserStack (everything is treated as a single test). As a result we have a few issues:

  • It's practically impossible to use BrowserStack for debugging for a large amount of tests. There is no navigation, you have to scroll over a huge log.
  • Tests are not fully isolated. For example, localStorage is shared between all tests.

The question: how to force Intern framework to create a new session for every single test? It seems like it's impossible at the moment after looking at the codebase.

PS: I would assume that this behaviour is applied to other tunnels as well.

sap1ens
  • 2,877
  • 1
  • 27
  • 30

1 Answers1

3

Use the following Gist

intern-parallel.js

Just put this file alongside intern.js and replace "intern!object" in your functional test files with "tests/intern-parallel"

Example functional test

define([
  //'intern!object',
  'tests/intern-parallel',
  'intern/chai!assert',
  'require'
], function (registerSuite, assert, require, registry) {
  registerSuite({
    name: 'automate first test',

    'google search': function () {
      return this.remote
        .get(require.toUrl('https://www.google.com'))
        .findByName("q")
          .type("Browserstack\n")
          .end()
        .sleep(5000)
        .takeScreenshot();
    }
  });
});
Vibhaj
  • 189
  • 6
  • Unfortunately it didn't help. Still only one session is created – sap1ens Nov 17 '15 at 18:29
  • Please check if the instructions were followed correctly. Replace 'intern!object' with 'tests/intern-parallel' in ALL your functionalSuites. – Vibhaj Nov 19 '15 at 06:25
  • Your solution doesn't work for our code structure. Instead of a "google search" function we have an object that includes "afterEach", "beforeEach", as well as a test method itself. Example: https://gist.github.com/sap1ens/1a2baaa7445c3a2a6347 – sap1ens Nov 19 '15 at 18:38
  • Also, it seems like you can't see real test name in Browserstack. You can either override name for all tests in "capabilities" config or fallback to a session id as a name. – sap1ens Nov 19 '15 at 18:39
  • 1
    Updated the gist to support your kind of code structure. Please try now. Also tried to work out the session name from your test suite, except first test which takes name from capabilities config. – Vibhaj Nov 19 '15 at 20:22
  • Now I have a lot of weird issues with timeouts and browser startups. I don't think that this patching will be stable, to be honest. Thanks for your help anyway! – sap1ens Nov 19 '15 at 21:08