abhishekswain / jasmine2-protractor-utils

Utilities for Protractor with jasmine2 [HTML Reports, Screenshot, Browser Console log]
MIT License
18 stars 31 forks source link

TypeError: Cannot read property 'forEach' of undefined #7

Open aslubsky opened 8 years ago

aslubsky commented 8 years ago

npm -v 2.15.1

node -v v4.4.3

protractor --version Version 3.2.2

npm install jasmine2-protractor-utils -g jasmine2-protractor-utils@1.2.6 /usr/lib/node_modules/jasmine2-protractor-utils

/usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:108 suites.forEach(function (suite, index) { ^ TypeError: Cannot read property 'forEach' of undefined at /usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:112:24 at Array.forEach (native) at [object Object].self.jasmineDone (/usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:108:16) at dispatch (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1966:28) at ReportDispatcher.jasmineDone (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1949:11) at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:758:18 at QueueRunner.clearStack (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:660:9) at QueueRunner.run (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1881:12) at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1898:16 at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1842:9

protractor config

exports.config = { seleniumAddress: 'http://localhost:24444/wd/hub', plugins: [{ package: 'jasmine2-protractor-utils', disableHTMLReport: false, disableScreenshot: false, screenshotPath:'/tmp/screenshots', screenshotOnExpectFailure:true, screenshotOnSpecFailure:true, clearFoldersBeforeTest: true, htmlReportDir: '/tmp/htmlReports', failTestOnErrorLog: { failTestOnErrorLogLevel: 900 } }], specs: [ 'tests/list-for-users.js' ], capabilities: { browserName: 'chrome' }, baseUrl: 'http://localhost:8080', useAllAngular2AppRoots: true, framework: 'jasmine2', jasmineNodeOpts: { isVerbose: true, showColors: true, includeStackTrace: true }, onPrepare: function () { var width = 1024; var height = 768; browser.driver.manage().window().setSize(width, height); return global.browser.getProcessedConfig().then(function (config) { }); } };

abhishekswain commented 8 years ago

Are your tests running ?

Please try with this: change '/tmp/screenshots' to './tmp/screenshots'

aslubsky commented 8 years ago

Same error. Without plugin:

protractor apps/news/e2e/e2e.conf.js Using the selenium server at http://localhost:24444/wd/hub [launcher] Running 1 instances of WebDriver Started ..... 5 specs, 0 failures Finished in 13.109 seconds [launcher] 0 instance(s) of WebDriver still running [launcher] chrome #01 passed

With enabled plugin:

protractor apps/news/e2e/e2e.conf.js Using the selenium server at http://localhost:24444/wd/hub [launcher] Running 1 instances of WebDriver Started F.... /usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:108 suites.forEach(function (suite, index) { ^ TypeError: Cannot read property 'forEach' of undefined at /usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:112:24 at Array.forEach (native) at [object Object].self.jasmineDone (/usr/lib/node_modules/jasmine2-protractor-utils/reporter/jasmine2_reporter.js:108:16) at dispatch (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1966:28) at ReportDispatcher.jasmineDone (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1949:11) at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:758:18 at QueueRunner.clearStack (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:660:9) at QueueRunner.run (/usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1881:12) at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1898:16 at /usr/lib/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1842:9 [launcher] Process exited with error code 1

cavemandaveman commented 8 years ago

Same issue with similar config. In addition, it creates the correct screenshotPath and htmlReportDir, however the htmlReportDir is empty.

ghost commented 8 years ago

Hello,

Same issue here. I did some debugging and apparently it raises this error when you have nested suites ("describe" within an existing "describe") on a spec file. When I remove the nesting it works fine.

Hope it helps.

Cheers,

abhishekswain commented 8 years ago

Working on the same.

For the time being , please write spec files in the following format in order to get the reports.

describe('something',function(){
    it('something',function(){
    });

    it('something',function(){
    });
});

That means nested describe and it blocks are not supported by the plugin at the moment.

maksimr commented 8 years ago

+1 have same issue...

caseyhoward commented 8 years ago

I just experienced this attempting to update from 1.1.3 to 1.2.7

azachar commented 8 years ago

Hi there,

try to use a brand new fork of this plugin - https://github.com/azachar/protractor-screenshoter-plugin, your problem should be fixed there. Could you please confirm it?

Also, the fork comes with units and integrational tests, so if you provide with your config, protractor spec, it is easy to create a test case there.

Have a look at links:

plugin test config protractor sample spec a test that runs protractor sample spec with the plugin test config

I hope I helped.

Cheers, Andrej