Aswini
Aswini

Reputation: 3

Unable to run specific spec file using protractor

I am trying to organize the "test files" into folders and run a specific spec file using protractor . For that i created below files.

heroes_spec.js file contains below code

var HeroesHomePage = require('C:\Users\agudla\Desktop\VSCodeWorkSpace\my-app\e2e\Heroes\heros_po.js');

describe('Heroes page tests' , function(){
    var heroespage = new HeroesHomePage();
    heroespage.heroesLinkClickEvent();
    browser.driver.sleep(3000);
});

hero_po.js file contains below code

var heroesLinkClickEvent;

var hero_page = function() {
    this.heroesLinkClickEvent= function(){
    element(by.linkText('Heroes')).click();
  }
};
hero_po.js is as below
module.exports = hero_page;

My protractor.conf.js file code is below

exports.config = {
  allScriptsTimeout: 11000,
   suites: {
    heroespage : 'C:\Users\agudla\Desktop\VSCodeWorkSpace\my-app\e2e\Heroes\heroes_spec.js'
  },
  capabilities: 
   { 
     'browserName': 'chrome',
     'seleniumAddress':'http://localhost:4444/wd/hub'
   },    
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    includeStackTrace: true
  },
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });    
  },
}

When i run protractor protractor.conf.js --suite heroespage command after starting "selenium server".

No specs found message is displaying. Can any one help me to solve this issue.

Upvotes: 0

Views: 1361

Answers (3)

faizal khan
faizal khan

Reputation: 105

This is the command passed:

protractor src/test/javascript/protractor.conf.js --specs src/test/javascript/e2e/entities\points\points.spec.t
s

which is protractor conf files and then command line parameters followed by value.

Upvotes: 0

Vishal Aggarwal
Vishal Aggarwal

Reputation: 4178

Give relative path to your project root folder.

 suites: {
    heroespage: ['e2e\Heroes\heroes_spec.js']
 }

Upvotes: 0

Ernst Zwingli
Ernst Zwingli

Reputation: 1422

Are you aware, that Javascript uses forward-slashes / for paths and not backslashes \?

With a backslash you basically just exit the next character.

So try either with / instead of \

heroespage : 'C:/Users/agudla/Desktop/VSCodeWorkSpace/my-app/e2e/Heroes/heroes_spec.js'

Do this in all your paths within Protractor.

That should do the trick.

Upvotes: 1

Related Questions