Closed rahulkedia1409 closed 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.
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??