Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aslubsky opened this issue Apr 27, 2016 · 8 comments
Open

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

aslubsky opened this issue Apr 27, 2016 · 8 comments
Labels

Comments

@aslubsky
Copy link

npm -v
2.15.1

node -v
v4.4.3

protractor --version
Version 3.2.2

npm install jasmine2-protractor-utils -g
[email protected] /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
Copy link
Owner

Are your tests running ?

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

@aslubsky
Copy link
Author

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 #1 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
Copy link

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

@ghost
Copy link

ghost commented May 3, 2016

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
Copy link
Owner

abhishekswain commented May 10, 2016

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
Copy link

maksimr commented Jun 9, 2016

+1 have same issue...

@caseyhoward
Copy link

I just experienced this attempting to update from 1.1.3 to 1.2.7

@azachar
Copy link

azachar commented Nov 10, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants