question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

protractor 2.0 fails with `Cannot read property '_failures' of undefined`

See original GitHub issue

I want to use the jasmine-reports with the protractor 2.0, but I’m getting an error:

/Dev/project/node_modules/jasmine-reporters/src/junit_reporter.js:154
            if (isFailed(spec)) { spec._suite._failures++; }
                                             ^
TypeError: Cannot read property '_failures' of undefined

I checked the ‘spec’ object, it’s like this currently (no _suite property)

{ id: 'spec0',
  description: 'should contain basic identifiers',
  fullName: 'episode: TC14235 required fields should contain basic identifiers',
  failedExpectations: 
   [ { matcherName: '',
       message: 'Failed: undefined is not a function',
       stack: 'Error: Failed: undefined is not a function\n    at stack (/Dev/project/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1441:17)\n    ...
       passed: false,
       expected: '',
       actual: '' } ],
  passedExpectations: [],
  status: 'failed',
  _endTime: Thu Apr 16 2015 10:42:18 GMT-0400 (EDT) }

May be I’m doing something not supported in the 2.0?

Thanks

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:27

github_iconTop GitHub Comments

1reaction
shahatacommented, Jun 21, 2015

The solution for this is pretty simple: onPrepare should return the promise and so protractor will wait for the promise to resolve before going on to running the tests:

  framework: 'jasmine2',
  onPrepare: function() {
    var jasmineReporters = require('jasmine-reporters');
    return browser.getProcessedConfig().then(function(config) {
      jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({...}));
    });
  }
0reactions
Saurabh06commented, May 5, 2016

Still problem is not resolved. I am using “protractor-jasmine2-html-reporter” with Jasmine2 Framework in conf.js onPrepare: function() { var capsPromise = browser.getProcessedConfig(); capsPromise.then(function(caps){ var browserName = caps.capabilities.browserName.toUpperCase(); var browserVersion = caps.capabilities.browser_version; var platform = process.platform; var prePendStr=browserName+“”+browserVersion+“”+platform; browser.manage().timeouts().pageLoadTimeout(600000), browser.manage().timeouts().implicitlyWait(300000), jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({ savePath: _dirname+'/…/TestOutput/Automation_reports’+timeStamp+‘/’, takeScreenshotsOnlyOnFailures: true, screenshotsFolder: ‘./screenshots’, filePrefix: prePendStr+‘report’ }));}); } getting error: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed: Cannot read property 'presenceOf' of undefined
I'm trying to wait for element presence using protractor, typescript. Here are my code: import { browser, by, element } from 'protractor' ...
Read more >
Failed: Cannot read property 'isPresent' of undefined
This is my test: var elm = productDialogPage.createTaskButton; var EC = protractor.ExpectedConditions; //get count of checked checkboxes, count ...
Read more >
unknown error: Cannot read property 'get' of undefined
19:29:18.964 FAIL WebDriverException: Message: unknown error: Cannot read property 'get' of undefined. (Session info: headless chrome=72.0.3626.119).
Read more >
angular/protractor - Gitter
so, i have tried all the options to keep js file alive but i was failed, last option i ... TypeError: Cannot read...
Read more >
Intermittent test suite failures, TypeError: Cannot read property ...
This error "TypeError: Object #<Sockit> has no method 'setPollTimeout'" is that we have a "bad" binary for sockit.node NodeJS binary module. If you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found