Skip to content

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

Open
@shalu0628

Description

@shalu0628

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions