protractor-cucumber-typescript icon indicating copy to clipboard operation
protractor-cucumber-typescript copied to clipboard

Can you please tell how do I add assertions in my step definition file?

Open shalu0628 opened this issue 4 years ago • 0 comments

This is the code in my step definition for assertion -- const headingtitle = element(By.css('h2')); let heading = await headingtitle.getText(); console.log(heading); expect(heading).to.be.equal('First Name'); Am facing the below error

E/launcher - Error: TypeError: Cannot read property 'expect' of undefined at Object. (C:\LenderPortal-UI\typeScript\stepdefinitions\lenderinfo.js:15:26)
at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at C:\LenderPortal-UI\node_modules\cucumber\lib\cli\index.js:142:42 at Array.forEach () at Cli.getSupportCodeLibrary (C:\LenderPortal-UI\node_modules\cucumber\lib\cli\index.js:142:22)
at C:\LenderPortal-UI\node_modules\cucumber\lib\cli\index.js:169:41 at Generator.next () at asyncGeneratorStep (C:\LenderPortal-UI\node_modules\cucumber\lib\cli\index.js:44:103) at _next (C:\LenderPortal-UI\node_modules\cucumber\lib\cli\index.js:46:194) [18:24:28] E/launcher - Process exited with error code 100

shalu0628 avatar Jul 20 '21 13:07 shalu0628