2

I currently have Protractor set up to run multiple Chrome instances so that I can run my tests in parallel. However, I've noticed that the tests in one browser instance are influencing tests in another browser instance. For example, if I have one test that opens a drop-down menu, I see the drop-down menu open in the other browser instances, even though that has nothing to do with the other tests. Why would this occur? Can someone provide assistance for how I can run tests in parallel in isolation?

conf:

 'use strict';

exports.config = {
  baseUrl: 'http://localhost:8080/',

  specs: [
    './tests/**/*.spec.js'
  ],

  exclude: [],

  suites: {
    testsA: './tests/tests-a/*.spec.js',
    testsB: './tests/testsB/*.spec.js',
    testsC: './tests/testsC/*.spec.js'
  },

  framework: 'jasmine2',

  allScriptsTimeout: 110000,

  jasmineNodeOpts: {
    showTiming: true,
    showColors: true,
    isVerbose: false,
    includeStackTrace: false,
    defaultTimeoutInterval: 400000
  },

  directConnect: true,

  capabilities: {
    browserName: 'chrome',
    shardTestFiles: 'true',
    maxInstances: 5
  },

  onPrepare: function () {
    let SpecReporter = require('jasmine-spec-reporter');
    // add jasmine spec reporter
    jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));

    browser.ignoreSynchronization = false;
    require('babel-core/register')({ 'presets': [ 'es2015' ] });
  },

  /**
   * Angular 2 configuration
   *
   * useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
   * `rootEl`
   *
   */
  useAllAngular2AppRoots: true
};

2 Answers 2

2

This turned out to be a problem with the Browsersync settings in webpack config, not with browser instances. Setting ghostMode:false in the Browsersync settings section of the webpack config solved the problem

1

This has to do with how your app is written. In an ideal situation this should not happen because each browser instance is a separate session. This could be solved by using Selenium grid and running each browser on different VM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.