Like jasmine.getenv (). Currentspec with jasmine 2.3

I want to get the passed or fail status of my test after each specification is executed:

var passed = jasmine.getEnv().currentSpec.results().passed();
      if (!passed) {
        browser.takeScreenshot().then(function(png) {
          writeScreenShot(png, filename, path);
        };
      }

      

but jasmine.getEnv().currentSpec

returns undefined

, I am using Jasmine 2.3, how can I get currentSpec

with Jasmine 2.3

+3


source to share


1 answer


You are probably calling this from outside the current spec. jasmine.getEnv().currentSpec

will be null if there is no current specification, for example if it is called in blocks afterAll

or beforeAll

. Make sure this code is called in the context of the spec.



I cannot confirm that this is a problem without seeing more context, but it looks like this.

0


source







All Articles