Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Run multiple protractor test suites at once?

First attempt at using Protractor. I would like to be able to run multiple suites in succession. I have an application that is one big angular form with different scenarios. I have expected results for each scenario and would like to enter one command and run through each test. I thought I could just use comma separated like:

protractor config.js --suite=rf1_breast, rf1_ovarian, rf1_pancreatic

But I am getting the error:

Error: more than one config file specified

Which is strange as there is only the one config file which is in the directory where I am running protractor.

Here is my config.js:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  capabilities: { 'browserName': 'chrome' },
  framework: 'jasmine2',
  suites: {
    rf1_breast: './rf1-ashkenazi-hboc/Breast/specs/*_spec.js',
    rf1_ovarian: './rf1-ashkenazi-hboc/Ovarian/specs/*_spec.js',
    rf1_bladder_fail: './rf1-ashkenazi-hboc/Bladder-expected-fail/specs/*_spec.js',
    rf1_pancreatic: './rf1-ashkenazi-hboc/Pancreatic/specs/*_spec.js',
    rf1_prostate: './rf1-ashkenazi-hboc/Prostate/specs/*_spec.js'
  },
  onPrepare: function() {
    /* global angular: false, browser: false, jasmine: false */
    browser.manage().window().setSize(1600, 1600);
    // Disable animations so e2e tests run more quickly
    var disableNgAnimate = function() {
      angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
        $animate.enabled(false);
      }]);
    };

    browser.addMockModule('disableNgAnimate', disableNgAnimate);
},
  jasmineNodeOpts: { showColors: true }
};

Is there a better way around getting each scenario run?

like image 837
jparry Avatar asked Aug 19 '15 15:08

jparry


People also ask

How do you run multiple suites on a protractor?

When you want to run protractor scripts by opening a browser instance for each test, you should add two capabilities shardTestFiles and maxInstances in the Capabilities block of the conf. js file. This will help to execute your scripts on same browser with multiple instances.

How the test suites can be grouped in protractor?

Test suites are usually divided according to system functionalities or the type of test performed.

How do you run test cases sequentially in a protractor?

You could specify a glob that will load files in alphabetical order, or pass a list that forces sequential execution in the order you specify. specs: [ 'test/stories/login. js', 'test/stories/home/overview.


2 Answers

Don't put spaces after commas:

protractor config.js --suite rf1_breast,rf1_ovarian,rf1_pancreatic
like image 54
alecxe Avatar answered Sep 26 '22 09:09

alecxe


In your config.js

If you want to run the script as a suite comment out the spec line

// specs: ['src/com/sam/scriptjs/alertexamplespec.js']

give the suite name and location

 suites: {
      //Suite name and location give * to run all the specs or provide the name 
        smoke: ['./smoke/*.spec.js'],
        endtoend: ['src/com/sam/scriptjs/*.spec.js'],
//Futhermore you can select few test specs
testfew: ['./smoke/editorder.spec.js','./smoke/cancelorder.spec.js']

},  

then in cmd type protractor filenameconfig.js

like image 38
Sameera De Silva Avatar answered Sep 25 '22 09:09

Sameera De Silva