Common tests are excluded in suite configuration of protractor

103 Views Asked by At

I could see the common tests are excluded in a suite configuration of protractor. Below is my config.js and there are two scenarios configured in suites.

I'm expecting the test to complete the scenario1 successfully and then Login again as part of scenario2. But, I could see the test ignores 'Login.js', 'CustomerSelection.js', 'Create.js' of Scenario2 and directly proceeds with 'ProductSelection.js'.

Any idea why is that so ? Am I missing anything in conf.js to work the way the scenarios configured ?

Config.js:

exports.config = {
      seleniumAddress: 'http://localhost:4444/wd/hub',
      capabilities: {
      'browserName': 'chrome'
    },
    framework: 'jasmine' ,
    showColors: true,  
suites : {
  scenario1: [
        'Login.js',
        'CustomerSelection.js',
        'Create.js',
        'View.js',
    ],
  scenario2: [
        'Login.js',
        'CustomerSelection.js',
        'Create.js',
        'ProductSelection.js',
    ]
},

jasmineNodeOpts: {
    isVerbose: true,
    showColors: true,
    print: function () {
    },
    includeStackTrace: true,
    defaultTimeoutInterval: 700000
},

onPrepare: function() {
    browser.manage().window().maximize();
    browser.manage().timeouts().implicitlyWait(5000);
    }
};

Below are the versions I'm using:

protractor: Version 5.4.0

Jasmine: Version 3.2.0

Node: v8.11.1

NPM: Version 5.6.0

1

There are 1 best solutions below

3
On

If this tests are something that you run always before all. You can place them like this into View.js and ProductSelection.js as part of beforeAll, I'm placing login beforeAll (loginPage is page where my functions are placed, Login() is function in loginPage that logins in application if you send correct username and password to it) like this:

beforeAll(function() {
    loginPage.Login(username, password);        
});