Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - describe is not defined

I am using protractor js for testing. When i try to run the test case using

protractor e2e/main/test.spec.js

My conf.js

// An example configuration file.
 exports.config = {
// The address of a running selenium server.
 seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.

baseUrl: 'http://localhost:4000',

capabilities: {
  'browserName': 'chrome',
  'chromeOptions': {
  args: ['--test-type']
  }
},

// Spec patterns are relative to the current working directly when
// protractor is called.
 specs: ['*_spec.js'],

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
 showColors: true,
 defaultTimeoutInterval: 30000
}
};

I got reference error

> D:\cronj\gxp\10-09-2014\e2e\main\test.spec.js:3
describe('Login page', function() {
^
ReferenceError: describe is not defined
    at Object.<anonymous> (D:\cronj\gxp\10-09-2014\e2e\main\test.spec.js:3:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at ConfigParser.addFileConfig (C:\Users\Cronj4\AppData\Roaming\npm\node_modu
les\protractor\lib\configParser.js:171:20)
    at Object.init (C:\Users\Cronj4\AppData\Roaming\npm\node_modules\protractor\
lib\launcher.js:30:18)
    at Object.<anonymous> (C:\Users\Cronj4\AppData\Roaming\npm\node_modules\prot
ractor\lib\cli.js:129:23)

Could any one help to run the test case using protractor?

like image 998
Anusha Nilapu Avatar asked Sep 10 '14 08:09

Anusha Nilapu


People also ask

Does Protractor require java?

But there is still no way, you can write Protractor tests using Java or Python as Protractor's core is built on Javascript(node. js) and is purely Javascript.

What is Node js in Protractor?

Node. js is package file we are using in protractor automation tool to run the angular. js based application.It contains selenium and other browser drivers to run our applications in different environments.


1 Answers

You should launch your config file instead of your spec file .

protractor protractor.config.js 

In the config file, the "specs" attribute is a glob pattern array that will inject your spec files within the test environment, with the correct definition for objets like "describe" or "it".

like image 87
Maxdow Avatar answered Oct 04 '22 18:10

Maxdow