jparry
jparry

Reputation: 317

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?

Upvotes: 14

Views: 24630

Answers (3)

dragos
dragos

Reputation: 21

Try to make your suite composed by multiple files. I Have a line for the test I currently work on and another with the entire suite of tests:

exports.config = {
     allScriptsTimeout: 11000,
     specs: [
       './e2e/**/1.Landing.Page.ts',
       './e2e/**/2.Confirmation.Page.ts', 
       './e2e/**/3.PersonalData.Page.ts',
       './e2e/**/4.sms.Page.ts',
       './e2e/**/5.idCard.Page.ts'
     ],
}

This works for me.

Upvotes: 0

Sameera De Silva
Sameera De Silva

Reputation: 1980

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

Upvotes: 1

alecxe
alecxe

Reputation: 473803

Don't put spaces after commas:

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

Upvotes: 19

Related Questions