0

I am using Codeceptjs for automation testing in javascript which internally uses WebDriverIO. I have achieved to run on Sauce, using the mentioned framework.

I have accomplished to run automation test cases in different browsers in sauce lab by using desired capabilities but only one browser at a time.

Requesting help

  1. to parallelize the all test files runs on a single browsers in sauce lab.
  2. to parallelize the test runs on multiple browsers in sauce lab.

It would be great to have both of the above mentioned combinations.

What configuration should I provide to achieve the above two requirement on the WebDriverIO / CodeceptJS.

Here is my configuration that will be passed to sauce labs.

---codecept.conf.js---

WebDriverIO: {
  url: "http://localhost:3000",
  browser: chrome,
  waitforTimeout: 60000,
  restart: false,
  logLevel: "silent",
  cssSelectorsEnabled: "true",
  timeouts: {
    script: 60000,
    "page load": 60000,
    implicit : 0
  },
  "host": "ondemand.saucelabs.com",
  "port":80,
  "user":"<SAUCE_USER_NAME>",
  "key": "<SAUCE_ACCESS_KEY>”,
  desiredCapabilities :{
    "chrome": {
      "browserName": "chrome",
      "name": "TEST_CHROME",
      "platform": "ANY",
      "version": "55.0"
    }
  }
}

These are the list of desired Capabilities which i am using and picking one capability based on the selected browser name:

{
  "internet explorer": {
    "browserName": "internet explorer",
    "name": "TEST_IE",
    "platform": "Windows 7",
    "ignoreZoomSetting": true,
    "nativeEvents": false,
    "ignoreProtectedModeSettings": true,
    "version": "11"
  },
  "chrome": {
    "browserName": "chrome",
    "name": "TEST_CHROME",
    "platform": "ANY",
    "version": "55.0"
  },
  "firefox": {
    "browserName": "firefox",
    "name": "TEST_FIREFOX",
    "platform": "ANY",
    "version": "51.0"
  },
  "safari": {
    "browserName": "safari",
    "name": "TEST_SAFARI",
    "platform": "OS X 10.11",
    "version": "10.0"
  },
  "opera": {
    "browserName": "opera",
    "name": "TEST_OPERA",
    "platform": "Windows 7",
    "version": "ANY"
  },
  "MicrosoftEdge": {
    "browserName": "MicrosoftEdge",
    "name": "TEST_IEEdge",
    "platform": "Windows 10",
    "version": "13"
  }
}
oligofren
  • 15,352
  • 12
  • 75
  • 134
pskushw
  • 1
  • 3

2 Answers2

1

I've never used CodeceptJS. However, as it uses Wdio, it could be possible to use maxInstances property to configure number of browers run in parallel.

Take a look at the Wdio documentation: http://webdriver.io/guide/testrunner/configurationfile.html

Andrii
  • 357
  • 2
  • 9
  • I tried everything here. However, I am not able to launch multiple browsers in parallel on my local machine. Just wanted to know whether WebdriverIO supports it? Running them on saucelabs or Browserstack is fine because they have their own Selenium grid implemented. How do we achieve this on local? – Shweta Sharma Mar 29 '19 at 17:26
0

Manual: parallel execution

Add to your codecept.conf.js:

"multiple": {
  "internet explorer": {
    "browsers": ["internet explorer"]
  },
  "chrome": {
    "browsers": ["chrome"]
  },
  "firefox": {
    "browsers": ["firefox"]
  },
  "safari": {
    "browsers": ["safari"]
  },
  "opera": {
    "browsers": ["opera"]
  },
  "MicrosoftEdge": {
    "browsers": ["MicrosoftEdge"]
  },
  "parallel": {
    // Splits tests into chunks
    // for example: 2 chunks x 6 browsers = 12 threads
    "chunks": 2,
    // run all tests in each browser:
    "browsers": ["internet explorer", "chrome", "firefox", "safari", "opera", "MicrosoftEdge"]
  }
}

multiple calling for selective browsers:

codeceptjs run-multiple chrome opera "internet explorer" firefox // create threads (four in all) for each browser: chrome, opera, internet explorer and firefox.

multiple calling for each browser in few chunks:

codeceptjs run-multiple parallel
fpsthirty
  • 175
  • 1
  • 2
  • 13