igniteram / protractor-cucumber-typescript

e2e kickstarter test framework which consists of protractor, cucumber frameworks using typescript lang!
MIT License
196 stars 170 forks source link

Assertion failure is not reflecting in cucumber report. #69

Closed rahulkedia1409 closed 5 years ago

rahulkedia1409 commented 5 years ago

const chai = require("chai").use(require("chai-as-promised")); const expect = chai.expect;

Issue:-1 await expect(element.getText()).to.eventually.equal(expected_txt); this statement is throwing error in console very well but the test case should be failed according to my understanding, can somebody please guide me what possibly I could be doing wrong?

{"name":"AssertionError","message":"expected 'Sparkle' to equal 'sparkle'","showDiff":true,"actual":"Sparkle","expected":"sparkle","level":"info","stack":"AssertionError: expected 'Sparkle' to equal 'sparkle'\n at getBasePromise.then.then.newArgs (/Users/rkedia/hg/BusinessSystemsTest/protractor-cucumber-typescript/node_modules/chai-as-promised/lib/chai-as-promised.js:302:22)\n at process._tickCallback (internal/process/next_tick.js:68:7)"} Query:- Let say my actual text is sparkle2018 and expected is if it contains sparkle I am good with the assertion, will this eventually assertion work??

rahulkedia1409 commented 5 years ago

The above issue is resolved, the mistake I was doing was, unnecessary use of try and catch block which was preventing the assertion flag a failure to the reports.

const chai = require("chai").use(require("chai-as-promised")); const expect = chai.expect;

Issue:-1 await expect(element.getText()).to.eventually.equal(expected_txt); this statement is throwing error in console very well but the test case should be failed according to my understanding, can somebody please guide me what possibly I could be doing wrong?

{"name":"AssertionError","message":"expected 'Sparkle' to equal 'sparkle'","showDiff":true,"actual":"Sparkle","expected":"sparkle","level":"info","stack":"AssertionError: expected 'Sparkle' to equal 'sparkle'\n at getBasePromise.then.then.newArgs (/Users/rkedia/hg/BusinessSystemsTest/protractor-cucumber-typescript/node_modules/chai-as-promised/lib/chai-as-promised.js:302:22)\n at process._tickCallback (internal/process/next_tick.js:68:7)"} Query:- Let say my actual text is sparkle2018 and expected is if it contains sparkle I am good with the assertion, will this eventually assertion work??

The above issue is resolved, the mistake I was doing was, unnecessary use of try and catch block which was preventing the assertion flag a failure to the reports.

igniteram commented 5 years ago

closing this issue. Please raise such questions in Gitter or Stackoverflow. Thanks,